diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/EXPERIMENTS.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/EXPERIMENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..133281d34614b39cfd27f31d07854aadd3549253 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/EXPERIMENTS.md @@ -0,0 +1,219 @@ +# Experiments + +All learned weights are initialized here from scratch. Validation windows are used only for selection and diagnostics. Screen evaluations span all 97 configurations, sampling at most 192 instances per configuration with seed 2026 and recomputing Seasonal Naive on exactly that subset. Full validation uses the supplied reference. Neither scale is the held-out reward scale. + +## E0: contract bootstrap +- Hypothesis: maintain a runnable package while training the first candidate. +- Changed factor: none; provided Seasonal Naive formula, with no learned parameters. +- Seed: deterministic. Measured compute: no training. +- Checkpoint hash: not applicable. +- Outcome: provisional package published with atomic directory exchange. + +## E1: direct long-horizon quantile forecasting +- Hypothesis: a direct horizon objective and explicit seasonal context features reduce long-horizon median drift and the underestimation of uncertainty from short-patch autoregression. +- Changed factors relative to the supplied baseline: 6,758,720-parameter encoder/decoder (4 encoder and 3 decoder layers, width 256), 32-point patches, variable 512–4096-point context, direct 32/128/512/1024-step objectives, monotone nine-quantile head. Context features contain recent levels, fixed damped slope and four-cycle primary/secondary seasonal averages; all weights are globally fixed at inference. +- Corpus: all 95 mounted allow-listed directories, deterministic source-capped sample totaling 958,745,103 points / 3.835 GB and 357,789 series. Shortest retained series: 16 points. At most eight shuffled shards per source, up to approximately 24M points/source. Series exceeding 131,072 points are cropped at a random position. Packing took under two minutes on six workers. +- Mixture: directory weight proportional to capped points^0.25, climate multiplier 0.35, low-frequency competition-source multiplier 3. Synthetic proportion 20%. Exact logic is in provenance/data.py. +- Synthetic generator: newly generated damped trends, Fourier seasonality, AR noise, intermittent demand and changepoints. No downloaded synthetic assets. +- Training seed: 17. AdamW 3e-4, batch 128, 400-step warmup, cosine decay, bf16, one H100. Run planned for 12,000 steps with snapshots every 1,000 steps. +- Control: randomly initialized model with zero output projection (fixed seasonal mixture and fixed initial interval widths) saved at step 0 to distinguish learning from the forecasting prior. +- Completed 12,000 steps in 349.9 seconds on one H100. Measured group skills, checkpoint hashes and outcomes are recorded below. + +## Known limits and next decisions +- This first run jointly changes the architecture and objective; it does not isolate their individual causal contributions. +- The initial corpus pack samples shuffled shards but takes early Arrow record batches within each selected shard. Later runs should test a wider source sample if validation plateaus. +- 10-second daily seasonality exceeds the 4,096-point encoder window. Longer fixed context summaries are a planned ablation after initial diagnostics. + +## E1 control, step 0, screening +- Checkpoint SHA-256: `81be0f24c44a558e29dffcabb4ac15ae3c944e1afe2860851683d155f920ec2f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.037512302398682 seconds. +- Overall skill 0.000921; relative MASE 1.194471; relative WQL 0.835649. +- term skill: long=0.0466, medium=0.0284, short=-0.0280. +- domain skill: Econ/Fin=-1.0735, Energy=-0.1019, Healthcare=-0.0966, Nature=0.2991, Sales=0.3167, Transport=0.2140, Web/CloudOps=-0.1294. +- frequency skill: A=-0.6469, D=0.1541, H=0.1205, M=-0.3393, Q=-0.5490, S=-2.2691, T=0.1079, W=-0.0412. +- variates skill: multivariate=0.0528, univariate=-0.0424. +- Outcome: Untrained seasonal-mixture prior barely exceeds Seasonal Naive overall and fails badly on 10-second and low-frequency configurations. + +## E1 step 1000, seed 17, screening +- Checkpoint SHA-256: `ebdd9eaa223c2bb6e38b8faec6f465a227fcd735b654a26f3b617a757addb0d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.581991195678711 seconds. +- Overall skill 0.210443; relative MASE 0.932765; relative WQL 0.668336. +- term skill: long=0.2339, medium=0.2517, short=0.1848. +- domain skill: Econ/Fin=-0.1600, Energy=0.0730, Healthcare=-0.0312, Nature=0.3679, Sales=0.2919, Transport=0.3892, Web/CloudOps=0.2547. +- frequency skill: A=0.3078, D=0.2651, H=0.3157, M=-0.3962, Q=0.0682, S=-0.6697, T=0.2839, W=0.0983. +- variates skill: multivariate=0.2140, univariate=0.2076. +- Outcome: Improves the control by 0.2095 screening skill after about 34 seconds on one H100. Selected for first neural publication and full validation. + +## E1 step 1000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.206132; relative MASE 0.931220; relative WQL 0.676774. +- term skill: long=0.2265, medium=0.2444, short=0.1829. +- domain skill: Econ/Fin=-0.1543, Energy=0.0590, Healthcare=-0.0112, Nature=0.3688, Sales=0.3043, Transport=0.3878, Web/CloudOps=0.2461. +- frequency skill: A=0.2746, D=0.2676, H=0.3116, M=-0.3493, Q=0.0397, S=-0.6697, T=0.2712, W=0.1025. +- variates skill: multivariate=0.2097, univariate=0.2033. +- Outcome: Full 151,170-instance validation skill 0.2061, with no failed configurations. Package inference took 29.5 seconds while training shared the sole GPU. First neural publication verified. + +## E1 step 2000, screening +- Checkpoint SHA-256: `a513ac4f03aceb93a860d5e5eca70010c0101fdea794df4a9a8ae472647fb9c9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.98806357383728 seconds. +- Overall skill 0.249671; relative MASE 0.890745; relative WQL 0.632048. +- term skill: long=0.2727, medium=0.2872, short=0.2257. +- domain skill: Econ/Fin=-0.0533, Energy=0.1151, Healthcare=0.1665, Nature=0.4084, Sales=0.2984, Transport=0.3867, Web/CloudOps=0.2855. +- frequency skill: A=0.3280, D=0.2894, H=0.3291, M=-0.1483, Q=0.1703, S=-0.4627, T=0.3239, W=0.1185. +- variates skill: multivariate=0.2588, univariate=0.2423. +- Outcome: Improves screening skill to 0.2497 after 66.8 seconds of training; candidate for replacement. + +## E1 step 3000, screening +- Checkpoint SHA-256: `74da538d2365426496a12c965c0c0cdc1d3962a798bd2e2c5fed950c1f663f30`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.051600933074951 seconds. +- Overall skill 0.246085; relative MASE 0.894210; relative WQL 0.635631. +- term skill: long=0.2835, medium=0.2774, short=0.2187. +- domain skill: Econ/Fin=-0.1111, Energy=0.1198, Healthcare=-0.0532, Nature=0.3956, Sales=0.3188, Transport=0.4123, Web/CloudOps=0.3004. +- frequency skill: A=0.3478, D=0.2585, H=0.3298, M=-0.3174, Q=0.1517, S=-0.6889, T=0.3620, W=0.1126. +- variates skill: multivariate=0.2552, univariate=0.2388. +- Outcome: Slight regression to 0.2461 relative to step 2000. Negative checkpoint-selection result; not selected. + +## E2 fixed longer-history feature ablation, step 2000 seed 17 +- Checkpoint SHA-256: `25ac85db67c041c92870e2ea2e8b198bb768f5c5ed64f42b78d6ec207ffe3a18`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.066685438156128 seconds. +- Overall skill 0.249089; relative MASE 0.890661; relative WQL 0.633088. +- term skill: long=0.2741, medium=0.2855, short=0.2248. +- domain skill: Econ/Fin=-0.0532, Energy=0.1146, Healthcare=0.1651, Nature=0.4048, Sales=0.2986, Transport=0.3880, Web/CloudOps=0.2859. +- frequency skill: A=0.3273, D=0.2892, H=0.3291, M=-0.1495, Q=0.1705, S=-0.4627, T=0.3228, W=0.1166. +- variates skill: multivariate=0.2572, univariate=0.2426. +- Outcome: No training. Changed only history available to seasonal summaries from 4,096 to 16,384 points, with the encoder unchanged. Skill decreased 0.24967 to 0.24909. Rejected. Validation 10-second histories are shorter than one daily cycle, so additional history cannot supply that feature. + +## E1 step 4000, screening +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.961170196533203 seconds. +- Overall skill 0.266471; relative MASE 0.874789; relative WQL 0.615080. +- term skill: long=0.2537, medium=0.2846, short=0.2643. +- domain skill: Econ/Fin=-0.0360, Energy=0.1306, Healthcare=0.1810, Nature=0.3894, Sales=0.3301, Transport=0.4253, Web/CloudOps=0.3121. +- frequency skill: A=0.3647, D=0.2978, H=0.3375, M=-0.0981, Q=0.1458, S=-0.2890, T=0.3375, W=0.1196. +- variates skill: multivariate=0.2648, univariate=0.2678. +- Outcome: Best ungated checkpoint so far; improved short-horizon performance, with some long-horizon regression. + +## E1 step 6000, screening +- Checkpoint SHA-256: `f38cdb1b49938007c20bdfdfa7c4fc7d7aba6516192f388f37088891411eab7f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.802650451660156 seconds. +- Overall skill 0.258313; relative MASE 0.878300; relative WQL 0.626324. +- term skill: long=0.2951, medium=0.3035, short=0.2254. +- domain skill: Econ/Fin=-0.0599, Energy=0.1417, Healthcare=0.2750, Nature=0.3683, Sales=0.3181, Transport=0.4116, Web/CloudOps=0.2761. +- frequency skill: A=0.3490, D=0.2962, H=0.3475, M=-0.0679, Q=0.1442, S=-0.6390, T=0.3416, W=0.0785. +- variates skill: multivariate=0.2482, univariate=0.2662. +- Outcome: Overall regression relative to step 4000 despite improvement on medium and long horizons. Not selected by overall skill. + +## E3 seasonal confidence gate, step 4000 seed 17 +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.475942373275757 seconds. +- Overall skill 0.301779; relative MASE 0.827721; relative WQL 0.588981. +- term skill: long=0.3338, medium=0.3656, short=0.2627. +- domain skill: Econ/Fin=-0.0087, Energy=0.1326, Healthcare=0.1954, Nature=0.3891, Sales=0.3285, Transport=0.4242, Web/CloudOps=0.4509. +- frequency skill: A=0.3647, D=0.2945, H=0.3455, M=-0.0632, Q=0.1395, S=0.3700, T=0.3389, W=0.1159. +- variates skill: multivariate=0.3379, univariate=0.2716. +- Outcome: No additional training. Fixed gate: weight=clip(1 - mean squared seasonal difference / (0.25 * context variance), 0, 0.98). Blend neural quantiles with a last-four-cycle seasonal mean and Gaussian intervals based on seasonal differences. Each instance uses only its own context; no optimized or adapted parameters. Skill increases 0.26647 to 0.30178; selected for full validation. + +## E3 step 4000 gate, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.296168; relative MASE 0.830141; relative WQL 0.596742. +- term skill: long=0.3262, medium=0.3621, short=0.2569. +- domain skill: Econ/Fin=-0.0444, Energy=0.1210, Healthcare=0.2106, Nature=0.3890, Sales=0.3389, Transport=0.4244, Web/CloudOps=0.4426. +- frequency skill: A=0.2806, D=0.2946, H=0.3404, M=-0.0364, Q=0.1048, S=0.3700, T=0.3291, W=0.1093. +- variates skill: multivariate=0.3332, univariate=0.2652. +- Outcome: Selected and published. Full validation skill 0.296168 versus 0.206132 for the initial neural package; no failures. Full inference took 39.8 seconds while sharing one GPU with training. This is validation skill, not a held-out reward claim. + +## E1 step 8000, seed 17, ungated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.500704050064087 seconds. +- Overall skill 0.276275; relative MASE 0.864160; relative WQL 0.606113. +- term skill: long=0.2954, medium=0.3094, short=0.2557. +- domain skill: Econ/Fin=-0.0085, Energy=0.1522, Healthcare=0.1826, Nature=0.3866, Sales=0.3192, Transport=0.4212, Web/CloudOps=0.3315. +- frequency skill: A=0.3679, D=0.3262, H=0.3533, M=-0.2016, Q=0.1316, S=-0.4192, T=0.3605, W=0.1103. +- variates skill: multivariate=0.2735, univariate=0.2785. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 8000, seed 17, gated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.228765964508057 seconds. +- Overall skill 0.312772; relative MASE 0.813977; relative WQL 0.580216. +- term skill: long=0.3671, medium=0.3752, short=0.2645. +- domain skill: Econ/Fin=-0.0003, Energy=0.1512, Healthcare=0.1999, Nature=0.3863, Sales=0.3176, Transport=0.4184, Web/CloudOps=0.4791. +- frequency skill: A=0.3679, D=0.3227, H=0.3559, M=-0.1576, Q=0.1357, S=0.3651, T=0.3604, W=0.1062. +- variates skill: multivariate=0.3530, univariate=0.2790. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, ungated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.094600439071655 seconds. +- Overall skill 0.285838; relative MASE 0.855761; relative WQL 0.595993. +- term skill: long=0.2974, medium=0.3249, short=0.2658. +- domain skill: Econ/Fin=0.0083, Energy=0.1537, Healthcare=0.1904, Nature=0.3858, Sales=0.3164, Transport=0.4217, Web/CloudOps=0.3674. +- frequency skill: A=0.3494, D=0.3058, H=0.3594, M=-0.1439, Q=0.1128, S=-0.2516, T=0.3685, W=0.1234. +- variates skill: multivariate=0.2917, univariate=0.2812. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, gated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.704133749008179 seconds. +- Overall skill 0.317743; relative MASE 0.805746; relative WQL 0.577695. +- term skill: long=0.3656, medium=0.3815, short=0.2718. +- domain skill: Econ/Fin=0.0087, Energy=0.1540, Healthcare=0.2110, Nature=0.3855, Sales=0.3148, Transport=0.4194, Web/CloudOps=0.4916. +- frequency skill: A=0.3494, D=0.3033, H=0.3612, M=-0.1027, Q=0.1231, S=0.3756, T=0.3699, W=0.1199. +- variates skill: multivariate=0.3600, univariate=0.2821. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, ungated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.807793855667114 seconds. +- Overall skill 0.284471; relative MASE 0.856118; relative WQL 0.598027. +- term skill: long=0.2877, medium=0.3155, short=0.2710. +- domain skill: Econ/Fin=0.0294, Energy=0.1544, Healthcare=0.2252, Nature=0.3903, Sales=0.3151, Transport=0.4273, Web/CloudOps=0.3413. +- frequency skill: A=0.3430, D=0.3172, H=0.3585, M=-0.1807, Q=0.1231, S=-0.2708, T=0.3565, W=0.1685. +- variates skill: multivariate=0.2854, univariate=0.2837. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, gated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.750269889831543 seconds. +- Overall skill 0.315453; relative MASE 0.812477; relative WQL 0.576760. +- term skill: long=0.3585, medium=0.3794, short=0.2715. +- domain skill: Econ/Fin=0.0081, Energy=0.1534, Healthcare=0.2414, Nature=0.3899, Sales=0.3136, Transport=0.4251, Web/CloudOps=0.4722. +- frequency skill: A=0.3430, D=0.3141, H=0.3577, M=-0.1400, Q=0.1249, S=0.3722, T=0.3572, W=0.1641. +- variates skill: multivariate=0.3552, univariate=0.2820. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E4 stochastic weight average, seed 17, gated screening +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.737564325332642 seconds. +- Overall skill 0.320612; relative MASE 0.803931; relative WQL 0.574139. +- term skill: long=0.3654, medium=0.3823, short=0.2769. +- domain skill: Econ/Fin=0.0210, Energy=0.1663, Healthcare=0.2341, Nature=0.3839, Sales=0.3192, Transport=0.4246, Web/CloudOps=0.4812. +- frequency skill: A=0.3645, D=0.3114, H=0.3584, M=-0.0937, Q=0.1411, S=0.3729, T=0.3725, W=0.1398. +- variates skill: multivariate=0.3557, univariate=0.2913. +- Outcome: Arithmetic weight average of steps 8000, 9000, 10000, 11000 and 12000. Total underlying training 349.9 seconds on one H100 for 12,000 steps / 1,536,000 windows. Averaging uses no validation labels or training updates. Screening skill 0.320612 exceeds the best individual checkpoint 0.317743; selected for full validation. + +## E3 confidence and quantile-width sweep +- Fixed global settings, selected only on validation; no model updates. Seed and checkpoint: E1 step 8000, seed 17. +- Measured CPU time: 10.7 seconds. The original threshold 0.25 and width multiplier 1.0 won; no tuned change was adopted. +- (variance threshold, width multiplier) (0.25, 1.0): skill 0.312772; term skills {'short': 0.2645319168347662, 'medium': 0.37524061562171485, 'long': 0.36711552655262625}. +- (variance threshold, width multiplier) (0.5, 1.0): skill 0.311338; term skills {'short': 0.26128183571880415, 'medium': 0.3766834137570718, 'long': 0.36686872500364487}. +- (variance threshold, width multiplier) (0.25, 0.75): skill 0.310114; term skills {'short': 0.26357949467631236, 'medium': 0.3710044838302994, 'long': 0.36223509497654094}. +- (variance threshold, width multiplier) (0.1, 1.0): skill 0.309380; term skills {'short': 0.2645827018541862, 'medium': 0.3687788042390393, 'long': 0.3590704635989247}. +- (variance threshold, width multiplier) (0.25, 1.25): skill 0.308716; term skills {'short': 0.25806263726485956, 'medium': 0.3732424245969126, 'long': 0.3664492202082874}. +- (variance threshold, width multiplier) (0.5, 0.75): skill 0.308480; term skills {'short': 0.2599791649373039, 'medium': 0.3724274186615034, 'long': 0.36196930941343286}. +- (variance threshold, width multiplier) (0.5, 1.25): skill 0.307830; term skills {'short': 0.25575126666422066, 'medium': 0.3747816871597687, 'long': 0.3663051398261168}. +- (variance threshold, width multiplier) (0.1, 0.75): skill 0.306923; term skills {'short': 0.26386190560263856, 'medium': 0.3650190620286501, 'long': 0.35398875275507513}. +- (variance threshold, width multiplier) (0.1, 1.25): skill 0.305043; term skills {'short': 0.2579337472130613, 'medium': 0.36611831669487493, 'long': 0.3583403545682865}. +- (variance threshold, width multiplier) (1.0, 1.0): skill 0.300332; term skills {'short': 0.24300377373135085, 'medium': 0.37515035650362993, 'long': 0.3625716315021771}. +- (variance threshold, width multiplier) (1.0, 0.75): skill 0.297470; term skills {'short': 0.24163138399697548, 'medium': 0.37101264403024414, 'long': 0.3577626408389879}. +- (variance threshold, width multiplier) (1.0, 1.25): skill 0.296900; term skills {'short': 0.23759298244372884, 'medium': 0.3732464838258517, 'long': 0.3619922948184182}. +- (variance threshold, width multiplier) (0.0, 1.0): skill 0.276275; term skills {'short': 0.25565045294773825, 'medium': 0.30935443355536374, 'long': 0.29541709470756516}. +- (variance threshold, width multiplier) (0.0, 0.75): skill 0.274035; term skills {'short': 0.2552205537396286, 'medium': 0.30589300644316675, 'long': 0.289930620063797}. +- (variance threshold, width multiplier) (0.0, 1.25): skill 0.271354; term skills {'short': 0.2486798921582145, 'medium': 0.30569315727356094, 'long': 0.29429049771287774}. + +## E5 capacity and exponential averaging +- Hypothesis: increased capacity reduces residual errors after direct-horizon training; exponential weight averaging reduces checkpoint noise. +- Changed factors: width 512, six encoder and four decoder layers, 37,002,816 parameters; 24,000-step schedule at 2e-4; seed 23. Same source sample, mixture, synthetic generator, batch 128 and horizon distribution as E1. Training-only EMA decay min(0.999, 1-1/(step+1)). +- Single H100; run in progress. Both raw and EMA snapshots will be evaluated across all 97 configurations. No causal claim isolates size from seed/schedule changes. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..c7921841ed206c57bf784eb5d4dfd6c43ebd125e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/model_manifest.json @@ -0,0 +1,129 @@ +{ + "name": "direct-seasonal-quantile-v1-gated", + "contract": "timeseries-forecast/v1", + "parameters": 6758720, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17" + ], + "weights_sha256": "a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db", + "training_step": 12000, + "config": { + "d": 256, + "heads": 8, + "enc_layers": 4, + "dec_layers": 3, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "notes": "Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection. Fixed context confidence gate blends highly repeatable seasonal histories with a four-cycle seasonal average and residual-based intervals; no parameters are fit at inference.", + "averaged_training_steps": [ + 8000, + 9000, + 10000, + 11000, + 12000 + ], + "postprocessing": { + "seasonal_difference_variance_threshold": 0.25, + "maximum_blend": 0.98, + "cycles_averaged": 4, + "inference_fitting": false + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/provenance/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/provenance/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/provenance/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/provenance/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/provenance/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fabc9e2546df788db0e317c2f749ad015137ab6e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/provenance/train.py @@ -0,0 +1,59 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn):opt.step() + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..27f314e97997d1b579274142486fc61f1fe08617 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S004/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.3206118297662056, + "skill_score": 0.3206118297662056, + "rel_mase_gmean": 0.803931210160146, + "rel_wql_gmean": 0.5741390308278704, + "n_configs": 97, + "n_failed": 0, + "n_instances": 9473, + "n_instances_scored": 9473, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.7799219824030353, + "rel_wql_gmean": 0.5164348252854116 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7417535647870833, + "rel_wql_gmean": 0.5144315852230752 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.8386768264751749, + "rel_wql_gmean": 0.6234333030899248 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 1.0128255498095913, + "rel_wql_gmean": 0.9463429926853267 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.9637602555686263, + "rel_wql_gmean": 0.7212176108139465 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.7904319999256741, + "rel_wql_gmean": 0.7420563992760852 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.8661497022553013, + "rel_wql_gmean": 0.4382964116093196 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.868217252012765, + "rel_wql_gmean": 0.5338892470074773 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.6923618790369103, + "rel_wql_gmean": 0.47819593295449525 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5870355547584669, + "rel_wql_gmean": 0.45854535917304357 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6260134343024937, + "rel_wql_gmean": 0.6450941932632743 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.8178696362827934, + "rel_wql_gmean": 0.5797219624196146 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7702204455932906, + "rel_wql_gmean": 0.5345124114412869 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 1.1820851076020915, + "rel_wql_gmean": 1.0119632899586575 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.8444947123361768, + "rel_wql_gmean": 0.8735901598817174 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.7162486685859489, + "rel_wql_gmean": 0.5489757663965469 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.7586536159876769, + "rel_wql_gmean": 0.5189805528808624 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 1.0036884444961964, + "rel_wql_gmean": 0.7372804657515615 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7500731835184481, + "rel_wql_gmean": 0.5534737040377392 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.8495707495004655, + "rel_wql_gmean": 0.5911452066931194 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.562908352681551, + "wql": 0.13753544794426245 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.8564419282697115, + "wql": 0.08872331883670705, + "wsql_by_level": [ + 0.05186911346383766, + 0.07856381886442973, + 0.09480955450184475, + 0.10314972665776893, + 0.10858331347261824, + 0.10767216456645227, + 0.10157972507039545, + 0.08860347636904434, + 0.06367897656397209 + ], + "n_valid_labels": 1152, + "n_masked_labels": 0, + "mae_median": 560.7099613083733, + "n_mase_elements": 1152, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6260134343024937, + "wql": 0.6450941932632743 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 192, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.6328093807889148, + "wql": 0.09249420829238211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3788988883291455, + "wql": 0.08080203021027496, + "wsql_by_level": [ + 0.040339366820734, + 0.06192611248289491, + 0.08068190618480142, + 0.09374413116285597, + 0.10194168488461999, + 0.1035238724864179, + 0.09929631169131459, + 0.08599413163439233, + 0.059770754544443486 + ], + "n_valid_labels": 1536, + "n_masked_labels": 0, + "mae_median": 549.0459798375765, + "n_mase_elements": 1536, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8444947123361768, + "wql": 0.8735901598817174 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 192, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.1499383182713028, + "wql": 0.13615614739667697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9908242961495467, + "wql": 0.111536660668691, + "wsql_by_level": [ + 0.05925257300195171, + 0.09086719044535088, + 0.11420710276499128, + 0.12982340987975566, + 0.137205253357119, + 0.1374000599475284, + 0.13043615352197915, + 0.1163736716478067, + 0.08826453145173607 + ], + "n_valid_labels": 3456, + "n_masked_labels": 0, + "mae_median": 649.3964560650013, + "n_mase_elements": 3456, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8616325592480895, + "wql": 0.8191819671846353 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.628351025088521, + "wql": 0.07401358281492869 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.098753680286521, + "wql": 0.06347614097967097, + "wsql_by_level": [ + 0.03976780647323479, + 0.05879491261202576, + 0.06962256943750281, + 0.07647087495715048, + 0.07964584461097783, + 0.077778153703923, + 0.07096151519492291, + 0.05849289800758475, + 0.039750693819716444 + ], + "n_valid_labels": 2496, + "n_masked_labels": 0, + "mae_median": 395.3373662325052, + "n_mase_elements": 2496, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.5594392229814424, + "wql": 0.8576282699135557 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.121246165533993, + "wql": 0.018785693272206375 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.6408724661547005, + "wql": 0.022776279196562024, + "wsql_by_level": [ + 0.014657391510377543, + 0.021392902625047144, + 0.025445174460456948, + 0.027500266431082717, + 0.028157818692305558, + 0.02756714225011527, + 0.025361005542648, + 0.02095189062654945, + 0.0139529206304756 + ], + "n_valid_labels": 2688, + "n_masked_labels": 0, + "mae_median": 203.07703130585807, + "n_mase_elements": 2688, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1664803969512634, + "wql": 1.2124268647705305 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2092340590206991, + "wql": 0.0345552862269015 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5753232175882008, + "wql": 0.05170589144438697, + "wsql_by_level": [ + 0.026772493497098114, + 0.04263574773064196, + 0.05374611242361799, + 0.06188821749076968, + 0.06705795590707501, + 0.06800198842336248, + 0.06329572802164837, + 0.05170876585400281, + 0.030246013651266283 + ], + "n_valid_labels": 9216, + "n_masked_labels": 0, + "mae_median": 537.7858430018597, + "n_mase_elements": 9216, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.302744663728691, + "wql": 1.4963236335207553 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0732164327522138, + "wql": 0.05629800491689715 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2855902374700885, + "wql": 0.07187897932843729, + "wsql_by_level": [ + 0.03356305705258355, + 0.05429205867268075, + 0.06957106846113045, + 0.0808502818093209, + 0.08891213800617778, + 0.09209725292384545, + 0.08999914475693388, + 0.08022439926917102, + 0.057401413004091725 + ], + "n_valid_labels": 9216, + "n_masked_labels": 0, + "mae_median": 51.02906412798586, + "n_mase_elements": 9216, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1978853456178005, + "wql": 1.2767589088554665 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4977942183991515, + "wql": 0.117173993731883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8983921468260484, + "wql": 0.0685255604267568, + "wsql_by_level": [ + 0.035053521685988145, + 0.05618545074950556, + 0.07080884319868656, + 0.08032930083906879, + 0.08567096170121513, + 0.08670639556765815, + 0.08230718715990158, + 0.07045628307987935, + 0.04921209985890795 + ], + "n_valid_labels": 92160, + "n_masked_labels": 0, + "mae_median": 51.03455240042402, + "n_mase_elements": 92160, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5998101313184755, + "wql": 0.584818851387422 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0650966408054665, + "wql": 0.09995841099505498 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8694085515412178, + "wql": 0.07066745133036852, + "wsql_by_level": [ + 0.0344220615767794, + 0.05524444250501949, + 0.06980998939579494, + 0.07981569253157093, + 0.08611270771722258, + 0.08871075465106237, + 0.08646129794443126, + 0.07731337439742064, + 0.05811674125401511 + ], + "n_valid_labels": 138240, + "n_masked_labels": 0, + "mae_median": 59.74852832341719, + "n_mase_elements": 138240, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8162719871914514, + "wql": 0.7069685344824508 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0179964070044203, + "wql": 0.07110648595392884 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.157050290107788, + "wql": 0.08545333012638653, + "wsql_by_level": [ + 0.04744720256010295, + 0.0733572677358226, + 0.08966292159396846, + 0.1004800609153955, + 0.10806817206705566, + 0.11007208864297258, + 0.10258897410753696, + 0.08302331204990444, + 0.05437997146471961 + ], + "n_valid_labels": 9216, + "n_masked_labels": 0, + "mae_median": 418.07841413364645, + "n_mase_elements": 9216, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1365956521522025, + "wql": 1.201765619267886 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.23191861478641, + "wql": 0.10739112720126776 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9468656137882083, + "wql": 0.05409113545201011, + "wsql_by_level": [ + 0.030236043889504897, + 0.04574987883574561, + 0.0559559063746221, + 0.06248880563733105, + 0.06615539335724238, + 0.06721945323971217, + 0.06427185161186147, + 0.05582674802051995, + 0.03891613810155132 + ], + "n_valid_labels": 91680, + "n_masked_labels": 480, + "mae_median": 114.33435980299095, + "n_mase_elements": 91680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.7686105254220675, + "wql": 0.5036834686597047 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3286790632662608, + "wql": 0.13485870272222733 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2600647287413074, + "wql": 0.0830977440383301, + "wsql_by_level": [ + 0.038513652989428035, + 0.06100565089375736, + 0.07725102663551937, + 0.08938898166932514, + 0.09819370130160511, + 0.10385651008655644, + 0.10439876071414297, + 0.09727006994187795, + 0.0780013421127586 + ], + "n_valid_labels": 138240, + "n_masked_labels": 0, + "mae_median": 206.77218325506283, + "n_mase_elements": 138240, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9483589856859185, + "wql": 0.6161837713172217 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6914143923967457, + "wql": 0.09427431296015211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5220504363158804, + "wql": 0.07562841683427943, + "wsql_by_level": [ + 0.029219161063442117, + 0.052024155974248844, + 0.07130035690826411, + 0.08737790415009097, + 0.09697255304422876, + 0.0976569224675461, + 0.09459216468652312, + 0.08486524675392401, + 0.06664728646024685 + ], + "n_valid_labels": 5760, + "n_masked_labels": 0, + "mae_median": 7601.903196255131, + "n_mase_elements": 5760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8998684433322839, + "wql": 0.8022165790404229 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3491139844115045, + "wql": 0.07356626033898322 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3838698871268462, + "wql": 0.06591651898817338, + "wsql_by_level": [ + 0.035674602180113785, + 0.05603817615495226, + 0.06736784571164857, + 0.07360928029282998, + 0.07876024609984905, + 0.07991499655568542, + 0.07962711606755617, + 0.06900268101870995, + 0.05325372681221528 + ], + "n_valid_labels": 1528, + "n_masked_labels": 8, + "mae_median": 42759.299497035165, + "n_mase_elements": 1528, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0257620209388776, + "wql": 0.8960156284204079 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.035818876374389075, + "wql": 1.5733022346592154, + "wsql_by_level": [ + 0.3692128052820814, + 0.6401035182685891, + 0.8151745414202722, + 0.9132691664661556, + 0.9880420319574318, + 1.1133721329286825, + 1.8456082315594797, + 3.3208620512204394, + 4.154075632829808 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.0954836845729917, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 2.236113165704285, + "wql": 0.1298258049310937 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.833062945016127, + "wql": 0.3231246291957049, + "wsql_by_level": [ + 0.2132606824464278, + 0.33284667138730484, + 0.39487224109658087, + 0.41665199160920824, + 0.409410698498364, + 0.360119268959637, + 0.3102271074993719, + 0.26253383337039893, + 0.2081991678940502 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.9562456886695898, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9999043943689984, + "wql": 0.5718582706998675 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9223504984191297, + "wql": 0.2842620774264269, + "wsql_by_level": [ + 0.18150170778118116, + 0.2796788124653366, + 0.33564287338431975, + 0.36172432342055677, + 0.3676994597528919, + 0.32420042925775244, + 0.27618658320365863, + 0.23334699085082922, + 0.19837751672131557 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 2.1605002963336735, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4305792798559852, + "wql": 0.31471776941465784 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9332317070767387, + "wql": 0.39981506660735494, + "wsql_by_level": [ + 0.4259230563755386, + 0.48668631022002645, + 0.4946246279199342, + 0.47587844005474567, + 0.44340552001504263, + 0.40320568517521377, + 0.35774000066966594, + 0.3023587184759162, + 0.2085132405601113 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 12.229897640064843, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8829627319784269, + "wql": 0.6638167387985112 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2461686817312099, + "wql": 0.5009664425016604, + "wsql_by_level": [ + 0.607160006380454, + 0.6517489801796024, + 0.6378220632287014, + 0.5965754803199992, + 0.5416731158979368, + 0.48663747370478555, + 0.4209983092205062, + 0.3416227501661141, + 0.2244598034168449 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 16.23233416510854, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9041543598737164, + "wql": 0.5175366869542126 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0528928159704314, + "wql": 0.38552412904064687, + "wsql_by_level": [ + 0.47782944838204705, + 0.49492593221725983, + 0.48173006475680097, + 0.45187534969959553, + 0.4107256808913118, + 0.3830123001996092, + 0.3357319115343127, + 0.26704867581141695, + 0.1668377978734677 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.84595681551887, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9818646515604171, + "wql": 0.42703715173069656 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1473011969515399, + "wql": 0.2955787078979974, + "wsql_by_level": [ + 0.2775183476914659, + 0.35832110530356015, + 0.3852995493039113, + 0.38196335683313026, + 0.3590234333056999, + 0.31691312832516627, + 0.2615044379518739, + 0.19518179892662246, + 0.12448321344054661 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 290.4725866577631, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9830708909409255, + "wql": 0.6269948177063812 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9832781215672161, + "wql": 0.12628611613417795, + "wsql_by_level": [ + 0.08903538646353398, + 0.13412383597952135, + 0.14989046976287335, + 0.1521692264198752, + 0.14699013904106709, + 0.14032826245846616, + 0.13223930983930957, + 0.11178305912707594, + 0.08001535611587887 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 902.6278663134053, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9756119255987875, + "wql": 0.9091250513363733 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 192, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9035793633769738, + "wql": 0.05666095000379739 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8072327700780817, + "wql": 0.059491678908526406, + "wsql_by_level": [ + 0.03280658709552681, + 0.05198846495040408, + 0.06424034541220204, + 0.07065105818740694, + 0.07380413464225603, + 0.07399002991271292, + 0.06949938850970863, + 0.05853976925510149, + 0.03990533221141872 + ], + "n_valid_labels": 2304, + "n_masked_labels": 0, + "mae_median": 26.39769525329272, + "n_mase_elements": 2304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8933722955570687, + "wql": 1.049959079481359 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 44.852216313868674, + "wql": 0.1256907683199799 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 52.40371434061989, + "wql": 0.14261276122196953, + "wsql_by_level": [ + 0.0819736649648242, + 0.13066297696394685, + 0.1640420348785171, + 0.1830868535255338, + 0.1844792765150653, + 0.18956644028103095, + 0.167259085570366, + 0.13354256419757, + 0.04890195410087155 + ], + "n_valid_labels": 5760, + "n_masked_labels": 0, + "mae_median": 244.1756173998622, + "n_mase_elements": 4980, + "n_seasonal_error_zero": 26, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.168363988390385, + "wql": 1.1346319473432616 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.723876640565778, + "wql": 0.034634625381710485, + "wsql_by_level": [ + 0.00991991724948573, + 0.021995821247711173, + 0.029420512501351186, + 0.038253299866191484, + 0.04697750024464684, + 0.050237819248772464, + 0.049714478455928364, + 0.04085632561532261, + 0.02433595400598453 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 478.05400390625, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3109294334349594, + "wql": 0.2652639689046532 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4328219388679782, + "wql": 0.011474255483699784, + "wsql_by_level": [ + 0.007106743384989145, + 0.006957905972582725, + 0.006618335680842152, + 0.00903018862715596, + 0.012932504498138363, + 0.01583764122880274, + 0.017356962451892884, + 0.01608828071037935, + 0.011339736798514724 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 4059.8515625, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.431709731691548, + "wql": 1.0335488422842112 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.5621616491005135, + "wql": 0.029082770611192053, + "wsql_by_level": [ + 0.019826878225173622, + 0.03199711971306772, + 0.03635350118798971, + 0.03852719836907664, + 0.037481012328543846, + 0.03492307472572897, + 0.029566792284956223, + 0.022135954458154024, + 0.010933404208037664 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 2788.2265625, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6640413354767647, + "wql": 0.688886896636723 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.073352392440566, + "wql": 0.3162260233676895, + "wsql_by_level": [ + 0.15388205360734475, + 0.2609183898540744, + 0.3396498950483981, + 0.4013872830041888, + 0.4349454226467047, + 0.4327607709150709, + 0.3621813803422403, + 0.24391339458887798, + 0.21639562030230536 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 13.512304560343425, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7883491402931322, + "wql": 0.5835894911867319 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6507694944632635, + "wql": 0.3878206280811447, + "wsql_by_level": [ + 0.16885157524136904, + 0.29004230253827173, + 0.34779188845548725, + 0.3615582386407927, + 0.38790471180254393, + 0.4391417666745668, + 0.5265424238547711, + 0.5422043671278161, + 0.42634837839468365 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 11.281145334243774, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.9584912409493898, + "wql": 1.4830538297494948 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7552364857264333, + "wql": 0.2703017578258706, + "wsql_by_level": [ + 0.12341418506125218, + 0.21547636414534113, + 0.2863741495129198, + 0.33022800412202086, + 0.37014874605535203, + 0.4012662516361523, + 0.3507850876654816, + 0.17832977056859783, + 0.17669326166571758 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 9.051458716392517, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.32830627937717, + "wql": 0.45094698308618314 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.9213046491500116, + "wql": 1.0544192608819731 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.9815086499795798, + "wql": 0.48772613616919513, + "wsql_by_level": [ + 0.173386148650678, + 0.3163529914125054, + 0.43649680736386454, + 0.5337013253219908, + 0.6070330884469065, + 0.6467224693663001, + 0.6477732143728598, + 0.5903646153677913, + 0.43770456521986023 + ], + "n_valid_labels": 5760, + "n_masked_labels": 0, + "mae_median": 6.334491553749669, + "n_mase_elements": 5760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6782957917641774, + "wql": 0.46255427443656016 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6634108201129322, + "wql": 0.6292934253385232 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5144781286410508, + "wql": 0.3587447286016221, + "wsql_by_level": [ + 0.14972080167953872, + 0.25782647195510733, + 0.34275508316953734, + 0.4070119138758176, + 0.45044594663591025, + 0.4715427359931442, + 0.4606548372448216, + 0.4043489350915069, + 0.2843958317692149 + ], + "n_valid_labels": 8214, + "n_masked_labels": 1002, + "mae_median": 11.5547830502965, + "n_mase_elements": 8214, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7755045788271457, + "wql": 0.5700754435955506 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.287411244479411, + "wql": 1.0537749239216045 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9393639428432318, + "wql": 0.47022280983582454, + "wsql_by_level": [ + 0.1783287933028329, + 0.3266773268362647, + 0.45025091388319527, + 0.5455520394141811, + 0.6079413450590354, + 0.6279527675123815, + 0.6019774524241635, + 0.5243279385840401, + 0.3689967115063272 + ], + "n_valid_labels": 83394, + "n_masked_labels": 8766, + "mae_median": 20.20500649272467, + "n_mase_elements": 83394, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7296533620250313, + "wql": 0.4462269875296508 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.9698300436597032, + "wql": 1.2781262019144175 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.876299555192547, + "wql": 0.4947406220974268, + "wsql_by_level": [ + 0.19594328612787387, + 0.35499118125741314, + 0.4827089218616659, + 0.5777116530628191, + 0.6370311897013018, + 0.6617889128353187, + 0.636225035155709, + 0.545229675506154, + 0.3610357433685859 + ], + "n_valid_labels": 125466, + "n_masked_labels": 12774, + "mae_median": 19.262292669333966, + "n_mase_elements": 125466, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.903559918484053, + "wql": 0.3870827633111572 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2324265356018853, + "wql": 0.8888911885968618 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.052207607987441, + "wql": 0.41341090111922657, + "wsql_by_level": [ + 0.19327686775214123, + 0.3236757352273348, + 0.4147876725543164, + 0.47592378264096385, + 0.5091452719926455, + 0.5316588733466421, + 0.5147842456604904, + 0.44915233441555824, + 0.30829332648294705 + ], + "n_valid_labels": 5469, + "n_masked_labels": 291, + "mae_median": 15.00527954675512, + "n_mase_elements": 5469, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8537690301138883, + "wql": 0.4650860605017433 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 192, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5209182034746638, + "wql": 1.6318387937857044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6263664060159706, + "wql": 1.3135916174327105, + "wsql_by_level": [ + 0.3286971294238866, + 0.6805135186680249, + 1.0262570238287463, + 1.3480050880840473, + 1.6459946088249986, + 1.8213507241907916, + 1.8748823695060846, + 1.7362663414674995, + 1.3603577529003152 + ], + "n_valid_labels": 2244, + "n_masked_labels": 60, + "mae_median": 0.7723851707186825, + "n_mase_elements": 2088, + "n_seasonal_error_zero": 14, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0693319353403763, + "wql": 0.8049763386157207 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 0.986848374037049, + "wql": 0.6711802871373964 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7274225936528541, + "wql": 0.28203245234173546, + "wsql_by_level": [ + 0.14076516050548912, + 0.23012886070914526, + 0.29558355160554395, + 0.3394336768395902, + 0.3615329898578613, + 0.3600913461163747, + 0.33487702662565216, + 0.2833348767873928, + 0.19254458202856972 + ], + "n_valid_labels": 5052, + "n_masked_labels": 708, + "mae_median": 7.679212604051342, + "n_mase_elements": 5052, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7371168791382583, + "wql": 0.4202037183550371 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9206928937000745, + "wql": 0.6152921043509473, + "wsql_by_level": [ + 0.20851078634369913, + 0.37812413761182784, + 0.5206118389850249, + 0.6389673622640607, + 0.7319680195966786, + 0.7970720487473749, + 0.8246570692769335, + 0.7931600881439858, + 0.644557588188941 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 2.870493229392907, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8403288466353812, + "wql": 0.4217856040938842 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8537458160044784, + "wql": 0.4204382712409478, + "wsql_by_level": [ + 0.18282197679201073, + 0.294139091061408, + 0.38015566477289425, + 0.4470091396091817, + 0.4987474136600784, + 0.5381458850331007, + 0.5473876563483877, + 0.5124902348963143, + 0.3830473789951547 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 12.178101572950007, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8578581462566561, + "wql": 0.5694688021449557 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 192, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6365986682735624, + "wql": 0.05919731760789244 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4687337707820295, + "wql": 0.037182287383066295, + "wsql_by_level": [ + 0.02053168421116769, + 0.030020723524694835, + 0.03622150142926968, + 0.04065647593020776, + 0.043634488262017754, + 0.04605927160409822, + 0.045753679344551434, + 0.04148239554137373, + 0.030280366600215557 + ], + "n_valid_labels": 9216, + "n_masked_labels": 0, + "mae_median": 2.831825932694806, + "n_mase_elements": 9216, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7363096942273257, + "wql": 0.6281076387506618 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 192, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5658120745234745, + "wql": 0.13695773600921238 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6467134878896843, + "wql": 0.054281748051358665, + "wsql_by_level": [ + 0.03911929709549595, + 0.053298583523145926, + 0.061453058717125496, + 0.06543892706848815, + 0.06570771090904415, + 0.06408218726936385, + 0.05889723824059869, + 0.04891281282080677, + 0.031625916818159024 + ], + "n_valid_labels": 92160, + "n_masked_labels": 0, + "mae_median": 3.993946645478718, + "n_mase_elements": 92160, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4130211399005206, + "wql": 0.39633940829532577 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 192, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.594626996271592, + "wql": 0.14766846997019759 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.68852111956885, + "wql": 0.060299198029260793, + "wsql_by_level": [ + 0.04627804338300343, + 0.06183753570670022, + 0.06973142303084881, + 0.0728320158524551, + 0.07219717837313869, + 0.06912641702388413, + 0.06293881284673222, + 0.052445775135700166, + 0.03530558091088444 + ], + "n_valid_labels": 138240, + "n_masked_labels": 0, + "mae_median": 4.252904518422912, + "n_mase_elements": 138240, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.43177565736607104, + "wql": 0.40834172685225467 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.009939859335482, + "wql": 0.13466707833323038 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8666450212722894, + "wql": 0.05702053596456856, + "wsql_by_level": [ + 0.04066427458808332, + 0.05511472264243319, + 0.06264720716225887, + 0.06616645460329255, + 0.06687677358709711, + 0.06594875378747259, + 0.06257146427732263, + 0.05476918484517243, + 0.03842598818798433 + ], + "n_valid_labels": 9216, + "n_masked_labels": 0, + "mae_median": 4.061869408573127, + "n_mase_elements": 9216, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.43117957845704696, + "wql": 0.42341852715830547 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1413441342828508, + "wql": 0.14890799191963225 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7790313507036081, + "wql": 0.0606594991259608, + "wsql_by_level": [ + 0.054252864831711246, + 0.07015375273251598, + 0.07427263723989008, + 0.07232025493485078, + 0.06670211107676992, + 0.0612592888218016, + 0.05756896147538093, + 0.05144324429014243, + 0.03796237673058426 + ], + "n_valid_labels": 92160, + "n_masked_labels": 0, + "mae_median": 3.718683468181795, + "n_mase_elements": 92160, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6825560558850224, + "wql": 0.40736228018372306 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 192, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2504479962659538, + "wql": 0.17577585499350212 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7583470123877596, + "wql": 0.057847648275490306, + "wsql_by_level": [ + 0.049927122475933575, + 0.06260303831878396, + 0.06648335991289378, + 0.06635384253927351, + 0.06383497752412082, + 0.0610247178489423, + 0.05829989093691041, + 0.05261866843173391, + 0.03948321649082058 + ], + "n_valid_labels": 138240, + "n_masked_labels": 0, + "mae_median": 3.5837440237816836, + "n_mase_elements": 138240, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6064602563659666, + "wql": 0.32909894409348056 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 192, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2079282231598354, + "wql": 0.08939797597349525 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6513468897162767, + "wql": 0.029286966053029766, + "wsql_by_level": [ + 0.02023044770779326, + 0.029451799561067016, + 0.03448090050194785, + 0.03654233824650811, + 0.036172920376967024, + 0.03373588289506792, + 0.03028168169121426, + 0.02535529621654423, + 0.01733142728015825 + ], + "n_valid_labels": 5760, + "n_masked_labels": 0, + "mae_median": 2.042281156116062, + "n_mase_elements": 5760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5392264848422945, + "wql": 0.32760211553014107 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5290103275532472, + "wql": 0.20156843060897844, + "wsql_by_level": [ + 0.106471759191893, + 0.16958073915165306, + 0.21295332816709556, + 0.2402542853153991, + 0.25390908325585126, + 0.2523902896642045, + 0.23599027664157818, + 0.20085063839019252, + 0.14171547570293885 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.8418623902234277, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7295596839699622, + "wql": 0.6666729126496569 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4694126208361893, + "wql": 0.19927071331124468, + "wsql_by_level": [ + 0.1039741558496347, + 0.1658931868587485, + 0.206358595468168, + 0.23077625016966602, + 0.24234685975087567, + 0.24200499923094845, + 0.23279189110614595, + 0.2093081647823747, + 0.15998231658464027 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.682118684521149, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7392264807655403, + "wql": 0.5088574648675395 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5238440868979056, + "wql": 0.22748501896230547, + "wsql_by_level": [ + 0.11689661570359496, + 0.1895592254052012, + 0.2377949722282228, + 0.26626407696808496, + 0.2750807927022262, + 0.2781329370062283, + 0.26666923144874244, + 0.23781630683103133, + 0.17915101236741712 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 3.054970357750567, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8609881943572982, + "wql": 0.499722461023658 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4858563952573133, + "wql": 0.13364627343721913, + "wsql_by_level": [ + 0.07122626497381208, + 0.11122981647652307, + 0.1372312136817465, + 0.15340140594650428, + 0.16066994003693627, + 0.16005354583927334, + 0.15536779698097847, + 0.14188446814067482, + 0.11175200885852349 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7762293765890018, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7981682651283681, + "wql": 0.6471009796801085 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6908742380511128, + "wql": 0.11578540780111887, + "wsql_by_level": [ + 0.08121160601772914, + 0.10686539223478451, + 0.1250563206532094, + 0.13510317783796905, + 0.13870003018403615, + 0.1368295186823397, + 0.12808759717694398, + 0.11131965319046766, + 0.0788953742325902 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 87.3612740178903, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.79005292563568, + "wql": 0.6099340626824401 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9508587210654413, + "wql": 0.15827407109519184, + "wsql_by_level": [ + 0.0895122055835451, + 0.13303765766882028, + 0.1605306107828179, + 0.17959135482198346, + 0.1929075009184669, + 0.1959090903257131, + 0.18724222862079676, + 0.163683570692981, + 0.12205242044160208 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 113.22908704042435, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8115731919491178, + "wql": 0.4525396912549961 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.300399059629856, + "wql": 0.21195561622753534, + "wsql_by_level": [ + 0.10163364424330966, + 0.16322937447295252, + 0.20691874482975645, + 0.24060093652095665, + 0.2662652788245713, + 0.27409113302703536, + 0.2643546823083718, + 0.2293807286433147, + 0.16112602317754945 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 156.04890670383418, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2034956036516304, + "wql": 0.5517965715079828 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1228045165769835, + "wql": 0.09861109532927115, + "wsql_by_level": [ + 0.0628806690575711, + 0.09770611591296406, + 0.12165791509070871, + 0.13354687490162268, + 0.13325627226601666, + 0.120301728708202, + 0.09417175964636491, + 0.07039860295646264, + 0.0535799194235276 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 78.09691034105089, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1142376139650028, + "wql": 0.49500635387898195 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9071382973254953, + "wql": 0.4021711135098007, + "wsql_by_level": [ + 0.19697085578457363, + 0.2945967757004717, + 0.36383374593861206, + 0.4190845035539291, + 0.45942516543562, + 0.4911575376993875, + 0.5031315459190547, + 0.48577588653560627, + 0.4055640050209517 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.679100528403762, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.752510679656095, + "wql": 0.8360383378294559 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0461319942370073, + "wql": 0.4266592708253553, + "wsql_by_level": [ + 0.2720487139541161, + 0.4512456079314973, + 0.5370322913170364, + 0.5609587905579042, + 0.5459926036153492, + 0.5016475557930734, + 0.4337172055146493, + 0.3347996954039037, + 0.20249097334066857 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.7804331308363803, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.3506006579357908, + "wql": 0.9725992015821587 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.361708163141335, + "wql": 0.5354729912628502, + "wsql_by_level": [ + 0.41966387905067337, + 0.6100620050890359, + 0.7086115647044359, + 0.7309397138093786, + 0.6867362128027386, + 0.5974581358277613, + 0.48677981193905745, + 0.3619835816992928, + 0.21702201644327826 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.3543707326926766, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0260988439962873, + "wql": 0.9237389041780765 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8062845254853602, + "wql": 0.37635979320239743, + "wsql_by_level": [ + 0.22949762556549747, + 0.29921328757496296, + 0.3852017207248482, + 0.44190622527198564, + 0.4679796463478663, + 0.47139287613985004, + 0.447544441465797, + 0.3866887643712998, + 0.2578135513594691 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.655489447570982, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7721844365758758, + "wql": 0.7461362519206906 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4662819208371687, + "wql": 0.4481981168533697, + "wsql_by_level": [ + 0.2625017354044551, + 0.42668240437949684, + 0.5204358062235872, + 0.5596124573751503, + 0.5636253852144124, + 0.5362693807411908, + 0.48381270611800153, + 0.40179497952205073, + 0.2790481967019822 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.624628689004817, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1983468785518292, + "wql": 0.8150014928965045 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5484725825637595, + "wql": 0.4546725044824418, + "wsql_by_level": [ + 0.3669432263437609, + 0.48660820928154663, + 0.5632126830919448, + 0.5915156153651878, + 0.5781283587909465, + 0.5287980761125591, + 0.44607746558278727, + 0.33485825721982737, + 0.19591064855341583 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 9.73433098616374, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0812879018750428, + "wql": 0.786189612382492 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.650351879436413, + "wql": 0.36169357697043136, + "wsql_by_level": [ + 0.29071941518115996, + 0.39357903162532965, + 0.4460483496609381, + 0.4571601257014316, + 0.44146174440495917, + 0.40027959323030304, + 0.34814455591206994, + 0.28037611862337886, + 0.19747325839431157 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 140.13067423956736, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9076860912116346, + "wql": 0.7453247388837858 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.135080777577389, + "wql": 0.20040266034954662, + "wsql_by_level": [ + 0.09069988729281378, + 0.14803260061493725, + 0.18626548422469993, + 0.22350345087331577, + 0.25791638465519895, + 0.2697486291871171, + 0.25052801221776455, + 0.2151719184021231, + 0.16175757567794896 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 643.6918340410505, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9121417567110254, + "wql": 0.7763225120119825 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2301469272068135, + "wql": 0.15663843780639983, + "wsql_by_level": [ + 0.06667067423694638, + 0.11359531882203933, + 0.14829750723369628, + 0.17447847111415535, + 0.19303830565317867, + 0.20373499462026176, + 0.20129469110628778, + 0.18323773730940138, + 0.12539824016163162 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 3.0802875331469943, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.6147366981334177, + "wql": 1.66761507327989 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8413614433225898, + "wql": 0.1005040690920026, + "wsql_by_level": [ + 0.0616225546718614, + 0.09652791350813825, + 0.1181091600226894, + 0.1290061139965267, + 0.1297793190403386, + 0.12513781621554437, + 0.10955814728865798, + 0.08423406686364714, + 0.05056153022061959 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.9750203000292892, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9320303132883938, + "wql": 0.7363423577581707 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1228759127998158, + "wql": 0.14451111993551571, + "wsql_by_level": [ + 0.08613220284103462, + 0.13261763026512857, + 0.16322924698252425, + 0.181757059974879, + 0.188013083405453, + 0.18682078234881597, + 0.1649695394762738, + 0.12474416943423006, + 0.07231636469130215 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.8356114007414335, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.062730135799612, + "wql": 0.8624473356879063 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7026309057057842, + "wql": 0.07654994025915575, + "wsql_by_level": [ + 0.054553615793240334, + 0.07860077542151882, + 0.09239738023712907, + 0.09925297839560039, + 0.09791306636727083, + 0.08817229510194534, + 0.07483967850654266, + 0.05855544994494971, + 0.04466422256420471 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.003260792720885, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7086098360283789, + "wql": 0.6415833989205562 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.574966507825353, + "wql": 0.2667362142671489, + "wsql_by_level": [ + 0.10852579816761179, + 0.1861074714806465, + 0.25831206167203197, + 0.31354128846692064, + 0.3484264106014783, + 0.36072405828224646, + 0.34247239037021976, + 0.28992395106541063, + 0.19259249829777392 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 19.81716767059905, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9720253831735061, + "wql": 0.7713180400163324 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.229664838913424, + "wql": 0.3757778610003399, + "wsql_by_level": [ + 0.27041662518284615, + 0.38355759278383716, + 0.4407261546377989, + 0.4624464555001577, + 0.4592021444433293, + 0.43893589049765225, + 0.39483424008953283, + 0.32266390004418766, + 0.20921774582371694 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.911296634955537, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0182499689571258, + "wql": 1.0148020868137266 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.800030582556248, + "wql": 0.32909145058936384, + "wsql_by_level": [ + 0.32152752466006357, + 0.4052765842812778, + 0.43085908133706535, + 0.4258299781371796, + 0.399971191233716, + 0.35308160264876837, + 0.29202004980259777, + 0.21457212886698485, + 0.1186849143366215 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 540.8600184758504, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0203191979416475, + "wql": 1.0326870568129365 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6905394544450978, + "wql": 0.19231724514491244, + "wsql_by_level": [ + 0.12120174475791504, + 0.19123631021453036, + 0.22427662019732827, + 0.2358665441927649, + 0.2367792343270675, + 0.22368992431793777, + 0.20842835317766895, + 0.17173354139605335, + 0.11764293372294589 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2304.457458632333, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9561544854800654, + "wql": 0.9099928808655959 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4877717262640968, + "wql": 0.02040416565682547, + "wsql_by_level": [ + 0.007447767887331266, + 0.012422888591966054, + 0.01651368981938032, + 0.01974323508044643, + 0.02185509740869964, + 0.02298348126096641, + 0.025104528462026484, + 0.02879378283414558, + 0.028773019566467037 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.444022299819774, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6399799058208122, + "wql": 0.14929073384107402 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9282966827265751, + "wql": 0.08576399986985425, + "wsql_by_level": [ + 0.033675076248638317, + 0.05991536349475529, + 0.07973404993443785, + 0.0924107870914609, + 0.09957548886737967, + 0.10627704243721023, + 0.10787810862505023, + 0.10460301648866935, + 0.08780706564108644 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 16.83970553910892, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9493297201689334, + "wql": 0.37631615265528023 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7391655651132529, + "wql": 0.0866690738484638, + "wsql_by_level": [ + 0.05769003163016911, + 0.07845332987949226, + 0.09043920401002954, + 0.09706071232861138, + 0.09897350713026273, + 0.09912974344776239, + 0.0951731602369115, + 0.08865314372338125, + 0.074448832249554 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.919930479583385, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8162593703229538, + "wql": 0.35682325205053345 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5576079748222449, + "wql": 0.07592597645068384, + "wsql_by_level": [ + 0.05398123215091299, + 0.07731132373474556, + 0.0873556752594353, + 0.08800385275695441, + 0.08455351459598519, + 0.0804832639121063, + 0.0784536033197516, + 0.07361109614384151, + 0.05958022618242179 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 14.128744132272596, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7344896049735105, + "wql": 0.4137274113365984 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9008696503787508, + "wql": 0.11920320086471087, + "wsql_by_level": [ + 0.09943134535054399, + 0.1289668714451219, + 0.13846196983624012, + 0.1380396990600443, + 0.13238940128436033, + 0.12358408394997736, + 0.11583737186168604, + 0.1074709284737885, + 0.08864713652063527 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 22.803432273347575, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8413593769959418, + "wql": 0.32739229492267335 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1183953134727973, + "wql": 0.15193509033770922, + "wsql_by_level": [ + 0.15032758298169985, + 0.18300329781609798, + 0.18983873165125484, + 0.18414359861101792, + 0.17061196085808406, + 0.15184047734788295, + 0.13261167330473034, + 0.11492713181871433, + 0.09011135864990077 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 29.7385298287206, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7493147279491936, + "wql": 0.3422899931505488 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.543495427976384, + "wql": 0.12742551920586687, + "wsql_by_level": [ + 0.04379249652758097, + 0.09883474090651759, + 0.13850209644735123, + 0.1612933378813227, + 0.17180634865249034, + 0.16680468274020677, + 0.15287267476606428, + 0.12688558439569061, + 0.08603771053557709 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 29.946717539128002, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8307980338656914, + "wql": 0.5507126200161463 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.475129561431852, + "wql": 2.4498844509060578 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6852261888534956, + "wql": 0.5472616613744008, + "wsql_by_level": [ + 0.18300044290549106, + 0.3226872610243634, + 0.43268576450955637, + 0.524906737229846, + 0.6366962935474179, + 0.7405240616068334, + 0.7965938611193105, + 0.7368304328890932, + 0.551430097537695 + ], + "n_valid_labels": 16726, + "n_masked_labels": 1706, + "mae_median": 151.89619561705118, + "n_mase_elements": 16078, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 4 + }, + "relative": { + "mase": 0.4645193254675018, + "wql": 0.2233826420556297 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.425609091597374, + "wql": 0.9981950260202351 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2993008616423685, + "wql": 0.8341360231598922, + "wsql_by_level": [ + 0.7049375717100976, + 0.979891577165514, + 1.07784764170744, + 1.083906139696818, + 1.0340787600210588, + 0.9203083050117381, + 0.7735960883190126, + 0.5862660214059876, + 0.3463921034013626 + ], + "n_valid_labels": 173366, + "n_masked_labels": 10954, + "mae_median": 486.2415936064498, + "n_mase_elements": 169900, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 20 + }, + "relative": { + "mase": 0.9114005159622831, + "wql": 0.8356443394489353 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2116324463951194, + "wql": 0.6438603691106709 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0540818840033792, + "wql": 0.44708803512793227, + "wsql_by_level": [ + 0.26450683091106014, + 0.41598988615259413, + 0.5144153208304191, + 0.5703578891160405, + 0.5875147593079547, + 0.5646485397840222, + 0.4942646674237667, + 0.37848237560303105, + 0.23361204702250238 + ], + "n_valid_labels": 263236, + "n_masked_labels": 13244, + "mae_median": 477.3900625796317, + "n_mase_elements": 252350, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 12 + }, + "relative": { + "mase": 0.8699683531416736, + "wql": 0.6943866350175746 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7193067677287346, + "wql": 0.6006753959687264 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5727000806429923, + "wql": 0.45942210607432066, + "wsql_by_level": [ + 0.2692189768967545, + 0.4665483159737205, + 0.5609698264196585, + 0.5970128626555159, + 0.5859386812762652, + 0.5304396151258095, + 0.4631766564068086, + 0.3923639179514014, + 0.26913010196295223 + ], + "n_valid_labels": 17892, + "n_masked_labels": 540, + "mae_median": 406.279147682957, + "n_mase_elements": 17316, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 6 + }, + "relative": { + "mase": 0.9147291862990716, + "wql": 0.7648425574904686 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8207109506845098, + "wql": 0.9609698607724799 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5334756587305844, + "wql": 0.22527339255639323, + "wsql_by_level": [ + 0.11838653822836273, + 0.19134571616749985, + 0.24046370833014863, + 0.267001772457499, + 0.2709494284759252, + 0.25818610328321845, + 0.24420267335068552, + 0.24144048763871487, + 0.19548410507548475 + ], + "n_valid_labels": 17856, + "n_masked_labels": 576, + "mae_median": 123.27857898392874, + "n_mase_elements": 17376, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 12 + }, + "relative": { + "mase": 0.6500164988485188, + "wql": 0.23442295305214483 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0355995207112445, + "wql": 0.9462932768706092 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9357531197409896, + "wql": 0.6357359397099701, + "wsql_by_level": [ + 0.15608827520161742, + 0.31688935799517526, + 0.5082628578214454, + 0.6836772482702189, + 0.8156361114391674, + 0.8804462884781545, + 0.8857377118306539, + 0.8232961317043748, + 0.651589474648922 + ], + "n_valid_labels": 179348, + "n_masked_labels": 4972, + "mae_median": 256.13836383706126, + "n_mase_elements": 176510, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 8 + }, + "relative": { + "mase": 0.903585894959008, + "wql": 0.6718170309867869 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9536407922903287, + "wql": 1.195969378014948 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.873429358313215, + "wql": 0.8605844707505687, + "wsql_by_level": [ + 0.4350906669356169, + 0.5950436347996391, + 0.7345751511494488, + 0.8614138470292891, + 0.9695224924275704, + 1.0550446905944788, + 1.1018731552574517, + 1.0756166672192038, + 0.9170799313424192 + ], + "n_valid_labels": 262774, + "n_masked_labels": 13706, + "mae_median": 254.39029370191565, + "n_mase_elements": 256386, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 22 + }, + "relative": { + "mase": 0.9158892586961674, + "wql": 0.7195706567161056 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 192, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.19979943003215, + "wql": 0.9623672040420215 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 192, + "instances": 192, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8404421579174318, + "wql": 0.6134102570184434, + "wsql_by_level": [ + 0.14648080130072658, + 0.30812527879307827, + 0.47311629958573426, + 0.6395645359419756, + 0.788948041432569, + 0.8867578718783535, + 0.8970760550112997, + 0.7979005484620763, + 0.5827228807601782 + ], + "n_valid_labels": 18028, + "n_masked_labels": 404, + "mae_median": 305.8287661594307, + "n_mase_elements": 17472, + "n_seasonal_error_zero": 4, + "n_seasonal_error_nan": 16 + }, + "relative": { + "mase": 0.7004855452339324, + "wql": 0.6373972995360502 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6716992508480799, + "wql": 0.010849374041273426, + "wsql_by_level": [ + 0.006220900865359864, + 0.01006667451709062, + 0.012642595390297029, + 0.014133815890433735, + 0.014582313895548262, + 0.013949082262235806, + 0.012184600347448818, + 0.00906609319808545, + 0.00479829000496125 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 377.3232058207194, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4819999140396985, + "wql": 0.5894934024987455 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.679837292096598, + "wql": 0.009305137151633332, + "wsql_by_level": [ + 0.00530445854652697, + 0.008273511881373543, + 0.010403335760104609, + 0.011669071060230466, + 0.012242270091398761, + 0.011796717004438649, + 0.01054764909429368, + 0.008382359113105338, + 0.0051268618132279745 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 293.08126291592913, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7402944408789925, + "wql": 0.6771080436228055 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7507178499920966, + "wql": 0.010360502793605123, + "wsql_by_level": [ + 0.0063089761961104985, + 0.009821463544968378, + 0.011946554904883304, + 0.013009174594262637, + 0.013274545111447678, + 0.01273539469300258, + 0.011409559743866869, + 0.009109819646638418, + 0.005629036707265754 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 323.43920355266994, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.002660418807035, + "wql": 0.8004913079138573 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.575104130314741, + "wql": 0.010368109800576246, + "wsql_by_level": [ + 0.006059606031695453, + 0.009625848372154688, + 0.011965997653575982, + 0.013319753024814541, + 0.013718707126120472, + 0.013272530002723475, + 0.011762962414910169, + 0.00903180363728931, + 0.004555779941902122 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 18.395116610777755, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5446533790301765, + "wql": 0.40635291884337926 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7063612765132248, + "wql": 0.010268701154378106, + "wsql_by_level": [ + 0.005981876035127484, + 0.009298769286824085, + 0.011504506537805971, + 0.012781900535364111, + 0.013280216858707297, + 0.0128811222924594, + 0.011643001337696185, + 0.009313433967272517, + 0.005733483538145908 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 16.75049422401994, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.739905530486599, + "wql": 0.43671657705574035 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.778833087541558, + "wql": 0.011431034227114507, + "wsql_by_level": [ + 0.006918185179699318, + 0.010896859779897279, + 0.013307229183344024, + 0.014507678517378216, + 0.014738871863874672, + 0.014009364631534885, + 0.012443429584995709, + 0.00990291459443638, + 0.006154774708870087 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 18.83384811695448, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9364426177121835, + "wql": 0.48275017364942563 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.2797092577432919, + "wql": 0.10084452987949388, + "wsql_by_level": [ + 0.04621291585944067, + 0.07373363326076819, + 0.09376629616873143, + 0.10832153713173125, + 0.11845204390471216, + 0.12672290126897795, + 0.12791378516127738, + 0.12034217517335596, + 0.09213548098644993 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 3.0429448854355585, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3622514827844754, + "wql": 0.4564244715908583 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.451293973339005, + "wql": 0.1566532293358784, + "wsql_by_level": [ + 0.11622214269190341, + 0.15483972099611576, + 0.17454784521328487, + 0.18185387414164927, + 0.18032921594542664, + 0.1767256252663815, + 0.17095457230486474, + 0.15035317100244053, + 0.10405289646083901 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 4.013339405223018, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3130306644112532, + "wql": 0.33265935720985124 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6623660700774044, + "wql": 0.25451686458526196, + "wsql_by_level": [ + 0.13269542248489316, + 0.21557363628985238, + 0.26816882037979844, + 0.30698934518037735, + 0.33799587265542186, + 0.3442606051551686, + 0.31494379044929033, + 0.24323323640467212, + 0.12679105226788323 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.183163712422053, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3937899470629886, + "wql": 0.37674429679784427 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7079790832072135, + "wql": 0.21641864496503596, + "wsql_by_level": [ + 0.14085770561997388, + 0.22716389080338673, + 0.27981225135978877, + 0.3068912286628406, + 0.31086181420375114, + 0.28233292615992733, + 0.20826889899880058, + 0.11731279389945551, + 0.07426629497739906 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.503928418670382, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.44679195066253885, + "wql": 0.3882810298729288 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3582352287507424, + "wql": 0.21848919851454435, + "wsql_by_level": [ + 0.12332973963347507, + 0.1836805240510679, + 0.22214179746322726, + 0.2446513364900517, + 0.2573923422963429, + 0.2664253932938287, + 0.26336201585805985, + 0.2359136151811406, + 0.16950602236370518 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.5228657913881416, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.22168523945095053, + "wql": 0.19564016616099775 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3988800317952994, + "wql": 0.2009607943648956, + "wsql_by_level": [ + 0.10658865169129514, + 0.16797485453531197, + 0.20783552580497647, + 0.23256877923723282, + 0.24399305537325008, + 0.2466872611612479, + 0.23616725423864401, + 0.21031234708756325, + 0.15651942015453893 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.686447623932806, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.31157050475189013, + "wql": 0.1983025756463502 + } + } + ], + "checkpoint_sha256": "a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db", + "eval_seconds": 7.737564325332642 +} \ No newline at end of file diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/EXPERIMENTS.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/EXPERIMENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..1a8c6aca2bd0628047a67639304b8ab0c135fb1a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/EXPERIMENTS.md @@ -0,0 +1,424 @@ +# Experiments + +All learned weights are initialized here from scratch. Validation windows are used only for selection and diagnostics. Screen evaluations span all 97 configurations, sampling at most 192 instances per configuration with seed 2026 and recomputing Seasonal Naive on exactly that subset. Full validation uses the supplied reference. Neither scale is the held-out reward scale. + +## E0: contract bootstrap +- Hypothesis: maintain a runnable package while training the first candidate. +- Changed factor: none; provided Seasonal Naive formula, with no learned parameters. +- Seed: deterministic. Measured compute: no training. +- Checkpoint hash: not applicable. +- Outcome: provisional package published with atomic directory exchange. + +## E1: direct long-horizon quantile forecasting +- Hypothesis: a direct horizon objective and explicit seasonal context features reduce long-horizon median drift and the underestimation of uncertainty from short-patch autoregression. +- Changed factors relative to the supplied baseline: 6,758,720-parameter encoder/decoder (4 encoder and 3 decoder layers, width 256), 32-point patches, variable 512–4096-point context, direct 32/128/512/1024-step objectives, monotone nine-quantile head. Context features contain recent levels, fixed damped slope and four-cycle primary/secondary seasonal averages; all weights are globally fixed at inference. +- Corpus: all 95 mounted allow-listed directories, deterministic source-capped sample totaling 958,745,103 points / 3.835 GB and 357,789 series. Shortest retained series: 16 points. At most eight shuffled shards per source, up to approximately 24M points/source. Series exceeding 131,072 points are cropped at a random position. Packing took under two minutes on six workers. +- Mixture: directory weight proportional to capped points^0.25, climate multiplier 0.35, low-frequency competition-source multiplier 3. Synthetic proportion 20%. Exact logic is in provenance/data.py. +- Synthetic generator: newly generated damped trends, Fourier seasonality, AR noise, intermittent demand and changepoints. No downloaded synthetic assets. +- Training seed: 17. AdamW 3e-4, batch 128, 400-step warmup, cosine decay, bf16, one H100. Run planned for 12,000 steps with snapshots every 1,000 steps. +- Control: randomly initialized model with zero output projection (fixed seasonal mixture and fixed initial interval widths) saved at step 0 to distinguish learning from the forecasting prior. +- Completed 12,000 steps in 349.9 seconds on one H100. Measured group skills, checkpoint hashes and outcomes are recorded below. + +## Known limits and next decisions +- This first run jointly changes the architecture and objective; it does not isolate their individual causal contributions. +- The initial corpus pack samples shuffled shards but takes early Arrow record batches within each selected shard. Later runs should test a wider source sample if validation plateaus. +- 10-second daily seasonality exceeds the 4,096-point encoder window. Longer fixed context summaries are a planned ablation after initial diagnostics. + +## E1 control, step 0, screening +- Checkpoint SHA-256: `81be0f24c44a558e29dffcabb4ac15ae3c944e1afe2860851683d155f920ec2f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.037512302398682 seconds. +- Overall skill 0.000921; relative MASE 1.194471; relative WQL 0.835649. +- term skill: long=0.0466, medium=0.0284, short=-0.0280. +- domain skill: Econ/Fin=-1.0735, Energy=-0.1019, Healthcare=-0.0966, Nature=0.2991, Sales=0.3167, Transport=0.2140, Web/CloudOps=-0.1294. +- frequency skill: A=-0.6469, D=0.1541, H=0.1205, M=-0.3393, Q=-0.5490, S=-2.2691, T=0.1079, W=-0.0412. +- variates skill: multivariate=0.0528, univariate=-0.0424. +- Outcome: Untrained seasonal-mixture prior barely exceeds Seasonal Naive overall and fails badly on 10-second and low-frequency configurations. + +## E1 step 1000, seed 17, screening +- Checkpoint SHA-256: `ebdd9eaa223c2bb6e38b8faec6f465a227fcd735b654a26f3b617a757addb0d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.581991195678711 seconds. +- Overall skill 0.210443; relative MASE 0.932765; relative WQL 0.668336. +- term skill: long=0.2339, medium=0.2517, short=0.1848. +- domain skill: Econ/Fin=-0.1600, Energy=0.0730, Healthcare=-0.0312, Nature=0.3679, Sales=0.2919, Transport=0.3892, Web/CloudOps=0.2547. +- frequency skill: A=0.3078, D=0.2651, H=0.3157, M=-0.3962, Q=0.0682, S=-0.6697, T=0.2839, W=0.0983. +- variates skill: multivariate=0.2140, univariate=0.2076. +- Outcome: Improves the control by 0.2095 screening skill after about 34 seconds on one H100. Selected for first neural publication and full validation. + +## E1 step 1000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.206132; relative MASE 0.931220; relative WQL 0.676774. +- term skill: long=0.2265, medium=0.2444, short=0.1829. +- domain skill: Econ/Fin=-0.1543, Energy=0.0590, Healthcare=-0.0112, Nature=0.3688, Sales=0.3043, Transport=0.3878, Web/CloudOps=0.2461. +- frequency skill: A=0.2746, D=0.2676, H=0.3116, M=-0.3493, Q=0.0397, S=-0.6697, T=0.2712, W=0.1025. +- variates skill: multivariate=0.2097, univariate=0.2033. +- Outcome: Full 151,170-instance validation skill 0.2061, with no failed configurations. Package inference took 29.5 seconds while training shared the sole GPU. First neural publication verified. + +## E1 step 2000, screening +- Checkpoint SHA-256: `a513ac4f03aceb93a860d5e5eca70010c0101fdea794df4a9a8ae472647fb9c9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.98806357383728 seconds. +- Overall skill 0.249671; relative MASE 0.890745; relative WQL 0.632048. +- term skill: long=0.2727, medium=0.2872, short=0.2257. +- domain skill: Econ/Fin=-0.0533, Energy=0.1151, Healthcare=0.1665, Nature=0.4084, Sales=0.2984, Transport=0.3867, Web/CloudOps=0.2855. +- frequency skill: A=0.3280, D=0.2894, H=0.3291, M=-0.1483, Q=0.1703, S=-0.4627, T=0.3239, W=0.1185. +- variates skill: multivariate=0.2588, univariate=0.2423. +- Outcome: Improves screening skill to 0.2497 after 66.8 seconds of training; candidate for replacement. + +## E1 step 3000, screening +- Checkpoint SHA-256: `74da538d2365426496a12c965c0c0cdc1d3962a798bd2e2c5fed950c1f663f30`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.051600933074951 seconds. +- Overall skill 0.246085; relative MASE 0.894210; relative WQL 0.635631. +- term skill: long=0.2835, medium=0.2774, short=0.2187. +- domain skill: Econ/Fin=-0.1111, Energy=0.1198, Healthcare=-0.0532, Nature=0.3956, Sales=0.3188, Transport=0.4123, Web/CloudOps=0.3004. +- frequency skill: A=0.3478, D=0.2585, H=0.3298, M=-0.3174, Q=0.1517, S=-0.6889, T=0.3620, W=0.1126. +- variates skill: multivariate=0.2552, univariate=0.2388. +- Outcome: Slight regression to 0.2461 relative to step 2000. Negative checkpoint-selection result; not selected. + +## E2 fixed longer-history feature ablation, step 2000 seed 17 +- Checkpoint SHA-256: `25ac85db67c041c92870e2ea2e8b198bb768f5c5ed64f42b78d6ec207ffe3a18`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.066685438156128 seconds. +- Overall skill 0.249089; relative MASE 0.890661; relative WQL 0.633088. +- term skill: long=0.2741, medium=0.2855, short=0.2248. +- domain skill: Econ/Fin=-0.0532, Energy=0.1146, Healthcare=0.1651, Nature=0.4048, Sales=0.2986, Transport=0.3880, Web/CloudOps=0.2859. +- frequency skill: A=0.3273, D=0.2892, H=0.3291, M=-0.1495, Q=0.1705, S=-0.4627, T=0.3228, W=0.1166. +- variates skill: multivariate=0.2572, univariate=0.2426. +- Outcome: No training. Changed only history available to seasonal summaries from 4,096 to 16,384 points, with the encoder unchanged. Skill decreased 0.24967 to 0.24909. Rejected. Validation 10-second histories are shorter than one daily cycle, so additional history cannot supply that feature. + +## E1 step 4000, screening +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.961170196533203 seconds. +- Overall skill 0.266471; relative MASE 0.874789; relative WQL 0.615080. +- term skill: long=0.2537, medium=0.2846, short=0.2643. +- domain skill: Econ/Fin=-0.0360, Energy=0.1306, Healthcare=0.1810, Nature=0.3894, Sales=0.3301, Transport=0.4253, Web/CloudOps=0.3121. +- frequency skill: A=0.3647, D=0.2978, H=0.3375, M=-0.0981, Q=0.1458, S=-0.2890, T=0.3375, W=0.1196. +- variates skill: multivariate=0.2648, univariate=0.2678. +- Outcome: Best ungated checkpoint so far; improved short-horizon performance, with some long-horizon regression. + +## E1 step 6000, screening +- Checkpoint SHA-256: `f38cdb1b49938007c20bdfdfa7c4fc7d7aba6516192f388f37088891411eab7f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.802650451660156 seconds. +- Overall skill 0.258313; relative MASE 0.878300; relative WQL 0.626324. +- term skill: long=0.2951, medium=0.3035, short=0.2254. +- domain skill: Econ/Fin=-0.0599, Energy=0.1417, Healthcare=0.2750, Nature=0.3683, Sales=0.3181, Transport=0.4116, Web/CloudOps=0.2761. +- frequency skill: A=0.3490, D=0.2962, H=0.3475, M=-0.0679, Q=0.1442, S=-0.6390, T=0.3416, W=0.0785. +- variates skill: multivariate=0.2482, univariate=0.2662. +- Outcome: Overall regression relative to step 4000 despite improvement on medium and long horizons. Not selected by overall skill. + +## E3 seasonal confidence gate, step 4000 seed 17 +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.475942373275757 seconds. +- Overall skill 0.301779; relative MASE 0.827721; relative WQL 0.588981. +- term skill: long=0.3338, medium=0.3656, short=0.2627. +- domain skill: Econ/Fin=-0.0087, Energy=0.1326, Healthcare=0.1954, Nature=0.3891, Sales=0.3285, Transport=0.4242, Web/CloudOps=0.4509. +- frequency skill: A=0.3647, D=0.2945, H=0.3455, M=-0.0632, Q=0.1395, S=0.3700, T=0.3389, W=0.1159. +- variates skill: multivariate=0.3379, univariate=0.2716. +- Outcome: No additional training. Fixed gate: weight=clip(1 - mean squared seasonal difference / (0.25 * context variance), 0, 0.98). Blend neural quantiles with a last-four-cycle seasonal mean and Gaussian intervals based on seasonal differences. Each instance uses only its own context; no optimized or adapted parameters. Skill increases 0.26647 to 0.30178; selected for full validation. + +## E3 step 4000 gate, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.296168; relative MASE 0.830141; relative WQL 0.596742. +- term skill: long=0.3262, medium=0.3621, short=0.2569. +- domain skill: Econ/Fin=-0.0444, Energy=0.1210, Healthcare=0.2106, Nature=0.3890, Sales=0.3389, Transport=0.4244, Web/CloudOps=0.4426. +- frequency skill: A=0.2806, D=0.2946, H=0.3404, M=-0.0364, Q=0.1048, S=0.3700, T=0.3291, W=0.1093. +- variates skill: multivariate=0.3332, univariate=0.2652. +- Outcome: Selected and published. Full validation skill 0.296168 versus 0.206132 for the initial neural package; no failures. Full inference took 39.8 seconds while sharing one GPU with training. This is validation skill, not a held-out reward claim. + +## E1 step 8000, seed 17, ungated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.500704050064087 seconds. +- Overall skill 0.276275; relative MASE 0.864160; relative WQL 0.606113. +- term skill: long=0.2954, medium=0.3094, short=0.2557. +- domain skill: Econ/Fin=-0.0085, Energy=0.1522, Healthcare=0.1826, Nature=0.3866, Sales=0.3192, Transport=0.4212, Web/CloudOps=0.3315. +- frequency skill: A=0.3679, D=0.3262, H=0.3533, M=-0.2016, Q=0.1316, S=-0.4192, T=0.3605, W=0.1103. +- variates skill: multivariate=0.2735, univariate=0.2785. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 8000, seed 17, gated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.228765964508057 seconds. +- Overall skill 0.312772; relative MASE 0.813977; relative WQL 0.580216. +- term skill: long=0.3671, medium=0.3752, short=0.2645. +- domain skill: Econ/Fin=-0.0003, Energy=0.1512, Healthcare=0.1999, Nature=0.3863, Sales=0.3176, Transport=0.4184, Web/CloudOps=0.4791. +- frequency skill: A=0.3679, D=0.3227, H=0.3559, M=-0.1576, Q=0.1357, S=0.3651, T=0.3604, W=0.1062. +- variates skill: multivariate=0.3530, univariate=0.2790. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, ungated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.094600439071655 seconds. +- Overall skill 0.285838; relative MASE 0.855761; relative WQL 0.595993. +- term skill: long=0.2974, medium=0.3249, short=0.2658. +- domain skill: Econ/Fin=0.0083, Energy=0.1537, Healthcare=0.1904, Nature=0.3858, Sales=0.3164, Transport=0.4217, Web/CloudOps=0.3674. +- frequency skill: A=0.3494, D=0.3058, H=0.3594, M=-0.1439, Q=0.1128, S=-0.2516, T=0.3685, W=0.1234. +- variates skill: multivariate=0.2917, univariate=0.2812. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, gated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.704133749008179 seconds. +- Overall skill 0.317743; relative MASE 0.805746; relative WQL 0.577695. +- term skill: long=0.3656, medium=0.3815, short=0.2718. +- domain skill: Econ/Fin=0.0087, Energy=0.1540, Healthcare=0.2110, Nature=0.3855, Sales=0.3148, Transport=0.4194, Web/CloudOps=0.4916. +- frequency skill: A=0.3494, D=0.3033, H=0.3612, M=-0.1027, Q=0.1231, S=0.3756, T=0.3699, W=0.1199. +- variates skill: multivariate=0.3600, univariate=0.2821. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, ungated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.807793855667114 seconds. +- Overall skill 0.284471; relative MASE 0.856118; relative WQL 0.598027. +- term skill: long=0.2877, medium=0.3155, short=0.2710. +- domain skill: Econ/Fin=0.0294, Energy=0.1544, Healthcare=0.2252, Nature=0.3903, Sales=0.3151, Transport=0.4273, Web/CloudOps=0.3413. +- frequency skill: A=0.3430, D=0.3172, H=0.3585, M=-0.1807, Q=0.1231, S=-0.2708, T=0.3565, W=0.1685. +- variates skill: multivariate=0.2854, univariate=0.2837. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, gated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.750269889831543 seconds. +- Overall skill 0.315453; relative MASE 0.812477; relative WQL 0.576760. +- term skill: long=0.3585, medium=0.3794, short=0.2715. +- domain skill: Econ/Fin=0.0081, Energy=0.1534, Healthcare=0.2414, Nature=0.3899, Sales=0.3136, Transport=0.4251, Web/CloudOps=0.4722. +- frequency skill: A=0.3430, D=0.3141, H=0.3577, M=-0.1400, Q=0.1249, S=0.3722, T=0.3572, W=0.1641. +- variates skill: multivariate=0.3552, univariate=0.2820. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E4 stochastic weight average, seed 17, gated screening +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.737564325332642 seconds. +- Overall skill 0.320612; relative MASE 0.803931; relative WQL 0.574139. +- term skill: long=0.3654, medium=0.3823, short=0.2769. +- domain skill: Econ/Fin=0.0210, Energy=0.1663, Healthcare=0.2341, Nature=0.3839, Sales=0.3192, Transport=0.4246, Web/CloudOps=0.4812. +- frequency skill: A=0.3645, D=0.3114, H=0.3584, M=-0.0937, Q=0.1411, S=0.3729, T=0.3725, W=0.1398. +- variates skill: multivariate=0.3557, univariate=0.2913. +- Outcome: Arithmetic weight average of steps 8000, 9000, 10000, 11000 and 12000. Total underlying training 349.9 seconds on one H100 for 12,000 steps / 1,536,000 windows. Averaging uses no validation labels or training updates. Screening skill 0.320612 exceeds the best individual checkpoint 0.317743; selected for full validation. + +## E3 confidence and quantile-width sweep +- Fixed global settings, selected only on validation; no model updates. Seed and checkpoint: E1 step 8000, seed 17. +- Measured CPU time: 10.7 seconds. The original threshold 0.25 and width multiplier 1.0 won; no tuned change was adopted. +- (variance threshold, width multiplier) (0.25, 1.0): skill 0.312772; term skills {'short': 0.2645319168347662, 'medium': 0.37524061562171485, 'long': 0.36711552655262625}. +- (variance threshold, width multiplier) (0.5, 1.0): skill 0.311338; term skills {'short': 0.26128183571880415, 'medium': 0.3766834137570718, 'long': 0.36686872500364487}. +- (variance threshold, width multiplier) (0.25, 0.75): skill 0.310114; term skills {'short': 0.26357949467631236, 'medium': 0.3710044838302994, 'long': 0.36223509497654094}. +- (variance threshold, width multiplier) (0.1, 1.0): skill 0.309380; term skills {'short': 0.2645827018541862, 'medium': 0.3687788042390393, 'long': 0.3590704635989247}. +- (variance threshold, width multiplier) (0.25, 1.25): skill 0.308716; term skills {'short': 0.25806263726485956, 'medium': 0.3732424245969126, 'long': 0.3664492202082874}. +- (variance threshold, width multiplier) (0.5, 0.75): skill 0.308480; term skills {'short': 0.2599791649373039, 'medium': 0.3724274186615034, 'long': 0.36196930941343286}. +- (variance threshold, width multiplier) (0.5, 1.25): skill 0.307830; term skills {'short': 0.25575126666422066, 'medium': 0.3747816871597687, 'long': 0.3663051398261168}. +- (variance threshold, width multiplier) (0.1, 0.75): skill 0.306923; term skills {'short': 0.26386190560263856, 'medium': 0.3650190620286501, 'long': 0.35398875275507513}. +- (variance threshold, width multiplier) (0.1, 1.25): skill 0.305043; term skills {'short': 0.2579337472130613, 'medium': 0.36611831669487493, 'long': 0.3583403545682865}. +- (variance threshold, width multiplier) (1.0, 1.0): skill 0.300332; term skills {'short': 0.24300377373135085, 'medium': 0.37515035650362993, 'long': 0.3625716315021771}. +- (variance threshold, width multiplier) (1.0, 0.75): skill 0.297470; term skills {'short': 0.24163138399697548, 'medium': 0.37101264403024414, 'long': 0.3577626408389879}. +- (variance threshold, width multiplier) (1.0, 1.25): skill 0.296900; term skills {'short': 0.23759298244372884, 'medium': 0.3732464838258517, 'long': 0.3619922948184182}. +- (variance threshold, width multiplier) (0.0, 1.0): skill 0.276275; term skills {'short': 0.25565045294773825, 'medium': 0.30935443355536374, 'long': 0.29541709470756516}. +- (variance threshold, width multiplier) (0.0, 0.75): skill 0.274035; term skills {'short': 0.2552205537396286, 'medium': 0.30589300644316675, 'long': 0.289930620063797}. +- (variance threshold, width multiplier) (0.0, 1.25): skill 0.271354; term skills {'short': 0.2486798921582145, 'medium': 0.30569315727356094, 'long': 0.29429049771287774}. + +## E5 capacity and exponential averaging +- Hypothesis: increased capacity reduces residual errors after direct-horizon training; exponential weight averaging reduces checkpoint noise. +- Changed factors: width 512, six encoder and four decoder layers, 37,002,816 parameters; 24,000-step schedule at 2e-4; seed 23. Same source sample, mixture, synthetic generator, batch 128 and horizon distribution as E1. Training-only EMA decay min(0.999, 1-1/(step+1)). +- Single H100; run in progress. Both raw and EMA snapshots will be evaluated across all 97 configurations. No causal claim isolates size from seed/schedule changes. + +## E4 averaged small model, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.315325; relative MASE 0.806359; relative WQL 0.581354. +- term skill: long=0.3584, medium=0.3790, short=0.2715. +- domain skill: Econ/Fin=-0.0034, Energy=0.1557, Healthcare=0.2457, Nature=0.3833, Sales=0.3308, Transport=0.4241, Web/CloudOps=0.4729. +- frequency skill: A=0.2978, D=0.3142, H=0.3526, M=-0.0698, Q=0.1192, S=0.3729, T=0.3632, W=0.1318. +- variates skill: multivariate=0.3509, univariate=0.2856. +- Outcome: Full validation skill 0.315325, relative MASE 0.806359 and relative WQL 0.581354, all 97 configurations valid. Inference took 37.2 seconds while sharing one H100 with training. Selected over the step-4000 gated package. + +## E6 sign symmetry, averaged small model, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.13059401512146 seconds. +- Overall skill 0.328463; relative MASE 0.794174; relative WQL 0.567837. +- term skill: long=0.3740, medium=0.3863, short=0.2861. +- domain skill: Econ/Fin=0.0049, Energy=0.1627, Healthcare=0.2543, Nature=0.3978, Sales=0.3314, Transport=0.4439, Web/CloudOps=0.4889. +- frequency skill: A=0.2986, D=0.3191, H=0.3677, M=-0.0077, Q=0.1661, S=0.3711, T=0.3792, W=0.1244. +- variates skill: multivariate=0.3628, univariate=0.2998. +- Outcome: No additional training. Average the forecasts from x and negated x with quantile order reversed, then apply positivity and the same fixed seasonal gate. Screening skill rises 0.320612 to 0.328463. Hypothesis: sign symmetry reduces finite-sample neural bias. Selected for full validation. + +## E6 sign symmetry, averaged small model, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.323978; relative MASE 0.795773; relative WQL 0.574292. +- term skill: long=0.3666, medium=0.3832, short=0.2823. +- domain skill: Econ/Fin=-0.0072, Energy=0.1517, Healthcare=0.2646, Nature=0.3974, Sales=0.3433, Transport=0.4439, Web/CloudOps=0.4816. +- frequency skill: A=0.2459, D=0.3222, H=0.3623, M=0.0177, Q=0.1587, S=0.3711, T=0.3705, W=0.1158. +- variates skill: multivariate=0.3586, univariate=0.2951. +- Outcome: Full validation skill 0.323978 versus 0.315325 without sign symmetry. Relative MASE 0.795773, relative WQL 0.574292, zero failed configurations, 42.3 seconds of inference. Selected for atomic publication. + +## E7 coarse temporal resolution at inference, small averaged model +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.896855354309082 seconds. +- Overall skill 0.320862; relative MASE 0.803289; relative WQL 0.574174. +- term skill: long=0.3616, medium=0.3660, short=0.2861. +- domain skill: Econ/Fin=0.0049, Energy=0.1601, Healthcare=0.2543, Nature=0.4043, Sales=0.3314, Transport=0.4281, Web/CloudOps=0.4698. +- frequency skill: A=0.2986, D=0.3191, H=0.3444, M=-0.0077, Q=0.1661, S=0.3686, T=0.3804, W=0.1244. +- variates skill: multivariate=0.3567, univariate=0.2909. +- Outcome: Negative result: for horizons >=400, average the sign-symmetric prediction with a four-step-aggregated prediction from the same weights, then apply the unchanged seasonal gate. Screening skill falls from 0.328463 to 0.320862, so this is rejected. No training or fitted context parameters. + +## E8 median and predictable-series loss weighting +- Hypothesis: optimizing median error explicitly and weighting by context seasonal error aligns pretraining with MASE and quantile loss. +- Initial weights: E4 averaged small model, trained here from random initialization; no external pretrained assets. +- Changed factor: loss = mean over valid steps of 0.5 times mean pinball loss plus 0.25 times absolute median error, weighted per instance by clip(1/(0.25 + normalized context seasonal absolute difference), 0.25, 4). Weights are normalized across the batch. Training-only calculation; inference model unchanged. +- Seed 31, batch 256, 6,000 steps, AdamW 1e-4 with 400-step warmup and cosine decay, same source sample and synthetic generator. EMA as E5. +- Compute: 272.9 seconds elapsed on the sole H100, shared concurrently with E5. Underlying initial pretraining used 349.9 seconds. + +## E8 step 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `e7cb5c4b4f04ba1ca873bc725f5e4345874520a96cbd3f079e4f631fd3c46d50`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.978966474533081 seconds. +- Overall skill 0.331642; relative MASE 0.791898; relative WQL 0.564091. +- term skill: long=0.3735, medium=0.3891, short=0.2910. +- domain skill: Econ/Fin=-0.0197, Energy=0.1668, Healthcare=0.2894, Nature=0.4040, Sales=0.3301, Transport=0.4439, Web/CloudOps=0.4906. +- frequency skill: A=0.2646, D=0.3158, H=0.3714, M=0.0669, Q=0.1387, S=0.3726, T=0.3764, W=0.1424. +- variates skill: multivariate=0.3652, univariate=0.3036. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `dab309aff5a3a28936391b84b3ebd9d5dfc208e53c1e1602e4f5c599e3004c33`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.16230034828186 seconds. +- Overall skill 0.332263; relative MASE 0.790121; relative WQL 0.564310. +- term skill: long=0.3745, medium=0.3873, short=0.2925. +- domain skill: Econ/Fin=0.0051, Energy=0.1638, Healthcare=0.2952, Nature=0.4011, Sales=0.3311, Transport=0.4450, Web/CloudOps=0.4919. +- frequency skill: A=0.3239, D=0.3220, H=0.3698, M=0.0488, Q=0.1636, S=0.3751, T=0.3783, W=0.1317. +- variates skill: multivariate=0.3653, univariate=0.3047. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `111cf52c0662c60aebb44355135a65675a09d898995deeb4dd2f8f2b66339a0f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.85259199142456 seconds. +- Overall skill 0.326318; relative MASE 0.796087; relative WQL 0.570097. +- term skill: long=0.3658, medium=0.3826, short=0.2873. +- domain skill: Econ/Fin=-0.0159, Energy=0.1477, Healthcare=0.3155, Nature=0.4038, Sales=0.3247, Transport=0.4419, Web/CloudOps=0.4862. +- frequency skill: A=0.2949, D=0.3163, H=0.3678, M=0.0654, Q=0.1519, S=0.3722, T=0.3655, W=0.1286. +- variates skill: multivariate=0.3573, univariate=0.3006. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `5fa525d923b4af5949f2415cf0ad0b325dae7623f07aae06b3131bdbda08c209`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.634822130203247 seconds. +- Overall skill 0.332843; relative MASE 0.789360; relative WQL 0.563874. +- term skill: long=0.3745, medium=0.3875, short=0.2936. +- domain skill: Econ/Fin=0.0007, Energy=0.1627, Healthcare=0.3135, Nature=0.4026, Sales=0.3309, Transport=0.4452, Web/CloudOps=0.4913. +- frequency skill: A=0.3152, D=0.3249, H=0.3696, M=0.0640, Q=0.1700, S=0.3757, T=0.3784, W=0.1261. +- variates skill: multivariate=0.3645, univariate=0.3065. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `8ce9867a6005c28005b32d163254c088279f2a46febeadc433b403aeffc29066`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.403828620910645 seconds. +- Overall skill 0.333292; relative MASE 0.789778; relative WQL 0.562816. +- term skill: long=0.3723, medium=0.3857, short=0.2961. +- domain skill: Econ/Fin=-0.0157, Energy=0.1603, Healthcare=0.3279, Nature=0.4080, Sales=0.3286, Transport=0.4450, Web/CloudOps=0.4921. +- frequency skill: A=0.2821, D=0.3254, H=0.3697, M=0.0826, Q=0.1490, S=0.3718, T=0.3810, W=0.1182. +- variates skill: multivariate=0.3645, univariate=0.3073. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `e61535b34efac923328f1dd464f5ab8ab05913438f86125d8b933f1b166281d9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.288180112838745 seconds. +- Overall skill 0.334221; relative MASE 0.787768; relative WQL 0.562681. +- term skill: long=0.3735, medium=0.3879, short=0.2964. +- domain skill: Econ/Fin=-0.0016, Energy=0.1638, Healthcare=0.3235, Nature=0.4037, Sales=0.3295, Transport=0.4477, Web/CloudOps=0.4916. +- frequency skill: A=0.3041, D=0.3326, H=0.3704, M=0.0629, Q=0.1674, S=0.3746, T=0.3813, W=0.1128. +- variates skill: multivariate=0.3653, univariate=0.3084. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `15833e7668d9cd11ed55a4820b4700d71c6f734415d11490c7e8beb654abfa12`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.2668559551239 seconds. +- Overall skill 0.334430; relative MASE 0.788174; relative WQL 0.562038. +- term skill: long=0.3762, medium=0.3886, short=0.2953. +- domain skill: Econ/Fin=-0.0108, Energy=0.1611, Healthcare=0.3518, Nature=0.4037, Sales=0.3298, Transport=0.4457, Web/CloudOps=0.4924. +- frequency skill: A=0.2760, D=0.3360, H=0.3690, M=0.0736, Q=0.1605, S=0.3759, T=0.3813, W=0.1132. +- variates skill: multivariate=0.3660, univariate=0.3081. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.340764284133911 seconds. +- Overall skill 0.335038; relative MASE 0.787307; relative WQL 0.561630. +- term skill: long=0.3762, medium=0.3878, short=0.2968. +- domain skill: Econ/Fin=-0.0053, Energy=0.1637, Healthcare=0.3401, Nature=0.4031, Sales=0.3292, Transport=0.4464, Web/CloudOps=0.4934. +- frequency skill: A=0.2894, D=0.3329, H=0.3693, M=0.0767, Q=0.1622, S=0.3763, T=0.3828, W=0.1162. +- variates skill: multivariate=0.3659, univariate=0.3094. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E9 neural context 512 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.416622161865234 seconds. +- Overall skill 0.320871; relative MASE 0.803968; relative WQL 0.573675. +- term skill: long=0.3740, medium=0.3863, short=0.2718. +- domain skill: Econ/Fin=0.0457, Energy=0.1466, Healthcare=0.2113, Nature=0.3887, Sales=0.3285, Transport=0.4330, Web/CloudOps=0.4911. +- frequency skill: A=0.2986, D=0.2904, H=0.3587, M=-0.0099, Q=0.1658, S=0.3756, T=0.3687, W=0.1716. +- variates skill: multivariate=0.3665, univariate=0.2822. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 1024 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.072535276412964 seconds. +- Overall skill 0.329251; relative MASE 0.796444; relative WQL 0.564891. +- term skill: long=0.3740, medium=0.3863, short=0.2876. +- domain skill: Econ/Fin=0.0323, Energy=0.1629, Healthcare=0.1832, Nature=0.3978, Sales=0.3361, Transport=0.4415, Web/CloudOps=0.4998. +- frequency skill: A=0.2986, D=0.3031, H=0.3649, M=-0.0077, Q=0.1661, S=0.3761, T=0.3907, W=0.1240. +- variates skill: multivariate=0.3738, univariate=0.2915. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 2048 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.426023244857788 seconds. +- Overall skill 0.329063; relative MASE 0.794285; relative WQL 0.566744. +- term skill: long=0.3740, medium=0.3863, short=0.2872. +- domain skill: Econ/Fin=0.0227, Energy=0.1628, Healthcare=0.2235, Nature=0.3975, Sales=0.3314, Transport=0.4448, Web/CloudOps=0.4931. +- frequency skill: A=0.2986, D=0.3154, H=0.3656, M=-0.0077, Q=0.1661, S=0.3738, T=0.3847, W=0.1224. +- variates skill: multivariate=0.3651, univariate=0.2989. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E10 fixed 50/50 ensemble diagnostic +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 4.082070589065552 seconds. +- Overall skill 0.332712; relative MASE 0.791350; relative WQL 0.562676. +- term skill: long=0.3746, medium=0.3901, short=0.2921. +- domain skill: Econ/Fin=-0.0029, Energy=0.1641, Healthcare=0.3036, Nature=0.4055, Sales=0.3288, Transport=0.4500, Web/CloudOps=0.4870. +- frequency skill: A=0.2971, D=0.3243, H=0.3712, M=0.0353, Q=0.1843, S=0.3742, T=0.3778, W=0.1385. +- variates skill: multivariate=0.3658, univariate=0.3052. +- Outcome: Average of E8 EMA4000 and E5 EMA12000, both with sign symmetry and the same fixed seasonal gate. Skill 0.332712 is below E8 alone (0.334221). Rejected for now; both members would forecast every instance. + +## E8 EMA6000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.330109; relative MASE 0.789610; relative WQL 0.568323. +- term skill: long=0.3687, medium=0.3851, short=0.2920. +- domain skill: Econ/Fin=-0.0223, Energy=0.1525, Healthcare=0.3475, Nature=0.4024, Sales=0.3415, Transport=0.4461, Web/CloudOps=0.4860. +- frequency skill: A=0.2370, D=0.3358, H=0.3639, M=0.0960, Q=0.1447, S=0.3763, T=0.3738, W=0.1061. +- variates skill: multivariate=0.3616, univariate=0.3039. +- Outcome: Full validation skill 0.330109, relative MASE 0.789610, relative WQL 0.568323, zero failed configurations. Inference took 48.1 seconds while sharing the one H100. Improves the previous published 0.323978 and is selected for atomic publication. + +## E11 matched corpus-coverage experiment +- Hypothesis: broader source coverage improves generalization after the initial model has plateaued. +- Expanded sample: 95 directories, 1,032,415 series, 5,653,290,832 points (22.613 GB), versus 357,789 series and 958,745,103 points (3.835 GB). Per-source cap rises from 24M to 192M points, Arrow record batches are shuffled within each selected shard, and the per-series crop cap rises from 131,072 to 1,048,576. The same deterministic directory-hash seeds and at most eight sampled shards per directory are used. +- Two matched continuations start from E8 EMA6000: original sample control and expanded sample. Both use seed 41, batch 256, the E8 loss, 6,000 steps, AdamW 1e-4 and the same schedule/EMA. Training uses only corpus/synthetic data. +- Runs share the single H100 with E5; CPU threads are limited to three per new trainer. Results and measured elapsed compute are pending. + +## E12 fixed continuity correction +- Hypothesis: a direct-horizon head can miss the immediate level of a smooth history, and a small decaying correction should reduce short-horizon error. No training or context fitting. E8 EMA6000 weights, seed 31. +- Fixed formula: ratio=mean(square(first differences))/variance over the last 512 points; w=clip(1-ratio/0.5,0,0.95); bias=w*(last value + median of the last eight differences - first forecast median). Add bias*exp(-step/tau) to each quantile, then retain the existing positivity rule. Skip sparse missing-value differences. +- Initial diagnostic needed a missing-value guard; invalid intermediate scores were discarded. A positivity-lookback mismatch in the probe was also corrected so tau=0 exactly reproduces the control. +- CPU sweep took 6.0 seconds; final verified control and all candidate scores follow. Tau 24 selected for package/full validation. +- tau=0: skill 0.335038, relative MASE 0.787307, relative WQL 0.561630, group skills {'term': {'short': 0.2967927346774093, 'medium': 0.38776799350809343, 'long': 0.37616349665047677}, 'domain': {'Econ/Fin': -0.005273788909573085, 'Energy': 0.16374587322817125, 'Healthcare': 0.34007707190705616, 'Nature': 0.4030815329292825, 'Sales': 0.32924485226314826, 'Transport': 0.4464324047455728, 'Web/CloudOps': 0.4934311796492926}, 'freq': {'A-DEC': 0.2893784388532201, 'Q-DEC': 0.16218093798601307, 'M': 0.07665328507242941, 'W-SUN': -0.31450314757766273, 'D': 0.332876404786148, 'H': 0.3693479345200832, '15T': 0.14228566862247327, 'W-FRI': 0.032405497411887585, '10T': 0.4887742379514316, 'W-TUE': 0.309664207244038, 'W-THU': 0.14794979612329628, 'W-WED': 0.29198895648742507, '5T': 0.5120305409377247, '10S': 0.3762720731817548}}. +- tau=2: skill 0.337508, relative MASE 0.783332, relative WQL 0.560293, group skills {'term': {'short': 0.30112159439110886, 'medium': 0.3882128168958763, 'long': 0.3763449044348186}, 'domain': {'Econ/Fin': 0.012010642573481944, 'Energy': 0.1687336419481582, 'Healthcare': 0.33847751009406857, 'Nature': 0.4038059435050727, 'Sales': 0.32920024652725177, 'Transport': 0.4463400575252827, 'Web/CloudOps': 0.4950030531002031}, 'freq': {'A-DEC': 0.2973561434987757, 'Q-DEC': 0.17698071591831765, 'M': 0.07233297868059718, 'W-SUN': -0.2582996069171355, 'D': 0.3346112879714367, 'H': 0.36855118351366944, '15T': 0.14569114456054433, 'W-FRI': 0.021432593572035197, '10T': 0.5064176027092252, 'W-TUE': 0.3132256284193611, 'W-THU': 0.1516542652623164, 'W-WED': 0.29198895648742507, '5T': 0.5121886153783087, '10S': 0.38181456512243606}}. +- tau=8: skill 0.339730, relative MASE 0.781190, relative WQL 0.558067, group skills {'term': {'short': 0.30468677533784194, 'medium': 0.3890128603479147, 'long': 0.3768542253336602}, 'domain': {'Econ/Fin': 0.04357586882889164, 'Energy': 0.17060177779549268, 'Healthcare': 0.3292576172809155, 'Nature': 0.4040895491577191, 'Sales': 0.32915095007230155, 'Transport': 0.4455718893158739, 'Web/CloudOps': 0.498582535356759}, 'freq': {'A-DEC': 0.30427943534005153, 'Q-DEC': 0.18739632573970566, 'M': 0.05811644843967234, 'W-SUN': -0.14993519310493708, 'D': 0.33691177813304396, 'H': 0.36800946318922256, '15T': 0.15562275067857723, 'W-FRI': 0.015293948848938421, '10T': 0.5022238811405833, 'W-TUE': 0.308852394109824, 'W-THU': 0.16531962754891327, 'W-WED': 0.29198895648742507, '5T': 0.5124270255950129, '10S': 0.3959332124123227}}. +- tau=24: skill 0.341604, relative MASE 0.780976, relative WQL 0.555056, group skills {'term': {'short': 0.30735425505077896, 'medium': 0.38984232067302926, 'long': 0.37791322023985785}, 'domain': {'Econ/Fin': 0.07789629542475163, 'Energy': 0.16814859423491146, 'Healthcare': 0.32219860777640197, 'Nature': 0.4027938268275436, 'Sales': 0.32911299366848257, 'Transport': 0.4440214473788372, 'Web/CloudOps': 0.505502554697025}, 'freq': {'A-DEC': 0.30701454754159097, 'Q-DEC': 0.18894276751813088, 'M': 0.04173508991923269, 'W-SUN': -0.06710914169849702, 'D': 0.33891978173454174, 'H': 0.36806701600948255, '15T': 0.16691265843751302, 'W-FRI': 0.011149977535114819, '10T': 0.48062823437029445, 'W-TUE': 0.3054618645258299, 'W-THU': 0.17135723270801106, 'W-WED': 0.29198895648742507, '5T': 0.5128629288387704, '10S': 0.42606586812368186}}. +- tau=64: skill 0.340824, relative MASE 0.783313, relative WQL 0.554713, group skills {'term': {'short': 0.3064164746371565, 'medium': 0.38779908004530583, 'long': 0.3787937309532532}, 'domain': {'Econ/Fin': 0.09969949435020342, 'Energy': 0.15974598777640392, 'Healthcare': 0.3189527251466179, 'Nature': 0.4009254556920715, 'Sales': 0.32909545704191134, 'Transport': 0.44166143132149305, 'Web/CloudOps': 0.5103628293774518}, 'freq': {'A-DEC': 0.3079352359976604, 'Q-DEC': 0.18879190434187287, 'M': 0.03049481695615497, 'W-SUN': -0.03231570437562303, 'D': 0.33992332397958547, 'H': 0.36593420410508737, '15T': 0.1654947222236236, 'W-FRI': 0.009213828856730832, '10T': 0.46016772262416383, 'W-TUE': 0.3040006089982843, 'W-THU': 0.17343046632698478, 'W-WED': 0.29198895648742507, '5T': 0.5128850832828526, '10S': 0.4486615108502494}}. +- tau=128: skill 0.338292, relative MASE 0.786639, relative WQL 0.556618, group skills {'term': {'short': 0.3043668884529205, 'medium': 0.38176748757743373, 'long': 0.37868472074438897}, 'domain': {'Econ/Fin': 0.10637792737302931, 'Energy': 0.1531270206619928, 'Healthcare': 0.31816668045459984, 'Nature': 0.39985518410953147, 'Sales': 0.3290895550941987, 'Transport': 0.4399018505526925, 'Web/CloudOps': 0.5082609219137205}, 'freq': {'A-DEC': 0.3082114553822066, 'Q-DEC': 0.1886335736447592, 'M': 0.026327746733658897, 'W-SUN': -0.021307580325764297, 'D': 0.34025742210101806, 'H': 0.3625439077766571, '15T': 0.1628300810039216, 'W-FRI': 0.00856370190545519, '10T': 0.4513327819863723, 'W-TUE': 0.30351149262807786, 'W-THU': 0.1740816133131421, 'W-WED': 0.29198895648742507, '5T': 0.512369368619311, '10S': 0.44352723463256316}}. + +## E12 continuity prior, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.336914; relative MASE 0.783869; relative WQL 0.560914. +- term skill: long=0.3705, medium=0.3876, short=0.3028. +- domain skill: Econ/Fin=0.0580, Energy=0.1590, Healthcare=0.3286, Nature=0.4018, Sales=0.3415, Transport=0.4438, Web/CloudOps=0.4980. +- frequency skill: A=0.2499, D=0.3408, H=0.3619, M=0.0606, Q=0.1682, S=0.4261, T=0.3809, W=0.1368. +- variates skill: multivariate=0.3731, univariate=0.3066. +- Outcome: Full validation skill 0.336914 versus 0.330109 without the correction, relative MASE 0.783869 and relative WQL 0.560914; zero failures. Package inference took 69.8 seconds while three trainers shared the sole H100. Selected for atomic publication. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/README.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/README.md new file mode 100644 index 0000000000000000000000000000000000000000..81f34526024911fbd4f88ac22bbed36d25a65ed2 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/README.md @@ -0,0 +1,5 @@ +# Direct seasonal quantile foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6,758,720-parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means. A fixed confidence rule blends forecasts with a four-cycle seasonal average where seasonal differences are small relative to context variance; all thresholds are in model_manifest.json and seasonal.py. Forecasts average predictions of the history and its sign reversal. A fixed continuity correction for smooth histories then decays over 24 steps; continuity.py contains its complete formula. + +The runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/config.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/config.json new file mode 100644 index 0000000000000000000000000000000000000000..4edb170b2470e3843efb3106ebf6c5edab0857c4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/config.json @@ -0,0 +1,9 @@ +{ + "d": 256, + "heads": 8, + "enc_layers": 4, + "dec_layers": 3, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..6f502f979fbc688dd6c47c660a0c8cfd836d4211 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/model_manifest.json @@ -0,0 +1,137 @@ +{ + "name": "direct-seasonal-quantile-continuity", + "contract": "timeseries-forecast/v1", + "parameters": 6758720, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:own direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; seeds 17 and 31" + ], + "weights_sha256": "70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa", + "training_step": 6000, + "config": { + "d": 256, + "heads": 8, + "enc_layers": 4, + "dec_layers": 3, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "notes": "Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection. Fixed smooth-history continuity correction uses only the current context and model forecast, with a 24-step exponential decay. Continued pretraining on the same allowed corpus with median/quantile loss weighted by context seasonal error; no validation training. Fixed context confidence gate blends highly repeatable seasonal histories with a four-cycle seasonal average and residual-based intervals; no parameters are fit at inference.", + "symmetric_averaging": true, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "training_seed": 31, + "training_continuation_from": { + "checkpoint": "swa008000-012000.pt", + "sha256": "a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db", + "origin": "random initialization in this research run" + }, + "exponential_weight_average": true, + "postprocessing": { + "seasonal_difference_variance_threshold": 0.25, + "maximum_blend": 0.98, + "cycles_averaged": 4, + "inference_fitting": false + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/continuation/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/continuation/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/continuation/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/continuation/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/continuation/train.py new file mode 100644 index 0000000000000000000000000000000000000000..676c7b28bafec314e5828f1bc34d58a5b0264a91 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/continuation/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fabc9e2546df788db0e317c2f749ad015137ab6e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/provenance/train.py @@ -0,0 +1,59 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn):opt.step() + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/requirements.txt b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca733199990e5dc8e6a90509cc691f00ab8e9f5d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/requirements.txt @@ -0,0 +1,12 @@ +# Runtime pins recorded from the contributor's working environment on 2026-09-17 (Python 3.11). +# torch comes from the pytorch/pytorch:2.14.0-cuda12.6-cudnn9-runtime base image (cu130 needs driver >= 580). +torch==2.14.0 +numpy==2.4.6 +h5py==3.16.0 +pandas==2.3.3 +scipy==1.17.1 +pyarrow==25.0.1 +huggingface-hub==0.36.2 +einops==0.8.2 +safetensors==0.8.0 +pytest==9.1.1 diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/seasonal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/seasonal.py new file mode 100644 index 0000000000000000000000000000000000000000..4eaeca9b9a0e7a64cef2a27f074e57ea3b810489 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/seasonal.py @@ -0,0 +1,38 @@ +"""A fixed confidence gate for highly repeatable history; no fitted parameters.""" +import numpy as np + +def apply_gate(ctx,periods,quant,threshold=.25,strength=1.): + # Each row uses only its own context. Quantile blending preserves ordering. + b,_,h=quant.shape + out=quant.copy() + for i in range(b): + x=ctx[i];valid=np.isfinite(x) + if not valid.any():continue + x=x[np.flatnonzero(valid)[0]:] + best=None + for p in periods[i]: + p=int(p) + if p<2 or len(x)<3*p:continue + k=min(len(x)//p,8);history=x[-k*p:] + pairs=np.isfinite(history[p:])&np.isfinite(history[:-p]) + if pairs.sum()0) + # Error of a season relative to the previous one, corrected for averaging. + sigma=float(np.sqrt(np.mean(err.astype(np.float64)**2)/2*(1+1/min(k,4)))) + idx=np.arange(h)%p;median=mu[idx] + z=np.array([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0,.2533471031,.5244005127,.8416212336,1.2815515655]) + sq=median[None]+z[:,None]*sigma + sq=np.where(np.isfinite(sq),sq,quant[i]) + if np.nanmin(x)>=0:sq=np.maximum(0,sq) + best=(weight,sq) + if best is not None:out[i]=(1-best[0])*quant[i]+best[0]*best[1] + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..02643fb30eb0d33bb6c4569d8bf9f6889f616a61 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S007/validation_report.json @@ -0,0 +1,4887 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.3369138260688248, + "skill_score": 0.3369138260688248, + "rel_mase_gmean": 0.7838691649593371, + "rel_wql_gmean": 0.5609141087741257, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.761665634155523, + "rel_wql_gmean": 0.520254803407489 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7256645076536224, + "rel_wql_gmean": 0.5168203172377543 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.816210585089822, + "rel_wql_gmean": 0.5955942698815754 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.9843398753613175, + "rel_wql_gmean": 0.9014765536260718 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.9697910986886681, + "rel_wql_gmean": 0.7293954360394266 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.7088803500833322, + "rel_wql_gmean": 0.6358698666099316 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.8309754992033229, + "rel_wql_gmean": 0.4305631987299833 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8440304776946124, + "rel_wql_gmean": 0.513805237841621 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.6728089571477971, + "rel_wql_gmean": 0.45980352535467045 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5648431758378896, + "rel_wql_gmean": 0.44613007270207655 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.7363862880352082, + "rel_wql_gmean": 0.7640468193802279 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7914806627467206, + "rel_wql_gmean": 0.5490843249435354 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7615713004875542, + "rel_wql_gmean": 0.5346672395403829 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 1.031102758176209, + "rel_wql_gmean": 0.8558853263654304 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.8139486022348427, + "rel_wql_gmean": 0.8500000715158067 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.6528415818292819, + "rel_wql_gmean": 0.5045640435549522 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.7474897464939104, + "rel_wql_gmean": 0.5128035077742934 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.9973493891320516, + "rel_wql_gmean": 0.747120788628685 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7284958672178551, + "rel_wql_gmean": 0.5394728154243639 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.8309577314870087, + "rel_wql_gmean": 0.5785955796235462 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.4836987040788623, + "wql": 0.11920926387321683, + "wsql_by_level": [ + 0.07135823735529224, + 0.1073388624218239, + 0.1282963773361277, + 0.13793803301465968, + 0.1444656731883872, + 0.1488550558292407, + 0.13580327943857778, + 0.11573560424692178, + 0.08309225202792028 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 749.9080402775296, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7363862880352082, + "wql": 0.7640468193802279 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2949184279786734, + "wql": 0.08465922810107258, + "wsql_by_level": [ + 0.051939842847631215, + 0.0767951990761636, + 0.09191508327310688, + 0.10006085373381841, + 0.10307564800896277, + 0.10166346995488061, + 0.09527749227033681, + 0.08223972259108835, + 0.05896574115366471 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 586.942656737121, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8139486022348427, + "wql": 0.8500000715158067 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0119281983536108, + "wql": 0.09378969357806166, + "wsql_by_level": [ + 0.05546882779119483, + 0.08380013447707461, + 0.10148852919687494, + 0.11140991480573899, + 0.11540976774449703, + 0.11381635962332586, + 0.10625100834880342, + 0.09123073988218385, + 0.06523196033286138 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 547.2369981509038, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8182691579869553, + "wql": 0.7961015937585185 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.016812511953923, + "wql": 0.055368480826577644, + "wsql_by_level": [ + 0.029679414645202948, + 0.04714438648903868, + 0.05870695715827665, + 0.06590747573555626, + 0.06952634694111759, + 0.06944192273673407, + 0.06505082682814128, + 0.05479447561155914, + 0.0380645212935722 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 361.87465129286085, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.3874383761098823, + "wql": 0.8506821767323323 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.445792612264243, + "wql": 0.023073959615406318, + "wsql_by_level": [ + 0.014277178261976407, + 0.02074549678439311, + 0.024787307772602404, + 0.02718689336655944, + 0.0282761671157573, + 0.028049419699931202, + 0.02622863269127976, + 0.02242138406174261, + 0.015693156784414602 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 181.1724217454911, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.071414145335091, + "wql": 0.9988028112226353 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5325923152053322, + "wql": 0.0421187730689408, + "wsql_by_level": [ + 0.020715097647883644, + 0.0341820240117725, + 0.04370458399876915, + 0.04989645962570206, + 0.05342317761533549, + 0.0540268519604683, + 0.050832286885604844, + 0.04294970262303739, + 0.029338773251893848 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 402.43682869900493, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2476723083344958, + "wql": 1.2217211624758484 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.078014909991913, + "wql": 0.05769428377146367, + "wsql_by_level": [ + 0.030624003764062758, + 0.048535049883185015, + 0.06147338870658644, + 0.06962513991695478, + 0.07420921272006151, + 0.07429556292913181, + 0.0690236071697981, + 0.056636548553638213, + 0.034826040299754425 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 75.37820009181418, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.9874803803221184, + "wql": 0.9307235557072754 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9257050065662733, + "wql": 0.08605664286554743, + "wsql_by_level": [ + 0.04015282062155165, + 0.06469897678152123, + 0.08225771274853491, + 0.09442530875563246, + 0.10266271345806194, + 0.10800328274658681, + 0.10746609888659436, + 0.09857804196416221, + 0.0762648298272812 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 73.83720488185573, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.6130522340840846, + "wql": 0.7139105072881952 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9002006875353632, + "wql": 0.09238166056922184, + "wsql_by_level": [ + 0.04154772341731467, + 0.06717815083807703, + 0.08573545455916057, + 0.0990671279261633, + 0.1083330789061374, + 0.11486662653544917, + 0.11596147357999315, + 0.1094487459442161, + 0.08929656341648509 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 78.1131838363903, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8227715038673675, + "wql": 0.8588502643010266 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.139362893029569, + "wql": 0.08246493975668236, + "wsql_by_level": [ + 0.0475129981950712, + 0.07111838366046822, + 0.08599711071966655, + 0.09700342259579696, + 0.10244768779528875, + 0.10174837417153733, + 0.09562043083791222, + 0.08316318116219985, + 0.057572868672200114 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 311.13675530419147, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.1553537804140181, + "wql": 1.2193329556510362 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9620348660717172, + "wql": 0.07843242405013684, + "wsql_by_level": [ + 0.04307825698606714, + 0.06504794853164785, + 0.07854678315939076, + 0.0870091857489248, + 0.09272474917635855, + 0.09594030401492423, + 0.09401744148354607, + 0.08499584026930154, + 0.06453130708107067 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 249.5376903414865, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.7709586987342874, + "wql": 0.6370843061101604 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2653058745534567, + "wql": 0.11038698972951749, + "wsql_by_level": [ + 0.046978749791291706, + 0.07578028005050724, + 0.09721125458796262, + 0.11358610967234552, + 0.1264120240542756, + 0.1363008124923226, + 0.14091285441475676, + 0.13724676455287418, + 0.1190540579493212 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 346.46969479923195, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.9326352039039636, + "wql": 0.7522170564211073 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5581546644898054, + "wql": 0.07377083427740437, + "wsql_by_level": [ + 0.032280826735757176, + 0.05650610956480121, + 0.07474493090941997, + 0.08799953162896118, + 0.09316171178790392, + 0.0929378582457922, + 0.08770930961626058, + 0.07800462471511543, + 0.06059260529262764 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 6128.096138744497, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.9468227878504604, + "wql": 0.7965427234897967 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5825663692709357, + "wql": 0.07109620026403254, + "wsql_by_level": [ + 0.029821784001696185, + 0.05692154572023635, + 0.07874970358514405, + 0.09231184276464516, + 0.09590980846123263, + 0.09294579264489054, + 0.0827427087023, + 0.06583929840800003, + 0.044623318088147894 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 41302.409999030715, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.2017536369745243, + "wql": 1.0897759875917852 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.06982983417932886, + "wql": 2.2066528680394333, + "wsql_by_level": [ + 1.9869850405541887, + 2.0721475436422887, + 2.0118550085113966, + 1.8976265370611078, + 1.8260557818720922, + 2.0231045958439022, + 2.331033768070444, + 2.715805526101862, + 2.9952620106976138 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.1764687418646928, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 4.3593609675314, + "wql": 0.18208865307992073 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7818895766185668, + "wql": 0.3194196402449828, + "wsql_by_level": [ + 0.26626911952426546, + 0.3564635715589459, + 0.3946871497820556, + 0.3986549278418098, + 0.3837734021978811, + 0.3557879862661766, + 0.31019307143907004, + 0.24312725483507827, + 0.16582027875956265 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.8337455914788836, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9384822938644639, + "wql": 0.5653012695217282 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7819637251378123, + "wql": 0.2599707677955242, + "wsql_by_level": [ + 0.20143782058050316, + 0.2725127287903842, + 0.3062299897326275, + 0.3160872145154103, + 0.31234646497172763, + 0.29851976646257633, + 0.2706650600460628, + 0.21810295382822492, + 0.1438349112322009 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.835261413176133, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.36504276651926576, + "wql": 0.28782390143053616 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9706561394189377, + "wql": 0.42608456905826625, + "wsql_by_level": [ + 0.46297075265836224, + 0.5138087460895678, + 0.5140481329465669, + 0.49246378453467377, + 0.460733761031435, + 0.423085186415043, + 0.38539012377801674, + 0.33543763419922606, + 0.24682299987150455 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 12.707840751611272, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9183712792588427, + "wql": 0.7074322423231666 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2408457181665065, + "wql": 0.506546889758887, + "wsql_by_level": [ + 0.6095113793971516, + 0.6484062283815126, + 0.6332519339440444, + 0.5925795591178228, + 0.5394889583196257, + 0.49341664211820263, + 0.4370538386210623, + 0.36062416803881864, + 0.24458929989174166 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 16.16688145084262, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9002922978711715, + "wql": 0.523301716186122 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.053997519931657, + "wql": 0.38812491489020906, + "wsql_by_level": [ + 0.47971386673320254, + 0.4965180918142476, + 0.48289245233429695, + 0.4526379437751149, + 0.41120251869501956, + 0.38530698884885667, + 0.3403942504525006, + 0.27240372350514575, + 0.17205439785349638 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.862031475432556, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9828948321766334, + "wql": 0.4299179887465852 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.154305027610483, + "wql": 0.29575538794379574, + "wsql_by_level": [ + 0.272345767838703, + 0.3655852043531325, + 0.3928092897323668, + 0.38809902621754, + 0.36106287455193625, + 0.3179692686685256, + 0.2610588571574162, + 0.191784438887231, + 0.11108376408731067 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 292.12262317119144, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9890721590161102, + "wql": 0.6273695993471006 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9613184602753811, + "wql": 0.11438241021971583, + "wsql_by_level": [ + 0.06312709646796327, + 0.12066473841572214, + 0.14262893559416934, + 0.14821851640623418, + 0.14359423650514633, + 0.1332535655273229, + 0.11809074143934074, + 0.0949322035660034, + 0.06493165805554009 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 881.7745200943773, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9538234743269571, + "wql": 0.8234310923972907 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8002511831949732, + "wql": 0.055450772629321646, + "wsql_by_level": [ + 0.033878545873028194, + 0.04964408022680149, + 0.05915823555023557, + 0.06472081259164922, + 0.06710142862128712, + 0.0671976216460453, + 0.0637657535698496, + 0.05484349019765133, + 0.038746985387347 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 18.630124045319786, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8580099136126902, + "wql": 0.8747129733989562 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 56.522341682854226, + "wql": 0.12435987084397132, + "wsql_by_level": [ + 0.06389637553778776, + 0.1032335661782001, + 0.1343457787228633, + 0.156843556938394, + 0.17335777057915758, + 0.18668477232020586, + 0.16898155334479292, + 0.09640775639209687, + 0.03548770758224346 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 352.18626053794026, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1180257805279519, + "wql": 0.9909886742063945 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5618205680446079, + "wql": 0.027440794846154325, + "wsql_by_level": [ + 0.010894372997273877, + 0.014504372883139473, + 0.02250324400175081, + 0.03049612306411671, + 0.03646052986615873, + 0.03921657888724381, + 0.039393455226147865, + 0.03294516333196303, + 0.020553313357594655 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 371.030859375, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.24132088414634145, + "wql": 0.2101669664552832 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.34573271753735474, + "wql": 0.008879395879120669, + "wsql_by_level": [ + 0.005141620017339534, + 0.005038781013794645, + 0.007113449446977181, + 0.008697968126263235, + 0.010330321832575281, + 0.011917757200870481, + 0.01263039823058182, + 0.011275348980678574, + 0.0077689180630052595 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 3242.9583333333335, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1436317150581874, + "wql": 0.7998156694423906 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.60886063523135, + "wql": 0.030118993433570312, + "wsql_by_level": [ + 0.0233868985907115, + 0.034295221323995206, + 0.038209485686152275, + 0.03963047344834597, + 0.038164156296261444, + 0.03480616086926568, + 0.029605515897553954, + 0.02218533500637683, + 0.01078769378346997 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 2839.0458984375, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6761444192640887, + "wql": 0.7134320245365248 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.871918363561322, + "wql": 0.3031184494925771, + "wsql_by_level": [ + 0.1467100390784523, + 0.24155540743520043, + 0.31681546569616664, + 0.37258550147836456, + 0.40643817790581205, + 0.41078926741767346, + 0.36581014751807706, + 0.2545856928292264, + 0.21277634607422055 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 12.626679484049479, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.73667906696105, + "wql": 0.5593996971684988 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4931639350553017, + "wql": 0.29452792219137036, + "wsql_by_level": [ + 0.151259308003604, + 0.24692103222405007, + 0.3144780374861247, + 0.3205924196645978, + 0.29396063541179773, + 0.29346390959640223, + 0.36912518931715127, + 0.37726533746464275, + 0.28368543055396306 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 8.549039363861084, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.4841772015674368, + "wql": 1.1262958474779223 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.704551356839817, + "wql": 0.25547657491536807, + "wsql_by_level": [ + 0.1733118694350402, + 0.23903724589284406, + 0.2728517999897071, + 0.30697260848231916, + 0.34530747149353125, + 0.33676822687472896, + 0.24105883280495746, + 0.1639061276340875, + 0.22007499163109684 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.444000840187073, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.239161519764059, + "wql": 0.4262139900011041 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.1787964677102907, + "wql": 0.535264697674254, + "wsql_by_level": [ + 0.19013854364774666, + 0.35674228246115985, + 0.49398588584802605, + 0.6016228383685487, + 0.6739323372524338, + 0.7099377056159842, + 0.7008552719347735, + 0.6300937234869266, + 0.46007369045268737 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.770972850935845, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6620015676100761, + "wql": 0.4869658803418697 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.53812968874787, + "wql": 0.3894897379300199, + "wsql_by_level": [ + 0.16894238764642877, + 0.2978243465075649, + 0.3915005225213233, + 0.4552593021137394, + 0.48882419285350587, + 0.5009320146983952, + 0.4797290541919579, + 0.4206542067939589, + 0.30174161404330513 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.563994928428032, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7900627036179932, + "wql": 0.6215775848365357 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9067894633355804, + "wql": 0.4536199765752993, + "wsql_by_level": [ + 0.1750720164512408, + 0.3179080991320375, + 0.43789963579643104, + 0.5283110641178171, + 0.5843517778267654, + 0.6023696501284963, + 0.5771024041048751, + 0.5021590141644433, + 0.35740612745558714 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 19.585330739583632, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7094573825480928, + "wql": 0.43206061258105727 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8674577624007974, + "wql": 0.4740042669273654, + "wsql_by_level": [ + 0.18926504395160396, + 0.34498129215479895, + 0.46993805478944856, + 0.5597734648032514, + 0.6134788823871985, + 0.6312923007575955, + 0.600359043377069, + 0.5119437132170194, + 0.3450066069083032 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.709975950904795, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8842129976116617, + "wql": 0.38342919286792637 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0620382848595, + "wql": 0.41345093500744984, + "wsql_by_level": [ + 0.18698272967393723, + 0.33656534129481736, + 0.4361729948549481, + 0.4966748202280792, + 0.5210601067719259, + 0.5290422714235321, + 0.5021940079276892, + 0.4259627795890038, + 0.28640336330311533 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 16.17187104668911, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8753418003942216, + "wql": 0.4596526641244554 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5225986193539387, + "wql": 1.1816302244581431, + "wsql_by_level": [ + 0.2973848283786889, + 0.6056744770946575, + 0.8964186529661159, + 1.1830475933844844, + 1.4374364367489123, + 1.64056776750083, + 1.716491793924785, + 1.5967917434943122, + 1.260858726630503 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6801898802431829, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.9780235406353235, + "wql": 0.7321523340351378 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7030823113798942, + "wql": 0.26572561248657117, + "wsql_by_level": [ + 0.13496287617727667, + 0.21873242111243077, + 0.2783071620251478, + 0.31701035825539925, + 0.3367936825858046, + 0.3365574923231124, + 0.3154513997449248, + 0.26856518954930514, + 0.18514993060573906 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.203468085026249, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7011066000897126, + "wql": 0.3930292250082254 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9295640290671798, + "wql": 0.6148408305454957, + "wsql_by_level": [ + 0.20877248461580283, + 0.3855415467364631, + 0.5286570844692815, + 0.6460592046822092, + 0.7348787481786246, + 0.7958712882769783, + 0.8190853437178939, + 0.7819964231141621, + 0.6327053511180452 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 2.881907972200496, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8484256517724637, + "wql": 0.4214762537978245 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8681573987215155, + "wql": 0.42425503637653333, + "wsql_by_level": [ + 0.16814723025847414, + 0.29611686462849185, + 0.38794648248668345, + 0.458959076093231, + 0.5112972771940417, + 0.5478140100119171, + 0.5503854098402756, + 0.51149237606272, + 0.38613660081296575 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 12.484536270468922, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8723391468103351, + "wql": 0.574638475836685 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.39843206491288063, + "wql": 0.029741897287729073, + "wsql_by_level": [ + 0.01927464659823154, + 0.02664015947514437, + 0.03167519977510975, + 0.03465760521489175, + 0.03619044397958292, + 0.0363540489429397, + 0.034325774857102025, + 0.029440401708516167, + 0.019118795038043482 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.347259938532354, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6544094762009717, + "wql": 0.5185024123577127 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6282746890355818, + "wql": 0.05298724923197169, + "wsql_by_level": [ + 0.043122263778408144, + 0.056892528200694854, + 0.06309035089186378, + 0.06543536760493922, + 0.0644009251955582, + 0.060921435917475675, + 0.05387366796301584, + 0.04297382527248813, + 0.026174878263301362 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.9126064551719324, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.39452487302446176, + "wql": 0.3755345358256355 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6870522439194265, + "wql": 0.05917800803185099, + "wsql_by_level": [ + 0.04782383389053422, + 0.06380433078728953, + 0.0707806964272477, + 0.07318965942952169, + 0.07196255318197421, + 0.06763602547147414, + 0.05971596895579599, + 0.04772248672945454, + 0.02996651741336701 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.233345610877268, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.43183027790065925, + "wql": 0.40110005248034913 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7807644521623074, + "wql": 0.05146430710444669, + "wsql_by_level": [ + 0.04007522495826844, + 0.05299563489515206, + 0.05875789440385122, + 0.06109686559892436, + 0.06106360086662003, + 0.05915714677826561, + 0.05429564671241997, + 0.04543149607615815, + 0.03030525365036042 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.698745358193253, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3884115425616264, + "wql": 0.3765952398878465 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7461669637374918, + "wql": 0.05572468207558025, + "wsql_by_level": [ + 0.048889158548056644, + 0.06302899855069989, + 0.06723462803620661, + 0.06658704614749107, + 0.06336494746341365, + 0.059195795634158416, + 0.05436024838813639, + 0.046444614425948945, + 0.032416701486110686 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.5351815142214176, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6468546634112348, + "wql": 0.373708160862958 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7450367030780766, + "wql": 0.05458271228136556, + "wsql_by_level": [ + 0.046164059321466624, + 0.05871659035442098, + 0.06318054708738832, + 0.06387210164259789, + 0.06235404835323126, + 0.0594875684560015, + 0.05523349118151979, + 0.047904615043523495, + 0.03433138909214018 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.499734839651955, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.598493253188371, + "wql": 0.31143173482797853 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6151604136785813, + "wql": 0.028611524707859312, + "wsql_by_level": [ + 0.020578408362357522, + 0.029326481508056737, + 0.03383714415249792, + 0.035627378335875155, + 0.03544440975120415, + 0.033364795223423074, + 0.029573295868933123, + 0.023880230322666635, + 0.015871578845719513 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 1.989382228319859, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5189420831702738, + "wql": 0.30825641825607625 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5241334226792222, + "wql": 0.19932976140433226, + "wsql_by_level": [ + 0.10435847580089742, + 0.16887581802706195, + 0.2114940942603214, + 0.23839308021168298, + 0.2512097548234934, + 0.25014191375927886, + 0.23372252247194578, + 0.19885759171041523, + 0.13691460157389346 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.8116503164668987, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7228339302496115, + "wql": 0.6592686772016181 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.47402077025937467, + "wql": 0.1975113568433533, + "wsql_by_level": [ + 0.10324143336954061, + 0.1645792469397175, + 0.20650082698315003, + 0.2323976762376663, + 0.24479490871777332, + 0.2442930368345587, + 0.23120768968653638, + 0.2018911006146725, + 0.14869629220656416 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.7092119090072786, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7464833501587725, + "wql": 0.5043647742098251 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4977943736114562, + "wql": 0.21617268647139548, + "wsql_by_level": [ + 0.1166834306042856, + 0.18276944531535436, + 0.22683664294334824, + 0.25309715780640496, + 0.2632079730832687, + 0.26069726257899734, + 0.24824228751472938, + 0.223232531460653, + 0.17078744693551764 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.9231141432816132, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8181729824135264, + "wql": 0.4748723559131666 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.49025582839688453, + "wql": 0.13107332987935882, + "wsql_by_level": [ + 0.07214428872299, + 0.1104947522258713, + 0.13695779050335252, + 0.1541102068468303, + 0.16200539104499667, + 0.1613612708865861, + 0.15169270438528587, + 0.13199819899905144, + 0.09889536529926525 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7909929802286555, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8053956844869219, + "wql": 0.6346430618187836 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7219112434838776, + "wql": 0.1284487767149003, + "wsql_by_level": [ + 0.0926585176537443, + 0.12481237241411867, + 0.14301677803638127, + 0.15477473928562205, + 0.1579723819918881, + 0.151085552022108, + 0.1376075173258378, + 0.11529851946667949, + 0.07881261223772297 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 99.50011209183269, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8255454590007932, + "wql": 0.6766421237024971 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9206822650068828, + "wql": 0.15442889160943374, + "wsql_by_level": [ + 0.08868223735507959, + 0.13079262273276257, + 0.15644796559542573, + 0.17321308147588324, + 0.18538779700842475, + 0.19047283958956152, + 0.18467225031544793, + 0.16291678982659838, + 0.11727444058572012 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 108.81531772355238, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7858171019826556, + "wql": 0.44154549413057603 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.258938351535156, + "wql": 0.20855595409438127, + "wsql_by_level": [ + 0.1001915700509396, + 0.1591961407135934, + 0.2009910176405628, + 0.23202647137759977, + 0.2564556900384216, + 0.268876894266699, + 0.2645879566703742, + 0.23356625275374393, + 0.161111593337497 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 150.2998446704723, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1651244747687335, + "wql": 0.5429460303298423 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.129382031035162, + "wql": 0.10082283649820577, + "wsql_by_level": [ + 0.0670597289105118, + 0.10289963311346086, + 0.12419375374826715, + 0.13437575672206156, + 0.13572127839960718, + 0.1233004887915969, + 0.09871895205665294, + 0.07102796341869835, + 0.05010797332299511 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 79.54156551361083, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1207649425493624, + "wql": 0.5061088158088758 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7799389968254553, + "wql": 0.2857285017328503, + "wsql_by_level": [ + 0.14533477468625386, + 0.2378668347493294, + 0.3096867856719899, + 0.35636507266888623, + 0.37194476478906047, + 0.36889521680860343, + 0.3389112788482685, + 0.2749923714411645, + 0.16755941593209675 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.3593784104145707, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6469933265101947, + "wql": 0.5939759809562046 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.047056576069543, + "wql": 0.4258452404682478, + "wsql_by_level": [ + 0.2585036576410308, + 0.4472106230524128, + 0.5359835707817362, + 0.5666877562870003, + 0.5562160840857149, + 0.5079615254408704, + 0.4332198725862083, + 0.32980964744051483, + 0.1970144268987416 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.813770987835486, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.3517943321931667, + "wql": 0.9707435633023321 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3373689723504523, + "wql": 0.521830724197044, + "wsql_by_level": [ + 0.41499026762383123, + 0.5763275410305658, + 0.6669084799061792, + 0.6964718196914993, + 0.6669541471407057, + 0.591975467250105, + 0.49227083443766045, + 0.36938309738527053, + 0.22119486330757845 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.2865509271274305, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0077583388790115, + "wql": 0.9002047707381202 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7733006023752406, + "wql": 0.3582073351438122, + "wsql_by_level": [ + 0.22016635593888537, + 0.2934625318517846, + 0.35929617507711514, + 0.4162366584698189, + 0.44902490253141475, + 0.45698061372041293, + 0.43135837527408233, + 0.3611930234884622, + 0.23614737994233378 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.426423174129533, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7405954983316279, + "wql": 0.7101488609623355 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4795130483101546, + "wql": 0.46065733347454096, + "wsql_by_level": [ + 0.2943405433926075, + 0.4727356319366598, + 0.5530150857683416, + 0.577997701437005, + 0.5701417755429997, + 0.5364863032759524, + 0.4780299585760335, + 0.39372302793215674, + 0.26944597340911225 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.724342875858392, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2091602699478858, + "wql": 0.8376572778379159 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.474145246561255, + "wql": 0.4316073371000848, + "wsql_by_level": [ + 0.34685873769163045, + 0.49002569422822606, + 0.5579623726378146, + 0.5706511194721271, + 0.5449809802115173, + 0.487916201300064, + 0.4047006611016127, + 0.30255900952872666, + 0.1788112577290445 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 9.17620656706304, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0293856272703195, + "wql": 0.7463068509990778 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.639724182131458, + "wql": 0.33468708741320025, + "wsql_by_level": [ + 0.2294515192204954, + 0.3526858950377453, + 0.4118645998017466, + 0.4316179066137765, + 0.41851644869428084, + 0.3839485256114855, + 0.33315173132319365, + 0.26908936120412963, + 0.1818577992119489 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 132.84728037970407, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9018409056209052, + "wql": 0.6896737512549497 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.093391455496202, + "wql": 0.20178638209350303, + "wsql_by_level": [ + 0.09669036363229742, + 0.16642348790640532, + 0.2052612539984778, + 0.21224012303986742, + 0.2421604855547576, + 0.26922955448710767, + 0.26261026539691945, + 0.21563802421762693, + 0.14582388060806756 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 604.3692310878208, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8786405537742741, + "wql": 0.781682791852181 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2323800644663427, + "wql": 0.15538954298736396, + "wsql_by_level": [ + 0.06422503500060472, + 0.10876062616426375, + 0.14394440277768744, + 0.17098618509044763, + 0.19042839393054878, + 0.2011505008719572, + 0.2003201335456357, + 0.18427319620923027, + 0.13441741329590018 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 3.0386415058746934, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.6176679973182384, + "wql": 1.6543190020579623 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8794269212977479, + "wql": 0.10553800440306471, + "wsql_by_level": [ + 0.06129501695471498, + 0.09672741073259933, + 0.12032433533194926, + 0.13368897867807353, + 0.13807157728173655, + 0.13416776924759663, + 0.1193831333688168, + 0.09317131421481623, + 0.05301250381727902 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 2.1012143537579546, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9741978973204758, + "wql": 0.7732234495312453 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1487933391271135, + "wql": 0.1492851214648167, + "wsql_by_level": [ + 0.0851516633523193, + 0.13202656815325856, + 0.16480645693783477, + 0.1850726388796258, + 0.19446552167837333, + 0.19237447075415673, + 0.17314456210260756, + 0.1370321014962341, + 0.07949210982894028 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.93292700877184, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0872593199119582, + "wql": 0.8909387410645506 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6874395963530369, + "wql": 0.07484218341727408, + "wsql_by_level": [ + 0.053899297802511244, + 0.07682576505967638, + 0.09172631553844977, + 0.09678763456356292, + 0.09435425710305731, + 0.08536075735195853, + 0.07294824711944019, + 0.05825290657929466, + 0.0434244696375158 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.785062538725989, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6932892585500887, + "wql": 0.6272702794663155 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.514316181509705, + "wql": 0.24423487814303602, + "wsql_by_level": [ + 0.11147583084975031, + 0.18546260319528182, + 0.2429858259343568, + 0.2877860847581577, + 0.31726469134846913, + 0.3284754198497809, + 0.3102457344341433, + 0.25627364083130694, + 0.158144072086077 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 18.044807721549894, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9491304614347551, + "wql": 0.7062511853911224 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.206504911161808, + "wql": 0.35875079806118554, + "wsql_by_level": [ + 0.2975962956779686, + 0.3999883645971585, + 0.443344681528453, + 0.45633141061822935, + 0.44409889376526046, + 0.409295629848514, + 0.3512581683118758, + 0.2692196674298057, + 0.15762407077340454 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.059068889055208, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0109480980539933, + "wql": 0.9688198702005268 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.648982442879089, + "wql": 0.32905698095914104, + "wsql_by_level": [ + 0.34551268432253524, + 0.42173868659850466, + 0.433846169077764, + 0.4207671064177548, + 0.3884915064429743, + 0.34095596876538964, + 0.28187130833259255, + 0.20976065566606542, + 0.11856874300868925 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 525.3366441326482, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9882116281928103, + "wql": 1.0325788913138922 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6947853641822366, + "wql": 0.19677477186949888, + "wsql_by_level": [ + 0.15805938196597957, + 0.19967773821012996, + 0.22212226005453617, + 0.23383011164664944, + 0.23872100845992444, + 0.22670096405457496, + 0.20514872353845734, + 0.16883191266888944, + 0.11788084622634837 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2323.3558045795985, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9585559352832239, + "wql": 0.9310846845807819 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.43821626666295777, + "wql": 0.01995609336016065, + "wsql_by_level": [ + 0.008795973433755063, + 0.01393218291188017, + 0.017276016305085348, + 0.019748653476497447, + 0.02146826720492463, + 0.022469867136128484, + 0.024358130745748274, + 0.02648421271292552, + 0.025071536314500945 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.3830638962431943, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5749607653893869, + "wql": 0.1460123326014443 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8770640254885952, + "wql": 0.09021082459036094, + "wsql_by_level": [ + 0.05179478748248686, + 0.07601259691029201, + 0.090823147798576, + 0.0998582211353546, + 0.10406236082221827, + 0.10605346710663738, + 0.10462152580873224, + 0.09833135626199317, + 0.08033995798695794 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.598502742824383, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8969362504256315, + "wql": 0.3958279754817908 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7382885995831482, + "wql": 0.08702823620531183, + "wsql_by_level": [ + 0.05944129784873297, + 0.07986409296798884, + 0.09104713318692952, + 0.09715120546855284, + 0.09894788933482986, + 0.09848330112384053, + 0.0955957983164704, + 0.08866672005537683, + 0.07405668754508475 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.915551011477906, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8152909386681478, + "wql": 0.35830195113538493 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5578282976557462, + "wql": 0.07866713337975041, + "wsql_by_level": [ + 0.05888216649821955, + 0.08423976012647469, + 0.0930117246252417, + 0.09231764646199705, + 0.08748330993301891, + 0.08526979561167633, + 0.08108709309910084, + 0.07178037200476188, + 0.053932332057262805 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 14.618307799432568, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.734779817521128, + "wql": 0.42866421970371527 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8947740346727263, + "wql": 0.12011147890348514, + "wsql_by_level": [ + 0.08649960380898337, + 0.11999336133364329, + 0.1333509097149081, + 0.13568922701603015, + 0.1314659836488192, + 0.13244033249326423, + 0.12903497918241277, + 0.11814028155708166, + 0.09438863137622357 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 22.64437806426593, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8356664297080948, + "wql": 0.3298868859184274 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0990074860926782, + "wql": 0.15288515274472478, + "wsql_by_level": [ + 0.1393628498297751, + 0.17711804379501986, + 0.1869868081007852, + 0.1823095957400237, + 0.16898353136997699, + 0.1577509336304096, + 0.14368011137030723, + 0.12436979364811852, + 0.09540470721810682 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 29.454686312342975, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7363250592481067, + "wql": 0.34443036015903333 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.562383190566658, + "wql": 0.12008815008129445, + "wsql_by_level": [ + 0.04477906424703502, + 0.10489090458592074, + 0.1419917244123252, + 0.15899396051206036, + 0.16025089152392236, + 0.15181181017736106, + 0.1355262308069433, + 0.10940444721607849, + 0.07314431725000343 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 27.932542781449673, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8409645142709459, + "wql": 0.5190016895855579 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1047465350801886, + "wql": 0.48232676165281213, + "wsql_by_level": [ + 0.1624418580816693, + 0.29373986056586937, + 0.4089189573825129, + 0.5055441449815357, + 0.591338647583732, + 0.6555502982881505, + 0.6623812755775781, + 0.6032766413183643, + 0.4577491710958969 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 173.71823908102388, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5600250861605033, + "wql": 0.25408896224511934 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.164013663969581, + "wql": 0.6519567384226423, + "wsql_by_level": [ + 0.5174602454874601, + 0.7739204814516396, + 0.867197348791438, + 0.8651888147961467, + 0.8081724383389811, + 0.7080835241396143, + 0.5861955040258495, + 0.45030616149370417, + 0.2910861272789471 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 502.32395035783065, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8736836189468721, + "wql": 0.8184592868713972 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2898665957880562, + "wql": 0.5071356884090343, + "wsql_by_level": [ + 0.3731816904479196, + 0.5553721115971786, + 0.6395737812980017, + 0.6626179527262579, + 0.6421026241856899, + 0.5855621087867495, + 0.4951948150851418, + 0.3738038952528525, + 0.23681221630151772 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 468.7452791574954, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8559997222439686, + "wql": 0.7266539387092644 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.384262104962712, + "wql": 0.4835174229907694, + "wsql_by_level": [ + 0.30035826400106314, + 0.5189816965633876, + 0.6116686046829601, + 0.633421499626848, + 0.6022177667108396, + 0.542503855654806, + 0.48059547497286076, + 0.39538309797182275, + 0.26652654673233694 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 425.1687694121724, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8889531995205431, + "wql": 0.7759593071077145 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5737147353776557, + "wql": 0.23900036231375937, + "wsql_by_level": [ + 0.1352500614585769, + 0.2005517086425726, + 0.24294536792264132, + 0.265696925750706, + 0.2698457538685932, + 0.26232478980193913, + 0.26893343316096985, + 0.27537963131508325, + 0.2300755889027515 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 144.60402672295294, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6854660897041469, + "wql": 0.26686474853568326 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8505390249430631, + "wql": 0.7619360290351516, + "wsql_by_level": [ + 0.16648151399414982, + 0.3797951119186315, + 0.6257844274493072, + 0.8260493099916718, + 0.9605394682072759, + 1.0322802830431075, + 1.0405547633041838, + 0.9837164928505517, + 0.8422228905574854 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 288.46778117323703, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8732366181195118, + "wql": 0.6898512690741088 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.005058761805067, + "wql": 0.7497208813719758, + "wsql_by_level": [ + 0.27867506989282087, + 0.4537247354240876, + 0.6004390905737294, + 0.7336218935790082, + 0.847570830958483, + 0.939854039537792, + 1.0058767383036127, + 1.016805569773821, + 0.8709199643044271 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 277.26052600205566, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.861965498201495, + "wql": 0.7514088598490619 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9362464183368933, + "wql": 0.6519130490762466, + "wsql_by_level": [ + 0.2300323883128951, + 0.4011177789623707, + 0.5586726962725646, + 0.6988661762697514, + 0.7995518510831429, + 0.8607503613562668, + 0.8701331089908327, + 0.8096289892103411, + 0.6384640912280546 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 259.00431372718344, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8377783643092834, + "wql": 0.6998808349423442 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5233846359081933, + "wql": 0.009321299365712054, + "wsql_by_level": [ + 0.005598957837687743, + 0.008976625604911114, + 0.01114896564963383, + 0.012258816858024262, + 0.012505632311265145, + 0.011833480936080871, + 0.01008706280415258, + 0.007417685890804967, + 0.004064466398847973 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 323.5882390340169, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.37557187863308333, + "wql": 0.5064664982421465 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6413776935174512, + "wql": 0.008772131096159994, + "wsql_by_level": [ + 0.005140964549012094, + 0.007912519144607128, + 0.009737045174917585, + 0.010797370317180493, + 0.011318639192144474, + 0.011030022804175237, + 0.010006723607309207, + 0.008041958898908788, + 0.004963936177184941 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 270.96943983078, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6984146744149097, + "wql": 0.6383227273421839 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7463530442541847, + "wql": 0.010171490762070513, + "wsql_by_level": [ + 0.006174416745284783, + 0.00965036689328787, + 0.011688644007834995, + 0.012683129337968096, + 0.012986321014603666, + 0.01251926074168216, + 0.011247202188593668, + 0.009008088929887602, + 0.005585986999491768 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 316.41651678297256, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9968307746214968, + "wql": 0.7858875293763924 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.48651092670202795, + "wql": 0.008403688618281007, + "wsql_by_level": [ + 0.005323472735860441, + 0.008328533815010735, + 0.010218573279559084, + 0.011137251371732099, + 0.011209790060047277, + 0.010563381621180855, + 0.009055149878679516, + 0.0065045720454271864, + 0.0032924727570318706 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 15.030964174772066, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4607510295889282, + "wql": 0.3293621947271024 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6643073465113329, + "wql": 0.009724804930459323, + "wsql_by_level": [ + 0.0059722690078712224, + 0.008959723336772377, + 0.010814892690102024, + 0.011885023747669433, + 0.012322754046010735, + 0.012102402881982369, + 0.01104078080143293, + 0.00891379810752057, + 0.0055115997547722445 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.542835080767908, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6958545095406433, + "wql": 0.41358526827458236 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7680640777922695, + "wql": 0.011289394257208167, + "wsql_by_level": [ + 0.007040733583912498, + 0.01077081764815792, + 0.013046244181527882, + 0.014210493037385596, + 0.014463136262749603, + 0.013840326425163592, + 0.01233560040308271, + 0.00980413679766513, + 0.006093059975228575 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 18.481503481626234, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9234943238593577, + "wql": 0.47676849966355 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.21756741091216217, + "wql": 0.06847285449435767, + "wsql_by_level": [ + 0.04536804007244314, + 0.06844782867836974, + 0.08145768178306544, + 0.08717193869193787, + 0.08689170381771187, + 0.08181079154181299, + 0.0738669777915417, + 0.05781465620548653, + 0.03342607186684973 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.2321832279364267, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.28177157182563844, + "wql": 0.3099095852620953 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4358905817109546, + "wql": 0.14952799373664466, + "wsql_by_level": [ + 0.11604991434538357, + 0.15296723023854028, + 0.1701316334956928, + 0.17434298677967175, + 0.1745594611781413, + 0.1721531700095461, + 0.16120185018698227, + 0.13584482549324375, + 0.08850087190260005 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.8849299068252248, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3023464226522938, + "wql": 0.3175286362891368 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6346844925692327, + "wql": 0.2556860094165639, + "wsql_by_level": [ + 0.1386396763268226, + 0.2128133032990673, + 0.257600074524067, + 0.2933105314693118, + 0.3267141038468081, + 0.336150644245752, + 0.31709816810514574, + 0.26026706065444616, + 0.15858052227765468 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 5.976779465888749, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3773326926322338, + "wql": 0.37847490371869186 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.626219009818357, + "wql": 0.20269551409362288, + "wsql_by_level": [ + 0.13331085189640915, + 0.21039063395629262, + 0.2558152495728706, + 0.2767517874084666, + 0.281207533082048, + 0.26046257329785505, + 0.20804658375826096, + 0.12722126617122118, + 0.07105314769918177 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.8834941520278035, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.39519474455549364, + "wql": 0.3636600856437747 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.35695455093149087, + "wql": 0.21396143543572863, + "wsql_by_level": [ + 0.1146877979251115, + 0.17591867574796263, + 0.21688015876318545, + 0.24235108225423518, + 0.2568873699914479, + 0.2658975998655034, + 0.2594908805081909, + 0.22924924521200715, + 0.16429010865391347 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.5159543594370515, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.2208927228410952, + "wql": 0.1915859047737092 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.400153560450357, + "wql": 0.2033782198361516, + "wsql_by_level": [ + 0.1039409166161419, + 0.16665054524964137, + 0.20478284145017892, + 0.2295215173544499, + 0.24507885164785984, + 0.25331425611624514, + 0.24538259980463964, + 0.21997593966805842, + 0.16175651061814908 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.7028527264898723, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.31256527494403635, + "wql": 0.20068802450416431 + } + } + ] +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S027/provenance/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S028/provenance/member0/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S028/provenance/member0/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S028/provenance/member0/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S028/provenance/member1/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S028/provenance/member1/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S028/provenance/member1/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/long_memory_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/long_memory_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/long_memory_synth/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S040/provenance/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/README.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/README.md new file mode 100644 index 0000000000000000000000000000000000000000..97aa7b31e461d027266b49d847de0b22f2a3cf4f --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/README.md @@ -0,0 +1,21 @@ +# Direct seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included; package versions are pinned in requirements.txt. This 36,665,488-parameter model was trained from random initialization here. The complete checkpoint lineage and all training sources are in model_manifest.json. The trainer and generator code are archived in provenance/. + +A patch encoder/decoder predicts nine monotone quantiles directly. Inference averages the original and sign-reversed forecasts, applies a fixed seasonal-confidence rule, and adds a decaying continuity correction on smooth histories. Every operation uses the supplied instance alone, with globally fixed parameters and no inference-time fitting. Per-instance normalization needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and checkpoint hashes. validation_report.json contains the most recent package evaluation. Validation and earlier-window diagnostic scores are not the held-out reward scale. + +The seasonal template averages four cycles, then aligns its mean and noise-corrected amplitude to the latest cycle. The amplitude ratio is clipped to [0.5,2] and requires at least 75% observed points in the latest cycle. These are fixed formulas using only the supplied context. + +Future queries receive additional learned projections of recent seasonal level and amplitude changes. These features are computed from the instance context and were trained jointly with the backbone on the declared pretraining corpus. + +Future queries receive a 3,072-parameter projection of six fixed context statistics describing local and seasonal differences. These features were introduced in a frozen-backbone stage using the loss of forecasts averaged across both sign orientations. + +The final continuation trained all model parameters. Its sign-loss mode is paired. Training settings and the complete earlier frozen-stage lineage are recorded in the manifest and provenance. + +During training, rows with shorter available futures used their own horizon metadata and masked unused future tokens. Inference uses the full requested horizon and the ordinary decoder, without additional inputs. + +For nonnegative histories with at least four exact zeros and at least 10% zeros among observed points, nonnegative forecast quantiles below 0.4 context standard deviations are set to zero. This fixed monotone transformation represents the observed mass at zero without fitting parameters. + +The original trend summary uses a fixed 128-point averaging width, matching the formula used at every pretraining context length and avoiding dependence on batch padding for short histories. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a827e1f9219769057476393035335cf192b9339c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/provenance/recovery/train.py @@ -0,0 +1,141 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +a=ap.parse_args();sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='overflow_control':a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':[a.initialize_ema] if a.initialize_ema else []} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=0 and step>a.reset_at else step + lr=a.lr*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/a.steps))) + for group in opt.param_groups:group['lr']=lr*group['lr_multiplier'] + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16): + loss=objective(model,x,y,p,paired=a.loss_mode=='paired') if a.loss_mode else objective(model,x,y,p) + loss.backward() + if protector is not None:protector.clear_gradients() + norm=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(norm): + opt.step() + if protector is not None:protector.restore() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.monotonic()-started,1), + 'lr':lr,'grad_norm':float(norm),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with (out/'log.jsonl').open('a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=(a.stop_file and Path(a.stop_file).exists()) or (a.halt_after and step>=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..01d1592662ccd40a16068eca7765244dbff86b55 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S041/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.37716027057251356, + "skill_score": 0.37716027057251356, + "rel_mase_gmean": 0.7443405318513796, + "rel_wql_gmean": 0.5211718453493559, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.7412966841031887, + "rel_wql_gmean": 0.48933427696860005 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7090294408716359, + "rel_wql_gmean": 0.5013271206195345 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.7594695136438658, + "rel_wql_gmean": 0.5418395406811283 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.9117152311358985, + "rel_wql_gmean": 0.8638532208093681 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.8987216585910973, + "rel_wql_gmean": 0.6458622444242118 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.5488674708372087, + "rel_wql_gmean": 0.49437492736275407 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.806532801532614, + "rel_wql_gmean": 0.39064376427620917 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8157816231127697, + "rel_wql_gmean": 0.4999950866338547 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.6529351207459906, + "rel_wql_gmean": 0.4465174884811702 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.57020863667703, + "rel_wql_gmean": 0.45256397767435136 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6771210363556877, + "rel_wql_gmean": 0.7276653178579969 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7690542048435778, + "rel_wql_gmean": 0.5282743903923657 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7411027236557811, + "rel_wql_gmean": 0.50136223367206 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 0.9561440657910818, + "rel_wql_gmean": 0.7694404843102686 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.8018642427824096, + "rel_wql_gmean": 0.837826579641692 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.659593636917999, + "rel_wql_gmean": 0.503949676825062 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.6895801374564625, + "rel_wql_gmean": 0.46437192943385286 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.8901439626158602, + "rel_wql_gmean": 0.6613204326663706 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.71461776434421, + "rel_wql_gmean": 0.5168167256418504 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.7688903480734678, + "rel_wql_gmean": 0.5246660434628768 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2033264540418247, + "wql": 0.1135328944347765, + "wsql_by_level": [ + 0.06426389373006781, + 0.09868259778824365, + 0.12062165201709948, + 0.13322067337998236, + 0.13842911745734574, + 0.13832806045712562, + 0.13080318376736982, + 0.1139472107086057, + 0.08349966060714839 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 718.5728339383168, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6771210363556877, + "wql": 0.7276653178579969 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.275693307740972, + "wql": 0.08344675946737076, + "wsql_by_level": [ + 0.04894314663504284, + 0.07387369150032305, + 0.08934648640600149, + 0.09841687044406412, + 0.10255003507437727, + 0.10157059008322766, + 0.0954201380133026, + 0.08219762136926353, + 0.058702255680734325 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 583.9496641321733, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8018642427824096, + "wql": 0.837826579641692 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.004850333390829, + "wql": 0.0937115509734501, + "wsql_by_level": [ + 0.05525939469488269, + 0.08307790119363351, + 0.10052782579152043, + 0.11080164060873456, + 0.1155363676760694, + 0.11443764073837098, + 0.10683294085418614, + 0.09160443982907335, + 0.06532580737457981 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 547.8372954036731, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8125458283941407, + "wql": 0.7954383071041067 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.4205661174224087, + "wql": 0.05156171920918646, + "wsql_by_level": [ + 0.02658564441829903, + 0.04125059476888612, + 0.05190875862806888, + 0.05935463124706973, + 0.06391962927553414, + 0.06614293995824581, + 0.06297746557886368, + 0.054278822904773455, + 0.03763698610293732 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 332.69249101268895, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1814902202205328, + "wql": 0.7921950336747792 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.3784276525722805, + "wql": 0.022510728022087693, + "wsql_by_level": [ + 0.013838411575504327, + 0.020219127364159276, + 0.024171202140632564, + 0.026469395325230596, + 0.027447985574490626, + 0.0272853949061746, + 0.025612822729574814, + 0.021977120181968436, + 0.01557509240105401 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 175.86605702986515, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0504680876829242, + "wql": 0.9744221973985376 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2884078287042036, + "wql": 0.03827117177770995, + "wsql_by_level": [ + 0.019463691018214626, + 0.03258360287616935, + 0.041694786657359616, + 0.04683664987819402, + 0.049053570880581654, + 0.048420186047136826, + 0.0447243088818462, + 0.0369990155453711, + 0.024664734214516173 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 369.52057857143177, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.04888348569087, + "wql": 1.1101154441760313 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9770883665361205, + "wql": 0.04743771839276581, + "wsql_by_level": [ + 0.029943727056732927, + 0.045542802031989016, + 0.055144731923433984, + 0.06015348578892929, + 0.061392991756160954, + 0.057955696895464766, + 0.05060093195692221, + 0.039710077981486985, + 0.02649502014377218 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 62.3600904417082, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8950299136425153, + "wql": 0.765264755032686 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9606313101136407, + "wql": 0.08941366355302703, + "wsql_by_level": [ + 0.04163996299113001, + 0.06679644887130036, + 0.08502061776162896, + 0.09923441646511681, + 0.10951369294231705, + 0.11394112214656264, + 0.11165293932767434, + 0.1006632232700476, + 0.07626054820146554 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 78.76457489557527, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.6361823330531232, + "wql": 0.7417597500912165 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8828200067299101, + "wql": 0.08595470665957082, + "wsql_by_level": [ + 0.04038838398508243, + 0.06477699986136067, + 0.08187168598309687, + 0.09417653453902237, + 0.10346765258730195, + 0.10786023049962075, + 0.10689856857783785, + 0.09772051809532478, + 0.07643178580748962 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 74.60498537731306, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8068857918449808, + "wql": 0.7991004067000335 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0413683886357248, + "wql": 0.07541221720045235, + "wsql_by_level": [ + 0.04880828915471614, + 0.0696051948136677, + 0.08338591867569844, + 0.09098737948176928, + 0.09394756557745434, + 0.0921849875291971, + 0.08503933005306817, + 0.07028169601946753, + 0.044469593499032484 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 285.3216246413042, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0559839292420372, + "wql": 1.115050856309809 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9766051425687927, + "wql": 0.07886458952406662, + "wsql_by_level": [ + 0.042931157806716636, + 0.06471437764642265, + 0.07834733736076058, + 0.08771486972249798, + 0.09509223186983945, + 0.09799639191575013, + 0.09508661452329628, + 0.08475680833718047, + 0.06314151653413536 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 255.9089792206943, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.7826350753444743, + "wql": 0.6405946635218773 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1951934857643987, + "wql": 0.09162762846083705, + "wsql_by_level": [ + 0.04303640702223726, + 0.06872749437986503, + 0.08707046663719194, + 0.10010036839344263, + 0.10853622688100914, + 0.11243750918433888, + 0.11172999193661041, + 0.10537963738581364, + 0.0876305543270245 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 297.4757637452095, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8809565676710023, + "wql": 0.6243839526428129 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5090790150936144, + "wql": 0.06807266356571222, + "wsql_by_level": [ + 0.03025096397527463, + 0.04770965588768651, + 0.06366071218754481, + 0.07643838179045472, + 0.08544003678675355, + 0.08818733003894903, + 0.085631249501862, + 0.07698429426275454, + 0.058351347660130115 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 5620.171092595511, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.9170016511970667, + "wql": 0.735016559904152 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.5012335445751455, + "wql": 0.06843145105063908, + "wsql_by_level": [ + 0.026890423439349692, + 0.04530900342862985, + 0.06558241407956021, + 0.07809616317228252, + 0.08814644905415218, + 0.09084546057021105, + 0.08644782214750618, + 0.07689951695827894, + 0.05766580660578107 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 37959.21227665516, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.1399919189313148, + "wql": 1.048930208282544 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.018909347978530056, + "wql": 0.45810970980768384, + "wsql_by_level": [ + 0.21136405146285525, + 0.36399409171149577, + 0.47383866608983327, + 0.5202204934827864, + 0.5479908672352656, + 0.5356013148375856, + 0.5339652816020821, + 0.5061181421903151, + 0.42989447965693556 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.05295745061807915, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1804792961039932, + "wql": 0.037802311922232 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7084622399339423, + "wql": 0.2886694048205594, + "wsql_by_level": [ + 0.22746352922531196, + 0.32194809903541566, + 0.3542905426331278, + 0.3553387666976369, + 0.34262222120174024, + 0.32137299845935907, + 0.28751631429794755, + 0.23335232782001933, + 0.15411984401447557 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.6371170697948463, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8503493177706266, + "wql": 0.5108802354544857 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7031277094962659, + "wql": 0.22385227122770607, + "wsql_by_level": [ + 0.16871011848987955, + 0.26117994693402236, + 0.2971797186450409, + 0.29970027358764867, + 0.2808167706706276, + 0.24674109658399945, + 0.20213597641192527, + 0.15239625213374774, + 0.10581028759246298 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.6500016525917252, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.32823988637789564, + "wql": 0.24783568781672147 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8136229813130579, + "wql": 0.3113986589019829, + "wsql_by_level": [ + 0.18970587056173926, + 0.3099764796232736, + 0.376898121476186, + 0.39786746390691263, + 0.38614032849151925, + 0.3587898987618613, + 0.3210417271008561, + 0.2718417837267123, + 0.19032625646878606 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 10.650423774589193, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7697967877998138, + "wql": 0.5170181403432424 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.216902282513737, + "wql": 0.4457332346438297, + "wsql_by_level": [ + 0.43677191614139704, + 0.556113060731004, + 0.5858735817996937, + 0.571235937212255, + 0.5297319877261116, + 0.4681573571319095, + 0.3888351990950606, + 0.2944047863831946, + 0.18047528557384176 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 15.874494026647653, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8829202020600871, + "wql": 0.4604765548187146 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.039673332670983, + "wql": 0.3526636748207873, + "wsql_by_level": [ + 0.412412985419423, + 0.45594244684436525, + 0.4584695775205679, + 0.4390702943988933, + 0.40526173242724156, + 0.35796240675508, + 0.29659501159286455, + 0.22018301234193807, + 0.12807560608671253 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.661761869852063, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9695369547932411, + "wql": 0.39063830217089046 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1424398063007983, + "wql": 0.2883658092251261, + "wsql_by_level": [ + 0.24400175998921195, + 0.35154421576811146, + 0.38563686775202394, + 0.3838565072837317, + 0.3573607849100028, + 0.31537809094898206, + 0.2584997079501715, + 0.18983248049203136, + 0.10918186793186856 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 289.1273993095342, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9789053835301996, + "wql": 0.6116944934012483 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0331131013238135, + "wql": 0.12080445690843002, + "wsql_by_level": [ + 0.057131452039783495, + 0.11376059064161619, + 0.14613781813557994, + 0.15572434256680062, + 0.15444842939155007, + 0.14559619103360058, + 0.13025977057257573, + 0.10841759378561296, + 0.07576392400875041 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 948.4272699286468, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0250583634845583, + "wql": 0.8696629641523661 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8010934042128337, + "wql": 0.05520210562596855, + "wsql_by_level": [ + 0.031017548306947775, + 0.04762598346184335, + 0.05854773948231418, + 0.0656634164801724, + 0.06915407623081934, + 0.06848586409682378, + 0.06375205336207801, + 0.054278743724684234, + 0.03829352548803389 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 19.20002367894373, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8589129225653195, + "wql": 0.8707903544060122 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 41.44762433815979, + "wql": 0.08740015253968339, + "wsql_by_level": [ + 0.07359955131718227, + 0.10377724188728463, + 0.11600706543317046, + 0.10440369554240272, + 0.08291091020044569, + 0.06858280766259722, + 0.06566405842803728, + 0.08429363041701132, + 0.08736241196901881 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 168.43827261817933, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8198441743923235, + "wql": 0.6964671216119734 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5037851157749544, + "wql": 0.026401198536074706, + "wsql_by_level": [ + 0.009821556936075726, + 0.015852891346912906, + 0.022105580926718143, + 0.026168389550242886, + 0.03269419687458031, + 0.03718119906432307, + 0.03816929080258904, + 0.03344226600706876, + 0.02217541531616151 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 332.7037760416667, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.2163926998644987, + "wql": 0.2022047771654872 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.28287901277845856, + "wql": 0.0071396321781961826, + "wsql_by_level": [ + 0.003769608180161259, + 0.004757016910027146, + 0.00653900273525038, + 0.00786684116806659, + 0.008452284361450171, + 0.008554197589985331, + 0.008926452053216337, + 0.008733087849212949, + 0.006658198756395478 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 2653.3932291666665, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9357211340660633, + "wql": 0.6431056535731252 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3479673698578511, + "wql": 0.015808187212746128, + "wsql_by_level": [ + 0.008388770052577366, + 0.01553302846638426, + 0.01897055052064867, + 0.01998417764058858, + 0.019718967234504465, + 0.018972805831735627, + 0.017208740357035436, + 0.01428083984319208, + 0.009215804968048621 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 1466.9013671875, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.34935580773123753, + "wql": 0.37445032923548693 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2819741599575183, + "wql": 0.3266936153492705, + "wsql_by_level": [ + 0.14670114002830686, + 0.2660005771428177, + 0.36232627355358227, + 0.4311021446488804, + 0.46446988689921015, + 0.440769839097104, + 0.35202074678758155, + 0.23126444466753462, + 0.2455874853184168 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 14.429531256357828, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8418629486910748, + "wql": 0.6029072456631818 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4634304782035827, + "wql": 0.23430938132867107, + "wsql_by_level": [ + 0.11545515800238537, + 0.19004278321881218, + 0.24322922094334024, + 0.2690049259972359, + 0.27623738914858403, + 0.26386691612392643, + 0.25873167829348365, + 0.2694022725455549, + 0.22281408768471672 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 8.033607323964437, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.3946943427323482, + "wql": 0.8960158386753307 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7273388794367074, + "wql": 0.23926314378248895, + "wsql_by_level": [ + 0.10441158203246122, + 0.18178324439352234, + 0.2558609969765578, + 0.3177593186198489, + 0.3564758579186573, + 0.35270809582401225, + 0.27441025161708166, + 0.13948281536563997, + 0.17047613129461883 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.717107772827148, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2792401043252701, + "wql": 0.39916496925608375 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.12790753824887, + "wql": 0.5320298658490041, + "wsql_by_level": [ + 0.18091327265935436, + 0.3410640575017136, + 0.47830863369594995, + 0.5888228464750412, + 0.6672465560791485, + 0.7101195466243863, + 0.7090762404340352, + 0.6419172897978412, + 0.4708003493735663 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.703801058888928, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6465395675670603, + "wql": 0.48402293877597674 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.538662112256068, + "wql": 0.381165497483196, + "wsql_by_level": [ + 0.14938180658580202, + 0.25395078821047384, + 0.3439861296160931, + 0.42033133237895504, + 0.475481075145538, + 0.49996308804051975, + 0.49517454384324866, + 0.45592958749660956, + 0.33629112603152433 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.221043688159597, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7908443887120371, + "wql": 0.6082931237361382 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9264859475746198, + "wql": 0.46032575111478224, + "wsql_by_level": [ + 0.18269241999300165, + 0.33258404133432967, + 0.45338961320783955, + 0.5438544952779172, + 0.5991797679603634, + 0.6118700229420616, + 0.5783479458176305, + 0.49475561377934907, + 0.34625783972054747 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 20.082310644479026, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.72486759265599, + "wql": 0.4384476792998408 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8772714747425512, + "wql": 0.47520846140174977, + "wsql_by_level": [ + 0.18423147304879037, + 0.33063018877444894, + 0.4526225771059952, + 0.5466155397230286, + 0.6090003018559282, + 0.6339732434676516, + 0.6163821310655084, + 0.5401420660294592, + 0.36327863154493806 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.573387493763132, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8942162650714915, + "wql": 0.38440328392065515 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0372162626066146, + "wql": 0.39672068973681157, + "wsql_by_level": [ + 0.17079083748469673, + 0.29405700780010735, + 0.38481205526460655, + 0.4495290548688771, + 0.491831412215111, + 0.5119846309906773, + 0.5044148835750477, + 0.4513531023778095, + 0.31171322305437066 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 15.264715282713544, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8548832595317887, + "wql": 0.441052871116451 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3659358818525207, + "wql": 1.0905288999957938, + "wsql_by_level": [ + 0.26851615185502326, + 0.5325511248494781, + 0.7973219466520467, + 1.0498675729102267, + 1.2786268597319561, + 1.4612615522411352, + 1.5719245172331704, + 1.5547013221698678, + 1.2999890523192408 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6050417454032542, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.8773930505841946, + "wql": 0.675704854986108 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7002385948897378, + "wql": 0.2650662522815058, + "wsql_by_level": [ + 0.13505134082525144, + 0.219023781284785, + 0.27820132675717674, + 0.31672064346192086, + 0.3359937953255734, + 0.335967113305972, + 0.3141065386123528, + 0.26691887729809344, + 0.18361285366242702 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.186359799899116, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6982708746451063, + "wql": 0.3920539790469006 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9626822165029849, + "wql": 0.6356943502249746, + "wsql_by_level": [ + 0.19893729886845268, + 0.3744826759610858, + 0.5284692883767528, + 0.6614842526898153, + 0.7678380600278315, + 0.8420682750716476, + 0.8790600710245638, + 0.8339471212404603, + 0.6349621087641611 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 3.0111615447277886, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.878653069015515, + "wql": 0.4357714386917881 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8187913233131826, + "wql": 0.39969948056244686, + "wsql_by_level": [ + 0.14629849732310032, + 0.25972198894070436, + 0.35133519520831985, + 0.4244228673446722, + 0.4811259127852715, + 0.5195143248709061, + 0.5320382807849545, + 0.5016185038767254, + 0.3812197539273674 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 11.747830815360707, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8227352844617591, + "wql": 0.5413788419927489 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4114341140436771, + "wql": 0.029987228449723142, + "wsql_by_level": [ + 0.019379421460773563, + 0.027882501811208524, + 0.033224474909749446, + 0.03624648494913002, + 0.037416450952374045, + 0.036497926601555264, + 0.03338548117073978, + 0.027654989730750052, + 0.01819732446122762 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.426776980467994, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.675764846188787, + "wql": 0.5227793688036932 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6169365101624977, + "wql": 0.05133430951198926, + "wsql_by_level": [ + 0.04005147337137389, + 0.054125265259696416, + 0.06127582039243993, + 0.06399170753357077, + 0.06333027030560077, + 0.059334132860900994, + 0.05212790867128963, + 0.041405184760424936, + 0.02636702245260597 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.8475600102491545, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3874050675344482, + "wql": 0.36381971840279 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6818465761613522, + "wql": 0.057816326523405785, + "wsql_by_level": [ + 0.04492467240212091, + 0.06181528415232141, + 0.0701053910960503, + 0.07293268747416554, + 0.07148006874859876, + 0.06640413949037609, + 0.05794154416129958, + 0.045741373952333304, + 0.029001777233386112 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.204962468978708, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4285583797669689, + "wql": 0.3918707704773975 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7033498408575698, + "wql": 0.04515412701236756, + "wsql_by_level": [ + 0.03590654782741304, + 0.04834582408796912, + 0.053881801914950234, + 0.05594902227125852, + 0.054967376112804125, + 0.05215156712150193, + 0.04632941840774344, + 0.036379275130401595, + 0.022476310237266046 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.329484739908862, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.349899634763561, + "wql": 0.3304198628310994 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7387716124768441, + "wql": 0.0524451485563632, + "wsql_by_level": [ + 0.04405680406540707, + 0.05797621527211349, + 0.06366858854268037, + 0.06470145897499534, + 0.06284383146771755, + 0.05819547548784361, + 0.05129009400848377, + 0.041763362200117504, + 0.027510506987910105 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.5061080326121474, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.640443608402108, + "wql": 0.351714523675531 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7245618649714142, + "wql": 0.051317645706917686, + "wsql_by_level": [ + 0.04359923257167752, + 0.05623894342148041, + 0.06131135377978798, + 0.062278918125871954, + 0.06066092927842049, + 0.056795000514700614, + 0.050764317735181516, + 0.04195532291186474, + 0.02825479302327387 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.4047054394720795, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5820456709198267, + "wql": 0.2928022951187998 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6215001351590693, + "wql": 0.029115304969126295, + "wsql_by_level": [ + 0.020854904097278356, + 0.02981456368136593, + 0.034423609792806856, + 0.03625880668869928, + 0.0358639492464713, + 0.033608128123243174, + 0.02999234219436812, + 0.024729248531193324, + 0.01649219236671031 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 2.012929648683782, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5242901975785633, + "wql": 0.3136840737379812 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5223998660000764, + "wql": 0.19716158095093578, + "wsql_by_level": [ + 0.10280430841850345, + 0.1671587555337692, + 0.21084580357913188, + 0.23827984234352334, + 0.25053436939877216, + 0.24787932976787203, + 0.23042572449628412, + 0.19399287693259062, + 0.13253321808797497 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.8040911050641055, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7204431771827834, + "wql": 0.652097578167663 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4675857062492349, + "wql": 0.1956958557505576, + "wsql_by_level": [ + 0.10260504382165993, + 0.16261371451036105, + 0.20289553055346018, + 0.2285931182577571, + 0.24155117644531807, + 0.24201522160898334, + 0.22946436965733022, + 0.2018040220637111, + 0.14972050483643723 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.673312640725115, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7363494732441664, + "wql": 0.49972871270237557 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5088887504566991, + "wql": 0.22268019434994946, + "wsql_by_level": [ + 0.12031135689984168, + 0.18755459546643435, + 0.2307511714253132, + 0.2567422573756105, + 0.2683899536641056, + 0.2682399413430629, + 0.25749048110192874, + 0.2342694806644844, + 0.18037251120876355 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.980663770477986, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8364076589640833, + "wql": 0.4891675735368849 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.48136488655900717, + "wql": 0.13196206611895278, + "wsql_by_level": [ + 0.07094872818223241, + 0.1100422195717854, + 0.13584607122989237, + 0.15177995330524657, + 0.15954061041066184, + 0.15956411925068106, + 0.15226853943398505, + 0.13849210186665592, + 0.10917625181943459 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7637444745744757, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7907895834015642, + "wql": 0.6389462277547094 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7298968937867004, + "wql": 0.13172785725782113, + "wsql_by_level": [ + 0.0939927212797308, + 0.12769905300681264, + 0.14721930943821077, + 0.1585589223640121, + 0.16229711096695754, + 0.15626273697935125, + 0.14216951111754392, + 0.11854366642871401, + 0.07880768373905728 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 102.22407568825616, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8346774920646486, + "wql": 0.6939156554487602 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8093919543217607, + "wql": 0.144494373809385, + "wsql_by_level": [ + 0.08670135896298507, + 0.1278402937398429, + 0.15140813814482226, + 0.16495292419875246, + 0.17306469251684722, + 0.17442681300678603, + 0.1666750563091425, + 0.14733250143435833, + 0.10804758597092794 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 101.58214190383752, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6908290341711417, + "wql": 0.4131405659771996 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1214764696447674, + "wql": 0.1878898935456991, + "wsql_by_level": [ + 0.09262207499543831, + 0.14914568063022787, + 0.18924457211795065, + 0.21727909370046505, + 0.23590291039739708, + 0.24090782787692086, + 0.23056233162004186, + 0.198029550323772, + 0.13731500024907814 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 138.25456859517982, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.037906011098165, + "wql": 0.4891448545917221 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.045304312234166, + "wql": 0.09804157806241139, + "wsql_by_level": [ + 0.06408214294111586, + 0.09469337053951377, + 0.11458516027394162, + 0.12589721935182147, + 0.12849565316684786, + 0.12127695412156209, + 0.10626030233560248, + 0.08064120054546087, + 0.04644219928583661 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 75.30687549591065, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0373287295654268, + "wql": 0.49214750047310474 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7987609937236283, + "wql": 0.28377494256494334, + "wsql_by_level": [ + 0.17741073911937844, + 0.2709039525243316, + 0.3243614695400179, + 0.35549781428651994, + 0.36370863586535634, + 0.3598892592006782, + 0.32360982534640903, + 0.24559898790220117, + 0.13299379929959698 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.3292771241372283, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6626069917253972, + "wql": 0.5899148977388277 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9425350601349108, + "wql": 0.36613908825696184, + "wsql_by_level": [ + 0.1873473957815517, + 0.32210784322455976, + 0.4301401390202854, + 0.4834485538710736, + 0.4914088189288626, + 0.46663080350133107, + 0.40573833744911997, + 0.3142384248278718, + 0.19419147770800088 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.602440282547312, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2168526336623613, + "wql": 0.834639276014949 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3060957839443192, + "wql": 0.4838265607097834, + "wsql_by_level": [ + 0.31687387923456145, + 0.47716940918353, + 0.5849171437548221, + 0.6398688938487074, + 0.6387825416563595, + 0.5876532969160542, + 0.49958747329213055, + 0.38180066637496424, + 0.2277857421269212 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.18996885935702, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9841928030761093, + "wql": 0.8346441824232299 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7677053658818588, + "wql": 0.33630239458258376, + "wsql_by_level": [ + 0.1968330015655731, + 0.29690547150000746, + 0.36266569494861095, + 0.40981476420042345, + 0.43669658840425063, + 0.4377401618313953, + 0.39881474566125347, + 0.31351637608330946, + 0.17373474704842976 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.277436672266395, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7352369004637723, + "wql": 0.6667221439109978 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4095994296105319, + "wql": 0.43386340285063796, + "wsql_by_level": [ + 0.30928496132713634, + 0.4733023021059982, + 0.5396013685455977, + 0.5572388978202961, + 0.5443408350703419, + 0.5019450658444033, + 0.432120020878792, + 0.33843071944703895, + 0.20850645461613693 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.329535372077952, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1520220310141878, + "wql": 0.788935311729811 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.475821668344721, + "wql": 0.4251942780415075, + "wsql_by_level": [ + 0.31509850766660624, + 0.4752345529293658, + 0.5495196563330103, + 0.566015913261501, + 0.5428744128728819, + 0.4862167975690398, + 0.4041137218052025, + 0.3033851211122361, + 0.184289818823724 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 9.140736894269606, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.030556261231368, + "wql": 0.7352178135804018 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.7370499413249345, + "wql": 0.3305502142197412, + "wsql_by_level": [ + 0.16098433030546358, + 0.29035295117105075, + 0.388175568428266, + 0.441992293355034, + 0.44496885509131534, + 0.41387403754479607, + 0.3511178258193507, + 0.2838995443143424, + 0.19958652194805215 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 141.24391630717687, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9553696342740331, + "wql": 0.6811490935639388 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0337461658059954, + "wql": 0.19685454883390802, + "wsql_by_level": [ + 0.14150765475152383, + 0.19280728413971462, + 0.23337668322895314, + 0.2407456940160316, + 0.22961870179429458, + 0.2169969912262766, + 0.2056070377621349, + 0.17911683369081333, + 0.13191405889542945 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 573.0682193211147, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8307100801090606, + "wql": 0.7625777900611123 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0472401379419092, + "wql": 0.12720224814410602, + "wsql_by_level": [ + 0.07029664995115537, + 0.10830798091967621, + 0.13565663189670493, + 0.15363411158408063, + 0.16308242070096782, + 0.16155337766485034, + 0.15011524071101248, + 0.12534638353392702, + 0.07682743633457946 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.602285311513004, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.3746464305143997, + "wql": 1.3542294556230137 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7933713298798553, + "wql": 0.09480856742074853, + "wsql_by_level": [ + 0.06181473058380497, + 0.09389279616833777, + 0.11270474392286488, + 0.12122723791524277, + 0.120988152613239, + 0.11373903696369797, + 0.09951522736978505, + 0.07867872129429035, + 0.05071645995547387 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.8412337130534329, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8788685707082456, + "wql": 0.694614304684143 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.99668521894022, + "wql": 0.12358827073660948, + "wsql_by_level": [ + 0.08546495280951469, + 0.12573754934243175, + 0.15073024219637998, + 0.16298652352446497, + 0.16119272798354103, + 0.14725925637596246, + 0.12357470076077776, + 0.0937854740912228, + 0.06156300954519002 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.4311070746126853, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.943298726065593, + "wql": 0.7375790518170972 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6993013454021556, + "wql": 0.07752793117625723, + "wsql_by_level": [ + 0.05201125941784072, + 0.07798398845666492, + 0.09169810165547644, + 0.09813463213926542, + 0.09668311463045572, + 0.0885252589099701, + 0.0768606101759855, + 0.06634967769408469, + 0.04950473750657149 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.92784980507124, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.705251943340139, + "wql": 0.6497801752287172 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.6938085371192426, + "wql": 0.26248883713391, + "wsql_by_level": [ + 0.10417451441095563, + 0.190332610676068, + 0.26693756219201664, + 0.3258786862573036, + 0.3636860284652322, + 0.3655345935570215, + 0.331613910477316, + 0.26100943498089674, + 0.1532321931883799 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 20.685076636722634, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0168871197088942, + "wql": 0.7590359484577455 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2053291422737553, + "wql": 0.354704472867359, + "wsql_by_level": [ + 0.2889852942660649, + 0.3904564124635493, + 0.4377987564495417, + 0.4542196947875091, + 0.4458029921075976, + 0.4111034556855366, + 0.35055246575608245, + 0.2644940994518435, + 0.14892708483850567 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.155225664840657, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0105774011880722, + "wql": 0.9578926185532607 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.773802927161703, + "wql": 0.32663122055738, + "wsql_by_level": [ + 0.2936401982721019, + 0.3933557469464307, + 0.42893251348427464, + 0.42926175654306453, + 0.4052717876200815, + 0.3563416382206426, + 0.29355400537164167, + 0.21556180701483402, + 0.12376153154334793 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 548.0277363572802, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0147441125633787, + "wql": 1.0249668692897962 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6526051985678112, + "wql": 0.17338599376267916, + "wsql_by_level": [ + 0.10464476522828096, + 0.17639348791313267, + 0.20975051287733532, + 0.22572906246865945, + 0.22527347870617465, + 0.2087107014755816, + 0.1777210502130241, + 0.1404747978846001, + 0.09177608709732371 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2192.4775190353394, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9346991986394979, + "wql": 0.820415349892082 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4034412393705316, + "wql": 0.01862701199002854, + "wsql_by_level": [ + 0.00681952243021871, + 0.012163503580249159, + 0.015877234444681344, + 0.018971537220758453, + 0.021774425571221362, + 0.023449623647285263, + 0.02421313750676257, + 0.024093444186749982, + 0.02028067932233 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.4313096771282807, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5293342612416798, + "wql": 0.13628787062545814 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8299089879105308, + "wql": 0.0851471946255673, + "wsql_by_level": [ + 0.026065598446766636, + 0.0531740545684551, + 0.0762386942756747, + 0.09281545674218807, + 0.1039310268681836, + 0.11020214816850012, + 0.11027100922692684, + 0.10408939410320517, + 0.08953736923020553 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.57629220548847, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8487127896920926, + "wql": 0.3736097283184968 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7240627135799034, + "wql": 0.0795474580141899, + "wsql_by_level": [ + 0.027751183776783254, + 0.05407854634608965, + 0.07465887582751682, + 0.0891484681833046, + 0.09788492438075208, + 0.1006865280651933, + 0.09935833519666325, + 0.09279086541960897, + 0.07956939493179724 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.73383275528276, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7995813151421716, + "wql": 0.32750301117334046 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5040803542354756, + "wql": 0.05487285608239894, + "wsql_by_level": [ + 0.021589778657462547, + 0.041199277557044264, + 0.05565926737013595, + 0.06397043004515762, + 0.06746555553909454, + 0.06700652852468915, + 0.0657143865187584, + 0.06152623281536103, + 0.04972424771388703 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 11.273376115801973, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6639822186462594, + "wql": 0.2990070824359106 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8191453791681212, + "wql": 0.08924503963147107, + "wsql_by_level": [ + 0.04103936726304839, + 0.06899847526419345, + 0.08647592538921645, + 0.09718667476626981, + 0.10260761447729587, + 0.1070285059217092, + 0.1077967812863764, + 0.1035662108659493, + 0.08850580144918059 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.67366393958596, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7650337044834821, + "wql": 0.24511202822962144 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.988140322748688, + "wql": 0.12164005119536364, + "wsql_by_level": [ + 0.06115246530930228, + 0.1109661979601578, + 0.13640906986812326, + 0.14748926934191617, + 0.14785059518635313, + 0.1437468354672638, + 0.13399359566322203, + 0.11842761471859302, + 0.09472481724334135 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 25.771108385541552, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.662045064206245, + "wql": 0.27403921107328044 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4364672898319766, + "wql": 0.11020526888884831, + "wsql_by_level": [ + 0.05768058782385132, + 0.0994822414502116, + 0.12274330287480568, + 0.13434453332736396, + 0.1378083201414587, + 0.13400827307785967, + 0.12582566753054628, + 0.1053080406875529, + 0.07464645308598465 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 24.020688817299817, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.773189332779186, + "wql": 0.4762894649956994 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0549077688002095, + "wql": 0.46041998596747863, + "wsql_by_level": [ + 0.19168668895133567, + 0.32240730126475203, + 0.4200602614013081, + 0.49147987912476787, + 0.5470414602413013, + 0.5880768490193772, + 0.5958715002774649, + 0.5520371879134145, + 0.43511874551358565 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 160.7050030735132, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5347605042009386, + "wql": 0.24254850804981656 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.10979308255656, + "wql": 0.6899150389460954, + "wsql_by_level": [ + 0.6005092320524543, + 0.9085342237385715, + 0.9553914096909433, + 0.9135048425083719, + 0.8303367456346382, + 0.7178222454320318, + 0.5861673620871577, + 0.4354131593322464, + 0.26155613003844397 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 516.1002954415385, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8329868167901152, + "wql": 0.8661117180011689 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.258861397990577, + "wql": 0.5099189940788951, + "wsql_by_level": [ + 0.36843126436924395, + 0.5701176949438584, + 0.6439355790544746, + 0.6599200120683837, + 0.6367114930967753, + 0.5781152203258332, + 0.49704596601861106, + 0.3886433134154929, + 0.2463504034173834 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 464.80966645002104, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.835423609342505, + "wql": 0.7306420233064677 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3586843754417999, + "wql": 0.49334333222563476, + "wsql_by_level": [ + 0.37937255892673766, + 0.5821904339479698, + 0.6515815213586306, + 0.6522670980022679, + 0.6086151874669403, + 0.5384925180796213, + 0.4537771686047082, + 0.3534213737046556, + 0.22037212993918184 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 429.6853806127005, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8725275497735984, + "wql": 0.7917281405748283 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5549313151035179, + "wql": 0.22636118202988836, + "wsql_by_level": [ + 0.11924413326006411, + 0.18394873006195464, + 0.22458789461093545, + 0.2511922057327201, + 0.26127326733796785, + 0.2657684543445641, + 0.262320070620633, + 0.24787838026074124, + 0.22103750203941486 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 140.01023173605697, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6630239301209397, + "wql": 0.25275200144400983 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8226390947170049, + "wql": 0.8886397095404369, + "wsql_by_level": [ + 0.37490302554971844, + 0.7285477597056856, + 0.9166348106331261, + 1.0168012893781835, + 1.0623897306191168, + 1.0650010536716803, + 1.0294255788300377, + 0.9603551935814957, + 0.8436989438948886 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 319.05530014805925, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8445921467879297, + "wql": 0.8045678482383932 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9665861876601543, + "wql": 0.7453151400070027, + "wsql_by_level": [ + 0.2862076830889321, + 0.446118826469853, + 0.5845677958491798, + 0.7108876467327055, + 0.8251415258248822, + 0.9302408081803749, + 1.0122319297991265, + 1.0456359499372876, + 0.8668040941806829 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 269.92336819523234, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.8289703810997294, + "wql": 0.7469931990636959 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.908768278679365, + "wql": 0.620546608746356, + "wsql_by_level": [ + 0.16892178060827867, + 0.3241969595011425, + 0.5074409841309147, + 0.6585613661183352, + 0.7866835563515633, + 0.8518226492860069, + 0.8527380523098619, + 0.7968561123303517, + 0.6376980180807502 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 254.83579877561797, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8131901891818006, + "wql": 0.6662064507919429 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5398880715637647, + "wql": 0.009706675907691219, + "wsql_by_level": [ + 0.005744006196505432, + 0.009255260808013872, + 0.011530410597267098, + 0.012734485663072967, + 0.013028326977322008, + 0.012385893129533546, + 0.010601519377365271, + 0.0077953405693630745, + 0.004284839850777706 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 337.1131726264954, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3874144622853677, + "wql": 0.5274056720700804 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6709306216029969, + "wql": 0.00898945122216762, + "wsql_by_level": [ + 0.005300852060218548, + 0.008027265480542323, + 0.009916158561535835, + 0.011068699465500832, + 0.011574645984440942, + 0.011301161022072088, + 0.01022554156261373, + 0.008298482743954673, + 0.005192254118629617 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 277.0982699775696, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7305957104183266, + "wql": 0.6541364873075657 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7024983070792828, + "wql": 0.009306356357681221, + "wsql_by_level": [ + 0.005672529045480158, + 0.008803648182087545, + 0.010741251960019084, + 0.011735578750307547, + 0.01186074323435507, + 0.011307286156404825, + 0.010158748216185766, + 0.008244273103796105, + 0.005233148570494893 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 288.9913976754083, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9382582907743064, + "wql": 0.7190440001879909 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5144908058773593, + "wql": 0.00907160530159158, + "wsql_by_level": [ + 0.005571129463357473, + 0.008793825907775986, + 0.010846389408790555, + 0.011916016879086637, + 0.01210567396381383, + 0.011481121592157972, + 0.009941296123290685, + 0.007310991042210238, + 0.003678003333840846 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 16.232235455513, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4872494234178165, + "wql": 0.35553956929467834 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6837804418598864, + "wql": 0.009866426838534108, + "wsql_by_level": [ + 0.006115217317422927, + 0.009292339922686342, + 0.011285011014049067, + 0.012337776927419594, + 0.012585707834283567, + 0.012077088098266695, + 0.010836049017625166, + 0.008765822831956458, + 0.005502828583097152 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.874501796643885, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7162523589459933, + "wql": 0.41960829241373104 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7389740886815134, + "wql": 0.010480583706839727, + "wsql_by_level": [ + 0.00641232230526519, + 0.009874218422287029, + 0.011990853098863389, + 0.013132473460964815, + 0.013415573335782707, + 0.012900475523513338, + 0.01155056324058692, + 0.009212536645850245, + 0.005836237328443903 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 17.14289078170823, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8885175027819637, + "wql": 0.4426111849462436 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.19453397124535007, + "wql": 0.05904432956166924, + "wsql_by_level": [ + 0.036224831642441245, + 0.055840606118424, + 0.06759653809945503, + 0.07287160601095927, + 0.07343147637005808, + 0.07078220800044689, + 0.06292562555380331, + 0.052354118699520884, + 0.039371955559914365 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.8863999985513233, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.25194096221246937, + "wql": 0.2672358823311977 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4614736533556527, + "wql": 0.1549521314435916, + "wsql_by_level": [ + 0.12652088884825208, + 0.16702324762548704, + 0.18437070184882773, + 0.1821883566217458, + 0.1797884317724078, + 0.1750663200285903, + 0.15750373978092178, + 0.12768802828074313, + 0.09441946818534869 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 4.001303915466581, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.32009158741788846, + "wql": 0.3290470082413799 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7088275411892467, + "wql": 0.27238948312169825, + "wsql_by_level": [ + 0.1402523325143435, + 0.22192626123736514, + 0.28086516042843657, + 0.3229348493842067, + 0.3549457447329815, + 0.36186474012798864, + 0.343443422951107, + 0.271043706133091, + 0.15422913058576415 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.493238013438762, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4214122258543265, + "wql": 0.40319993899435635 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8015065778967579, + "wql": 0.2387095542274632, + "wsql_by_level": [ + 0.13118911656860718, + 0.2394877792833953, + 0.32577361032332103, + 0.35549788108469066, + 0.3542027923605549, + 0.30575802134216207, + 0.21884156141314806, + 0.13205000893234284, + 0.08558521673894666 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 7.410719174714315, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5058153494946359, + "wql": 0.4282735970873551 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3603484067173014, + "wql": 0.21731085916491027, + "wsql_by_level": [ + 0.12141138307676334, + 0.18730166351092575, + 0.22423382850352985, + 0.24626449108416124, + 0.2582953367232132, + 0.25771717095185537, + 0.24919469827660365, + 0.2315021549657978, + 0.1798770053913424 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.535224854396213, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.2229929287174494, + "wql": 0.19458505447710778 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4368667914041873, + "wql": 0.22116665449860315, + "wsql_by_level": [ + 0.12370578312566892, + 0.19643241695110397, + 0.23891938580810515, + 0.2615980766158647, + 0.26767640762184824, + 0.25972244296137903, + 0.24594063923118079, + 0.22642142785216676, + 0.1700833103201107 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 4.0442751755819675, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3412424685550413, + "wql": 0.21824116177867117 + } + } + ], + "checkpoint_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "inference_seconds": 149.63176525989547 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/EXPERIMENTS.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/EXPERIMENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..511f7fc208231f2299ecfe03f2744649f855687a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/EXPERIMENTS.md @@ -0,0 +1,4631 @@ +# Experiments + +All learned weights are initialized here from scratch. Validation windows are used only for selection and diagnostics. Screen evaluations span all 97 configurations, sampling at most 192 instances per configuration with seed 2026 and recomputing Seasonal Naive on exactly that subset. Full validation uses the supplied reference. Neither scale is the held-out reward scale. + +## E0: contract bootstrap +- Hypothesis: maintain a runnable package while training the first candidate. +- Changed factor: none; provided Seasonal Naive formula, with no learned parameters. +- Seed: deterministic. Measured compute: no training. +- Checkpoint hash: not applicable. +- Outcome: provisional package published with atomic directory exchange. + +## E1: direct long-horizon quantile forecasting +- Hypothesis: a direct horizon objective and explicit seasonal context features reduce long-horizon median drift and the underestimation of uncertainty from short-patch autoregression. +- Changed factors relative to the supplied baseline: 6,758,720-parameter encoder/decoder (4 encoder and 3 decoder layers, width 256), 32-point patches, variable 512–4096-point context, direct 32/128/512/1024-step objectives, monotone nine-quantile head. Context features contain recent levels, fixed damped slope and four-cycle primary/secondary seasonal averages; all weights are globally fixed at inference. +- Corpus: all 95 mounted allow-listed directories, deterministic source-capped sample totaling 958,745,103 points / 3.835 GB and 357,789 series. Shortest retained series: 16 points. At most eight shuffled shards per source, up to approximately 24M points/source. Series exceeding 131,072 points are cropped at a random position. Packing took under two minutes on six workers. +- Mixture: directory weight proportional to capped points^0.25, climate multiplier 0.35, low-frequency competition-source multiplier 3. Synthetic proportion 20%. Exact logic is in provenance/data.py. +- Synthetic generator: newly generated damped trends, Fourier seasonality, AR noise, intermittent demand and changepoints. No downloaded synthetic assets. +- Training seed: 17. AdamW 3e-4, batch 128, 400-step warmup, cosine decay, bf16, one H100. Run planned for 12,000 steps with snapshots every 1,000 steps. +- Control: randomly initialized model with zero output projection (fixed seasonal mixture and fixed initial interval widths) saved at step 0 to distinguish learning from the forecasting prior. +- Completed 12,000 steps in 349.9 seconds on one H100. Measured group skills, checkpoint hashes and outcomes are recorded below. + +## Known limits and next decisions +- This first run jointly changes the architecture and objective; it does not isolate their individual causal contributions. +- The initial corpus pack samples shuffled shards but takes early Arrow record batches within each selected shard. Later runs should test a wider source sample if validation plateaus. +- 10-second daily seasonality exceeds the 4,096-point encoder window. Longer fixed context summaries are a planned ablation after initial diagnostics. + +## E1 control, step 0, screening +- Checkpoint SHA-256: `81be0f24c44a558e29dffcabb4ac15ae3c944e1afe2860851683d155f920ec2f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.037512302398682 seconds. +- Overall skill 0.000921; relative MASE 1.194471; relative WQL 0.835649. +- term skill: long=0.0466, medium=0.0284, short=-0.0280. +- domain skill: Econ/Fin=-1.0735, Energy=-0.1019, Healthcare=-0.0966, Nature=0.2991, Sales=0.3167, Transport=0.2140, Web/CloudOps=-0.1294. +- frequency skill: A=-0.6469, D=0.1541, H=0.1205, M=-0.3393, Q=-0.5490, S=-2.2691, T=0.1079, W=-0.0412. +- variates skill: multivariate=0.0528, univariate=-0.0424. +- Outcome: Untrained seasonal-mixture prior barely exceeds Seasonal Naive overall and fails badly on 10-second and low-frequency configurations. + +## E1 step 1000, seed 17, screening +- Checkpoint SHA-256: `ebdd9eaa223c2bb6e38b8faec6f465a227fcd735b654a26f3b617a757addb0d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.581991195678711 seconds. +- Overall skill 0.210443; relative MASE 0.932765; relative WQL 0.668336. +- term skill: long=0.2339, medium=0.2517, short=0.1848. +- domain skill: Econ/Fin=-0.1600, Energy=0.0730, Healthcare=-0.0312, Nature=0.3679, Sales=0.2919, Transport=0.3892, Web/CloudOps=0.2547. +- frequency skill: A=0.3078, D=0.2651, H=0.3157, M=-0.3962, Q=0.0682, S=-0.6697, T=0.2839, W=0.0983. +- variates skill: multivariate=0.2140, univariate=0.2076. +- Outcome: Improves the control by 0.2095 screening skill after about 34 seconds on one H100. Selected for first neural publication and full validation. + +## E1 step 1000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.206132; relative MASE 0.931220; relative WQL 0.676774. +- term skill: long=0.2265, medium=0.2444, short=0.1829. +- domain skill: Econ/Fin=-0.1543, Energy=0.0590, Healthcare=-0.0112, Nature=0.3688, Sales=0.3043, Transport=0.3878, Web/CloudOps=0.2461. +- frequency skill: A=0.2746, D=0.2676, H=0.3116, M=-0.3493, Q=0.0397, S=-0.6697, T=0.2712, W=0.1025. +- variates skill: multivariate=0.2097, univariate=0.2033. +- Outcome: Full 151,170-instance validation skill 0.2061, with no failed configurations. Package inference took 29.5 seconds while training shared the sole GPU. First neural publication verified. + +## E1 step 2000, screening +- Checkpoint SHA-256: `a513ac4f03aceb93a860d5e5eca70010c0101fdea794df4a9a8ae472647fb9c9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.98806357383728 seconds. +- Overall skill 0.249671; relative MASE 0.890745; relative WQL 0.632048. +- term skill: long=0.2727, medium=0.2872, short=0.2257. +- domain skill: Econ/Fin=-0.0533, Energy=0.1151, Healthcare=0.1665, Nature=0.4084, Sales=0.2984, Transport=0.3867, Web/CloudOps=0.2855. +- frequency skill: A=0.3280, D=0.2894, H=0.3291, M=-0.1483, Q=0.1703, S=-0.4627, T=0.3239, W=0.1185. +- variates skill: multivariate=0.2588, univariate=0.2423. +- Outcome: Improves screening skill to 0.2497 after 66.8 seconds of training; candidate for replacement. + +## E1 step 3000, screening +- Checkpoint SHA-256: `74da538d2365426496a12c965c0c0cdc1d3962a798bd2e2c5fed950c1f663f30`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.051600933074951 seconds. +- Overall skill 0.246085; relative MASE 0.894210; relative WQL 0.635631. +- term skill: long=0.2835, medium=0.2774, short=0.2187. +- domain skill: Econ/Fin=-0.1111, Energy=0.1198, Healthcare=-0.0532, Nature=0.3956, Sales=0.3188, Transport=0.4123, Web/CloudOps=0.3004. +- frequency skill: A=0.3478, D=0.2585, H=0.3298, M=-0.3174, Q=0.1517, S=-0.6889, T=0.3620, W=0.1126. +- variates skill: multivariate=0.2552, univariate=0.2388. +- Outcome: Slight regression to 0.2461 relative to step 2000. Negative checkpoint-selection result; not selected. + +## E2 fixed longer-history feature ablation, step 2000 seed 17 +- Checkpoint SHA-256: `25ac85db67c041c92870e2ea2e8b198bb768f5c5ed64f42b78d6ec207ffe3a18`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.066685438156128 seconds. +- Overall skill 0.249089; relative MASE 0.890661; relative WQL 0.633088. +- term skill: long=0.2741, medium=0.2855, short=0.2248. +- domain skill: Econ/Fin=-0.0532, Energy=0.1146, Healthcare=0.1651, Nature=0.4048, Sales=0.2986, Transport=0.3880, Web/CloudOps=0.2859. +- frequency skill: A=0.3273, D=0.2892, H=0.3291, M=-0.1495, Q=0.1705, S=-0.4627, T=0.3228, W=0.1166. +- variates skill: multivariate=0.2572, univariate=0.2426. +- Outcome: No training. Changed only history available to seasonal summaries from 4,096 to 16,384 points, with the encoder unchanged. Skill decreased 0.24967 to 0.24909. Rejected. Validation 10-second histories are shorter than one daily cycle, so additional history cannot supply that feature. + +## E1 step 4000, screening +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.961170196533203 seconds. +- Overall skill 0.266471; relative MASE 0.874789; relative WQL 0.615080. +- term skill: long=0.2537, medium=0.2846, short=0.2643. +- domain skill: Econ/Fin=-0.0360, Energy=0.1306, Healthcare=0.1810, Nature=0.3894, Sales=0.3301, Transport=0.4253, Web/CloudOps=0.3121. +- frequency skill: A=0.3647, D=0.2978, H=0.3375, M=-0.0981, Q=0.1458, S=-0.2890, T=0.3375, W=0.1196. +- variates skill: multivariate=0.2648, univariate=0.2678. +- Outcome: Best ungated checkpoint so far; improved short-horizon performance, with some long-horizon regression. + +## E1 step 6000, screening +- Checkpoint SHA-256: `f38cdb1b49938007c20bdfdfa7c4fc7d7aba6516192f388f37088891411eab7f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.802650451660156 seconds. +- Overall skill 0.258313; relative MASE 0.878300; relative WQL 0.626324. +- term skill: long=0.2951, medium=0.3035, short=0.2254. +- domain skill: Econ/Fin=-0.0599, Energy=0.1417, Healthcare=0.2750, Nature=0.3683, Sales=0.3181, Transport=0.4116, Web/CloudOps=0.2761. +- frequency skill: A=0.3490, D=0.2962, H=0.3475, M=-0.0679, Q=0.1442, S=-0.6390, T=0.3416, W=0.0785. +- variates skill: multivariate=0.2482, univariate=0.2662. +- Outcome: Overall regression relative to step 4000 despite improvement on medium and long horizons. Not selected by overall skill. + +## E3 seasonal confidence gate, step 4000 seed 17 +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.475942373275757 seconds. +- Overall skill 0.301779; relative MASE 0.827721; relative WQL 0.588981. +- term skill: long=0.3338, medium=0.3656, short=0.2627. +- domain skill: Econ/Fin=-0.0087, Energy=0.1326, Healthcare=0.1954, Nature=0.3891, Sales=0.3285, Transport=0.4242, Web/CloudOps=0.4509. +- frequency skill: A=0.3647, D=0.2945, H=0.3455, M=-0.0632, Q=0.1395, S=0.3700, T=0.3389, W=0.1159. +- variates skill: multivariate=0.3379, univariate=0.2716. +- Outcome: No additional training. Fixed gate: weight=clip(1 - mean squared seasonal difference / (0.25 * context variance), 0, 0.98). Blend neural quantiles with a last-four-cycle seasonal mean and Gaussian intervals based on seasonal differences. Each instance uses only its own context; no optimized or adapted parameters. Skill increases 0.26647 to 0.30178; selected for full validation. + +## E3 step 4000 gate, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.296168; relative MASE 0.830141; relative WQL 0.596742. +- term skill: long=0.3262, medium=0.3621, short=0.2569. +- domain skill: Econ/Fin=-0.0444, Energy=0.1210, Healthcare=0.2106, Nature=0.3890, Sales=0.3389, Transport=0.4244, Web/CloudOps=0.4426. +- frequency skill: A=0.2806, D=0.2946, H=0.3404, M=-0.0364, Q=0.1048, S=0.3700, T=0.3291, W=0.1093. +- variates skill: multivariate=0.3332, univariate=0.2652. +- Outcome: Selected and published. Full validation skill 0.296168 versus 0.206132 for the initial neural package; no failures. Full inference took 39.8 seconds while sharing one GPU with training. This is validation skill, not a held-out reward claim. + +## E1 step 8000, seed 17, ungated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.500704050064087 seconds. +- Overall skill 0.276275; relative MASE 0.864160; relative WQL 0.606113. +- term skill: long=0.2954, medium=0.3094, short=0.2557. +- domain skill: Econ/Fin=-0.0085, Energy=0.1522, Healthcare=0.1826, Nature=0.3866, Sales=0.3192, Transport=0.4212, Web/CloudOps=0.3315. +- frequency skill: A=0.3679, D=0.3262, H=0.3533, M=-0.2016, Q=0.1316, S=-0.4192, T=0.3605, W=0.1103. +- variates skill: multivariate=0.2735, univariate=0.2785. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 8000, seed 17, gated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.228765964508057 seconds. +- Overall skill 0.312772; relative MASE 0.813977; relative WQL 0.580216. +- term skill: long=0.3671, medium=0.3752, short=0.2645. +- domain skill: Econ/Fin=-0.0003, Energy=0.1512, Healthcare=0.1999, Nature=0.3863, Sales=0.3176, Transport=0.4184, Web/CloudOps=0.4791. +- frequency skill: A=0.3679, D=0.3227, H=0.3559, M=-0.1576, Q=0.1357, S=0.3651, T=0.3604, W=0.1062. +- variates skill: multivariate=0.3530, univariate=0.2790. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, ungated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.094600439071655 seconds. +- Overall skill 0.285838; relative MASE 0.855761; relative WQL 0.595993. +- term skill: long=0.2974, medium=0.3249, short=0.2658. +- domain skill: Econ/Fin=0.0083, Energy=0.1537, Healthcare=0.1904, Nature=0.3858, Sales=0.3164, Transport=0.4217, Web/CloudOps=0.3674. +- frequency skill: A=0.3494, D=0.3058, H=0.3594, M=-0.1439, Q=0.1128, S=-0.2516, T=0.3685, W=0.1234. +- variates skill: multivariate=0.2917, univariate=0.2812. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, gated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.704133749008179 seconds. +- Overall skill 0.317743; relative MASE 0.805746; relative WQL 0.577695. +- term skill: long=0.3656, medium=0.3815, short=0.2718. +- domain skill: Econ/Fin=0.0087, Energy=0.1540, Healthcare=0.2110, Nature=0.3855, Sales=0.3148, Transport=0.4194, Web/CloudOps=0.4916. +- frequency skill: A=0.3494, D=0.3033, H=0.3612, M=-0.1027, Q=0.1231, S=0.3756, T=0.3699, W=0.1199. +- variates skill: multivariate=0.3600, univariate=0.2821. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, ungated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.807793855667114 seconds. +- Overall skill 0.284471; relative MASE 0.856118; relative WQL 0.598027. +- term skill: long=0.2877, medium=0.3155, short=0.2710. +- domain skill: Econ/Fin=0.0294, Energy=0.1544, Healthcare=0.2252, Nature=0.3903, Sales=0.3151, Transport=0.4273, Web/CloudOps=0.3413. +- frequency skill: A=0.3430, D=0.3172, H=0.3585, M=-0.1807, Q=0.1231, S=-0.2708, T=0.3565, W=0.1685. +- variates skill: multivariate=0.2854, univariate=0.2837. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, gated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.750269889831543 seconds. +- Overall skill 0.315453; relative MASE 0.812477; relative WQL 0.576760. +- term skill: long=0.3585, medium=0.3794, short=0.2715. +- domain skill: Econ/Fin=0.0081, Energy=0.1534, Healthcare=0.2414, Nature=0.3899, Sales=0.3136, Transport=0.4251, Web/CloudOps=0.4722. +- frequency skill: A=0.3430, D=0.3141, H=0.3577, M=-0.1400, Q=0.1249, S=0.3722, T=0.3572, W=0.1641. +- variates skill: multivariate=0.3552, univariate=0.2820. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E4 stochastic weight average, seed 17, gated screening +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.737564325332642 seconds. +- Overall skill 0.320612; relative MASE 0.803931; relative WQL 0.574139. +- term skill: long=0.3654, medium=0.3823, short=0.2769. +- domain skill: Econ/Fin=0.0210, Energy=0.1663, Healthcare=0.2341, Nature=0.3839, Sales=0.3192, Transport=0.4246, Web/CloudOps=0.4812. +- frequency skill: A=0.3645, D=0.3114, H=0.3584, M=-0.0937, Q=0.1411, S=0.3729, T=0.3725, W=0.1398. +- variates skill: multivariate=0.3557, univariate=0.2913. +- Outcome: Arithmetic weight average of steps 8000, 9000, 10000, 11000 and 12000. Total underlying training 349.9 seconds on one H100 for 12,000 steps / 1,536,000 windows. Averaging uses no validation labels or training updates. Screening skill 0.320612 exceeds the best individual checkpoint 0.317743; selected for full validation. + +## E3 confidence and quantile-width sweep +- Fixed global settings, selected only on validation; no model updates. Seed and checkpoint: E1 step 8000, seed 17. +- Measured CPU time: 10.7 seconds. The original threshold 0.25 and width multiplier 1.0 won; no tuned change was adopted. +- (variance threshold, width multiplier) (0.25, 1.0): skill 0.312772; term skills {'short': 0.2645319168347662, 'medium': 0.37524061562171485, 'long': 0.36711552655262625}. +- (variance threshold, width multiplier) (0.5, 1.0): skill 0.311338; term skills {'short': 0.26128183571880415, 'medium': 0.3766834137570718, 'long': 0.36686872500364487}. +- (variance threshold, width multiplier) (0.25, 0.75): skill 0.310114; term skills {'short': 0.26357949467631236, 'medium': 0.3710044838302994, 'long': 0.36223509497654094}. +- (variance threshold, width multiplier) (0.1, 1.0): skill 0.309380; term skills {'short': 0.2645827018541862, 'medium': 0.3687788042390393, 'long': 0.3590704635989247}. +- (variance threshold, width multiplier) (0.25, 1.25): skill 0.308716; term skills {'short': 0.25806263726485956, 'medium': 0.3732424245969126, 'long': 0.3664492202082874}. +- (variance threshold, width multiplier) (0.5, 0.75): skill 0.308480; term skills {'short': 0.2599791649373039, 'medium': 0.3724274186615034, 'long': 0.36196930941343286}. +- (variance threshold, width multiplier) (0.5, 1.25): skill 0.307830; term skills {'short': 0.25575126666422066, 'medium': 0.3747816871597687, 'long': 0.3663051398261168}. +- (variance threshold, width multiplier) (0.1, 0.75): skill 0.306923; term skills {'short': 0.26386190560263856, 'medium': 0.3650190620286501, 'long': 0.35398875275507513}. +- (variance threshold, width multiplier) (0.1, 1.25): skill 0.305043; term skills {'short': 0.2579337472130613, 'medium': 0.36611831669487493, 'long': 0.3583403545682865}. +- (variance threshold, width multiplier) (1.0, 1.0): skill 0.300332; term skills {'short': 0.24300377373135085, 'medium': 0.37515035650362993, 'long': 0.3625716315021771}. +- (variance threshold, width multiplier) (1.0, 0.75): skill 0.297470; term skills {'short': 0.24163138399697548, 'medium': 0.37101264403024414, 'long': 0.3577626408389879}. +- (variance threshold, width multiplier) (1.0, 1.25): skill 0.296900; term skills {'short': 0.23759298244372884, 'medium': 0.3732464838258517, 'long': 0.3619922948184182}. +- (variance threshold, width multiplier) (0.0, 1.0): skill 0.276275; term skills {'short': 0.25565045294773825, 'medium': 0.30935443355536374, 'long': 0.29541709470756516}. +- (variance threshold, width multiplier) (0.0, 0.75): skill 0.274035; term skills {'short': 0.2552205537396286, 'medium': 0.30589300644316675, 'long': 0.289930620063797}. +- (variance threshold, width multiplier) (0.0, 1.25): skill 0.271354; term skills {'short': 0.2486798921582145, 'medium': 0.30569315727356094, 'long': 0.29429049771287774}. + +## E5 capacity and exponential averaging +- Hypothesis: increased capacity reduces residual errors after direct-horizon training; exponential weight averaging reduces checkpoint noise. +- Changed factors: width 512, six encoder and four decoder layers, 37,002,816 parameters; 24,000-step schedule at 2e-4; seed 23. Same source sample, mixture, synthetic generator, batch 128 and horizon distribution as E1. Training-only EMA decay min(0.999, 1-1/(step+1)). +- Completed on the sole H100; raw and EMA snapshots were evaluated across all 97 configurations. No causal claim isolates size from seed/schedule changes. + +## E4 averaged small model, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.315325; relative MASE 0.806359; relative WQL 0.581354. +- term skill: long=0.3584, medium=0.3790, short=0.2715. +- domain skill: Econ/Fin=-0.0034, Energy=0.1557, Healthcare=0.2457, Nature=0.3833, Sales=0.3308, Transport=0.4241, Web/CloudOps=0.4729. +- frequency skill: A=0.2978, D=0.3142, H=0.3526, M=-0.0698, Q=0.1192, S=0.3729, T=0.3632, W=0.1318. +- variates skill: multivariate=0.3509, univariate=0.2856. +- Outcome: Full validation skill 0.315325, relative MASE 0.806359 and relative WQL 0.581354, all 97 configurations valid. Inference took 37.2 seconds while sharing one H100 with training. Selected over the step-4000 gated package. + +## E6 sign symmetry, averaged small model, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.13059401512146 seconds. +- Overall skill 0.328463; relative MASE 0.794174; relative WQL 0.567837. +- term skill: long=0.3740, medium=0.3863, short=0.2861. +- domain skill: Econ/Fin=0.0049, Energy=0.1627, Healthcare=0.2543, Nature=0.3978, Sales=0.3314, Transport=0.4439, Web/CloudOps=0.4889. +- frequency skill: A=0.2986, D=0.3191, H=0.3677, M=-0.0077, Q=0.1661, S=0.3711, T=0.3792, W=0.1244. +- variates skill: multivariate=0.3628, univariate=0.2998. +- Outcome: No additional training. Average the forecasts from x and negated x with quantile order reversed, then apply positivity and the same fixed seasonal gate. Screening skill rises 0.320612 to 0.328463. Hypothesis: sign symmetry reduces finite-sample neural bias. Selected for full validation. + +## E6 sign symmetry, averaged small model, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.323978; relative MASE 0.795773; relative WQL 0.574292. +- term skill: long=0.3666, medium=0.3832, short=0.2823. +- domain skill: Econ/Fin=-0.0072, Energy=0.1517, Healthcare=0.2646, Nature=0.3974, Sales=0.3433, Transport=0.4439, Web/CloudOps=0.4816. +- frequency skill: A=0.2459, D=0.3222, H=0.3623, M=0.0177, Q=0.1587, S=0.3711, T=0.3705, W=0.1158. +- variates skill: multivariate=0.3586, univariate=0.2951. +- Outcome: Full validation skill 0.323978 versus 0.315325 without sign symmetry. Relative MASE 0.795773, relative WQL 0.574292, zero failed configurations, 42.3 seconds of inference. Selected for atomic publication. + +## E7 coarse temporal resolution at inference, small averaged model +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.896855354309082 seconds. +- Overall skill 0.320862; relative MASE 0.803289; relative WQL 0.574174. +- term skill: long=0.3616, medium=0.3660, short=0.2861. +- domain skill: Econ/Fin=0.0049, Energy=0.1601, Healthcare=0.2543, Nature=0.4043, Sales=0.3314, Transport=0.4281, Web/CloudOps=0.4698. +- frequency skill: A=0.2986, D=0.3191, H=0.3444, M=-0.0077, Q=0.1661, S=0.3686, T=0.3804, W=0.1244. +- variates skill: multivariate=0.3567, univariate=0.2909. +- Outcome: Negative result: for horizons >=400, average the sign-symmetric prediction with a four-step-aggregated prediction from the same weights, then apply the unchanged seasonal gate. Screening skill falls from 0.328463 to 0.320862, so this is rejected. No training or fitted context parameters. + +## E8 median and predictable-series loss weighting +- Hypothesis: optimizing median error explicitly and weighting by context seasonal error aligns pretraining with MASE and quantile loss. +- Initial weights: E4 averaged small model, trained here from random initialization; no external pretrained assets. +- Changed factor: loss = mean over valid steps of 0.5 times mean pinball loss plus 0.25 times absolute median error, weighted per instance by clip(1/(0.25 + normalized context seasonal absolute difference), 0.25, 4). Weights are normalized across the batch. Training-only calculation; inference model unchanged. +- Seed 31, batch 256, 6,000 steps, AdamW 1e-4 with 400-step warmup and cosine decay, same source sample and synthetic generator. EMA as E5. +- Compute: 272.9 seconds elapsed on the sole H100, shared concurrently with E5. Underlying initial pretraining used 349.9 seconds. + +## E8 step 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `e7cb5c4b4f04ba1ca873bc725f5e4345874520a96cbd3f079e4f631fd3c46d50`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.978966474533081 seconds. +- Overall skill 0.331642; relative MASE 0.791898; relative WQL 0.564091. +- term skill: long=0.3735, medium=0.3891, short=0.2910. +- domain skill: Econ/Fin=-0.0197, Energy=0.1668, Healthcare=0.2894, Nature=0.4040, Sales=0.3301, Transport=0.4439, Web/CloudOps=0.4906. +- frequency skill: A=0.2646, D=0.3158, H=0.3714, M=0.0669, Q=0.1387, S=0.3726, T=0.3764, W=0.1424. +- variates skill: multivariate=0.3652, univariate=0.3036. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `dab309aff5a3a28936391b84b3ebd9d5dfc208e53c1e1602e4f5c599e3004c33`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.16230034828186 seconds. +- Overall skill 0.332263; relative MASE 0.790121; relative WQL 0.564310. +- term skill: long=0.3745, medium=0.3873, short=0.2925. +- domain skill: Econ/Fin=0.0051, Energy=0.1638, Healthcare=0.2952, Nature=0.4011, Sales=0.3311, Transport=0.4450, Web/CloudOps=0.4919. +- frequency skill: A=0.3239, D=0.3220, H=0.3698, M=0.0488, Q=0.1636, S=0.3751, T=0.3783, W=0.1317. +- variates skill: multivariate=0.3653, univariate=0.3047. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `111cf52c0662c60aebb44355135a65675a09d898995deeb4dd2f8f2b66339a0f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.85259199142456 seconds. +- Overall skill 0.326318; relative MASE 0.796087; relative WQL 0.570097. +- term skill: long=0.3658, medium=0.3826, short=0.2873. +- domain skill: Econ/Fin=-0.0159, Energy=0.1477, Healthcare=0.3155, Nature=0.4038, Sales=0.3247, Transport=0.4419, Web/CloudOps=0.4862. +- frequency skill: A=0.2949, D=0.3163, H=0.3678, M=0.0654, Q=0.1519, S=0.3722, T=0.3655, W=0.1286. +- variates skill: multivariate=0.3573, univariate=0.3006. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `5fa525d923b4af5949f2415cf0ad0b325dae7623f07aae06b3131bdbda08c209`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.634822130203247 seconds. +- Overall skill 0.332843; relative MASE 0.789360; relative WQL 0.563874. +- term skill: long=0.3745, medium=0.3875, short=0.2936. +- domain skill: Econ/Fin=0.0007, Energy=0.1627, Healthcare=0.3135, Nature=0.4026, Sales=0.3309, Transport=0.4452, Web/CloudOps=0.4913. +- frequency skill: A=0.3152, D=0.3249, H=0.3696, M=0.0640, Q=0.1700, S=0.3757, T=0.3784, W=0.1261. +- variates skill: multivariate=0.3645, univariate=0.3065. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `8ce9867a6005c28005b32d163254c088279f2a46febeadc433b403aeffc29066`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.403828620910645 seconds. +- Overall skill 0.333292; relative MASE 0.789778; relative WQL 0.562816. +- term skill: long=0.3723, medium=0.3857, short=0.2961. +- domain skill: Econ/Fin=-0.0157, Energy=0.1603, Healthcare=0.3279, Nature=0.4080, Sales=0.3286, Transport=0.4450, Web/CloudOps=0.4921. +- frequency skill: A=0.2821, D=0.3254, H=0.3697, M=0.0826, Q=0.1490, S=0.3718, T=0.3810, W=0.1182. +- variates skill: multivariate=0.3645, univariate=0.3073. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `e61535b34efac923328f1dd464f5ab8ab05913438f86125d8b933f1b166281d9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.288180112838745 seconds. +- Overall skill 0.334221; relative MASE 0.787768; relative WQL 0.562681. +- term skill: long=0.3735, medium=0.3879, short=0.2964. +- domain skill: Econ/Fin=-0.0016, Energy=0.1638, Healthcare=0.3235, Nature=0.4037, Sales=0.3295, Transport=0.4477, Web/CloudOps=0.4916. +- frequency skill: A=0.3041, D=0.3326, H=0.3704, M=0.0629, Q=0.1674, S=0.3746, T=0.3813, W=0.1128. +- variates skill: multivariate=0.3653, univariate=0.3084. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `15833e7668d9cd11ed55a4820b4700d71c6f734415d11490c7e8beb654abfa12`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.2668559551239 seconds. +- Overall skill 0.334430; relative MASE 0.788174; relative WQL 0.562038. +- term skill: long=0.3762, medium=0.3886, short=0.2953. +- domain skill: Econ/Fin=-0.0108, Energy=0.1611, Healthcare=0.3518, Nature=0.4037, Sales=0.3298, Transport=0.4457, Web/CloudOps=0.4924. +- frequency skill: A=0.2760, D=0.3360, H=0.3690, M=0.0736, Q=0.1605, S=0.3759, T=0.3813, W=0.1132. +- variates skill: multivariate=0.3660, univariate=0.3081. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.340764284133911 seconds. +- Overall skill 0.335038; relative MASE 0.787307; relative WQL 0.561630. +- term skill: long=0.3762, medium=0.3878, short=0.2968. +- domain skill: Econ/Fin=-0.0053, Energy=0.1637, Healthcare=0.3401, Nature=0.4031, Sales=0.3292, Transport=0.4464, Web/CloudOps=0.4934. +- frequency skill: A=0.2894, D=0.3329, H=0.3693, M=0.0767, Q=0.1622, S=0.3763, T=0.3828, W=0.1162. +- variates skill: multivariate=0.3659, univariate=0.3094. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E9 neural context 512 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.416622161865234 seconds. +- Overall skill 0.320871; relative MASE 0.803968; relative WQL 0.573675. +- term skill: long=0.3740, medium=0.3863, short=0.2718. +- domain skill: Econ/Fin=0.0457, Energy=0.1466, Healthcare=0.2113, Nature=0.3887, Sales=0.3285, Transport=0.4330, Web/CloudOps=0.4911. +- frequency skill: A=0.2986, D=0.2904, H=0.3587, M=-0.0099, Q=0.1658, S=0.3756, T=0.3687, W=0.1716. +- variates skill: multivariate=0.3665, univariate=0.2822. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 1024 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.072535276412964 seconds. +- Overall skill 0.329251; relative MASE 0.796444; relative WQL 0.564891. +- term skill: long=0.3740, medium=0.3863, short=0.2876. +- domain skill: Econ/Fin=0.0323, Energy=0.1629, Healthcare=0.1832, Nature=0.3978, Sales=0.3361, Transport=0.4415, Web/CloudOps=0.4998. +- frequency skill: A=0.2986, D=0.3031, H=0.3649, M=-0.0077, Q=0.1661, S=0.3761, T=0.3907, W=0.1240. +- variates skill: multivariate=0.3738, univariate=0.2915. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 2048 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.426023244857788 seconds. +- Overall skill 0.329063; relative MASE 0.794285; relative WQL 0.566744. +- term skill: long=0.3740, medium=0.3863, short=0.2872. +- domain skill: Econ/Fin=0.0227, Energy=0.1628, Healthcare=0.2235, Nature=0.3975, Sales=0.3314, Transport=0.4448, Web/CloudOps=0.4931. +- frequency skill: A=0.2986, D=0.3154, H=0.3656, M=-0.0077, Q=0.1661, S=0.3738, T=0.3847, W=0.1224. +- variates skill: multivariate=0.3651, univariate=0.2989. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E10 fixed 50/50 ensemble diagnostic +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 4.082070589065552 seconds. +- Overall skill 0.332712; relative MASE 0.791350; relative WQL 0.562676. +- term skill: long=0.3746, medium=0.3901, short=0.2921. +- domain skill: Econ/Fin=-0.0029, Energy=0.1641, Healthcare=0.3036, Nature=0.4055, Sales=0.3288, Transport=0.4500, Web/CloudOps=0.4870. +- frequency skill: A=0.2971, D=0.3243, H=0.3712, M=0.0353, Q=0.1843, S=0.3742, T=0.3778, W=0.1385. +- variates skill: multivariate=0.3658, univariate=0.3052. +- Outcome: Average of E8 EMA4000 and E5 EMA12000, both with sign symmetry and the same fixed seasonal gate. Skill 0.332712 is below E8 alone (0.334221). Rejected for now; both members would forecast every instance. + +## E8 EMA6000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.330109; relative MASE 0.789610; relative WQL 0.568323. +- term skill: long=0.3687, medium=0.3851, short=0.2920. +- domain skill: Econ/Fin=-0.0223, Energy=0.1525, Healthcare=0.3475, Nature=0.4024, Sales=0.3415, Transport=0.4461, Web/CloudOps=0.4860. +- frequency skill: A=0.2370, D=0.3358, H=0.3639, M=0.0960, Q=0.1447, S=0.3763, T=0.3738, W=0.1061. +- variates skill: multivariate=0.3616, univariate=0.3039. +- Outcome: Full validation skill 0.330109, relative MASE 0.789610, relative WQL 0.568323, zero failed configurations. Inference took 48.1 seconds while sharing the one H100. Improves the previous published 0.323978 and is selected for atomic publication. + +## E11 matched corpus-coverage experiment +- Hypothesis: broader source coverage improves generalization after the initial model has plateaued. +- Expanded sample: 95 directories, 1,032,415 series, 5,653,290,832 points (22.613 GB), versus 357,789 series and 958,745,103 points (3.835 GB). Per-source cap rises from 24M to 192M points, Arrow record batches are shuffled within each selected shard, and the per-series crop cap rises from 131,072 to 1,048,576. The same deterministic directory-hash seeds and at most eight sampled shards per directory are used. +- Two matched continuations start from E8 EMA6000: original sample control and expanded sample. Both use seed 41, batch 256, the E8 loss, 6,000 steps, AdamW 1e-4 and the same schedule/EMA. Training uses only corpus/synthetic data. +- Runs share the single H100 with E5; CPU threads are limited to three per new trainer. Completed matched runs: control 363.4 s, expanded 364.8 s; the expanded corpus did not improve either matched checkpoint. Detailed results are below. + +## E12 fixed continuity correction +- Hypothesis: a direct-horizon head can miss the immediate level of a smooth history, and a small decaying correction should reduce short-horizon error. No training or context fitting. E8 EMA6000 weights, seed 31. +- Fixed formula: ratio=mean(square(first differences))/variance over the last 512 points; w=clip(1-ratio/0.5,0,0.95); bias=w*(last value + median of the last eight differences - first forecast median). Add bias*exp(-step/tau) to each quantile, then retain the existing positivity rule. Skip sparse missing-value differences. +- Initial diagnostic needed a missing-value guard; invalid intermediate scores were discarded. A positivity-lookback mismatch in the probe was also corrected so tau=0 exactly reproduces the control. +- CPU sweep took 6.0 seconds; final verified control and all candidate scores follow. Tau 24 selected for package/full validation. +- tau=0: skill 0.335038, relative MASE 0.787307, relative WQL 0.561630, group skills {'term': {'short': 0.2967927346774093, 'medium': 0.38776799350809343, 'long': 0.37616349665047677}, 'domain': {'Econ/Fin': -0.005273788909573085, 'Energy': 0.16374587322817125, 'Healthcare': 0.34007707190705616, 'Nature': 0.4030815329292825, 'Sales': 0.32924485226314826, 'Transport': 0.4464324047455728, 'Web/CloudOps': 0.4934311796492926}, 'freq': {'A-DEC': 0.2893784388532201, 'Q-DEC': 0.16218093798601307, 'M': 0.07665328507242941, 'W-SUN': -0.31450314757766273, 'D': 0.332876404786148, 'H': 0.3693479345200832, '15T': 0.14228566862247327, 'W-FRI': 0.032405497411887585, '10T': 0.4887742379514316, 'W-TUE': 0.309664207244038, 'W-THU': 0.14794979612329628, 'W-WED': 0.29198895648742507, '5T': 0.5120305409377247, '10S': 0.3762720731817548}}. +- tau=2: skill 0.337508, relative MASE 0.783332, relative WQL 0.560293, group skills {'term': {'short': 0.30112159439110886, 'medium': 0.3882128168958763, 'long': 0.3763449044348186}, 'domain': {'Econ/Fin': 0.012010642573481944, 'Energy': 0.1687336419481582, 'Healthcare': 0.33847751009406857, 'Nature': 0.4038059435050727, 'Sales': 0.32920024652725177, 'Transport': 0.4463400575252827, 'Web/CloudOps': 0.4950030531002031}, 'freq': {'A-DEC': 0.2973561434987757, 'Q-DEC': 0.17698071591831765, 'M': 0.07233297868059718, 'W-SUN': -0.2582996069171355, 'D': 0.3346112879714367, 'H': 0.36855118351366944, '15T': 0.14569114456054433, 'W-FRI': 0.021432593572035197, '10T': 0.5064176027092252, 'W-TUE': 0.3132256284193611, 'W-THU': 0.1516542652623164, 'W-WED': 0.29198895648742507, '5T': 0.5121886153783087, '10S': 0.38181456512243606}}. +- tau=8: skill 0.339730, relative MASE 0.781190, relative WQL 0.558067, group skills {'term': {'short': 0.30468677533784194, 'medium': 0.3890128603479147, 'long': 0.3768542253336602}, 'domain': {'Econ/Fin': 0.04357586882889164, 'Energy': 0.17060177779549268, 'Healthcare': 0.3292576172809155, 'Nature': 0.4040895491577191, 'Sales': 0.32915095007230155, 'Transport': 0.4455718893158739, 'Web/CloudOps': 0.498582535356759}, 'freq': {'A-DEC': 0.30427943534005153, 'Q-DEC': 0.18739632573970566, 'M': 0.05811644843967234, 'W-SUN': -0.14993519310493708, 'D': 0.33691177813304396, 'H': 0.36800946318922256, '15T': 0.15562275067857723, 'W-FRI': 0.015293948848938421, '10T': 0.5022238811405833, 'W-TUE': 0.308852394109824, 'W-THU': 0.16531962754891327, 'W-WED': 0.29198895648742507, '5T': 0.5124270255950129, '10S': 0.3959332124123227}}. +- tau=24: skill 0.341604, relative MASE 0.780976, relative WQL 0.555056, group skills {'term': {'short': 0.30735425505077896, 'medium': 0.38984232067302926, 'long': 0.37791322023985785}, 'domain': {'Econ/Fin': 0.07789629542475163, 'Energy': 0.16814859423491146, 'Healthcare': 0.32219860777640197, 'Nature': 0.4027938268275436, 'Sales': 0.32911299366848257, 'Transport': 0.4440214473788372, 'Web/CloudOps': 0.505502554697025}, 'freq': {'A-DEC': 0.30701454754159097, 'Q-DEC': 0.18894276751813088, 'M': 0.04173508991923269, 'W-SUN': -0.06710914169849702, 'D': 0.33891978173454174, 'H': 0.36806701600948255, '15T': 0.16691265843751302, 'W-FRI': 0.011149977535114819, '10T': 0.48062823437029445, 'W-TUE': 0.3054618645258299, 'W-THU': 0.17135723270801106, 'W-WED': 0.29198895648742507, '5T': 0.5128629288387704, '10S': 0.42606586812368186}}. +- tau=64: skill 0.340824, relative MASE 0.783313, relative WQL 0.554713, group skills {'term': {'short': 0.3064164746371565, 'medium': 0.38779908004530583, 'long': 0.3787937309532532}, 'domain': {'Econ/Fin': 0.09969949435020342, 'Energy': 0.15974598777640392, 'Healthcare': 0.3189527251466179, 'Nature': 0.4009254556920715, 'Sales': 0.32909545704191134, 'Transport': 0.44166143132149305, 'Web/CloudOps': 0.5103628293774518}, 'freq': {'A-DEC': 0.3079352359976604, 'Q-DEC': 0.18879190434187287, 'M': 0.03049481695615497, 'W-SUN': -0.03231570437562303, 'D': 0.33992332397958547, 'H': 0.36593420410508737, '15T': 0.1654947222236236, 'W-FRI': 0.009213828856730832, '10T': 0.46016772262416383, 'W-TUE': 0.3040006089982843, 'W-THU': 0.17343046632698478, 'W-WED': 0.29198895648742507, '5T': 0.5128850832828526, '10S': 0.4486615108502494}}. +- tau=128: skill 0.338292, relative MASE 0.786639, relative WQL 0.556618, group skills {'term': {'short': 0.3043668884529205, 'medium': 0.38176748757743373, 'long': 0.37868472074438897}, 'domain': {'Econ/Fin': 0.10637792737302931, 'Energy': 0.1531270206619928, 'Healthcare': 0.31816668045459984, 'Nature': 0.39985518410953147, 'Sales': 0.3290895550941987, 'Transport': 0.4399018505526925, 'Web/CloudOps': 0.5082609219137205}, 'freq': {'A-DEC': 0.3082114553822066, 'Q-DEC': 0.1886335736447592, 'M': 0.026327746733658897, 'W-SUN': -0.021307580325764297, 'D': 0.34025742210101806, 'H': 0.3625439077766571, '15T': 0.1628300810039216, 'W-FRI': 0.00856370190545519, '10T': 0.4513327819863723, 'W-TUE': 0.30351149262807786, 'W-THU': 0.1740816133131421, 'W-WED': 0.29198895648742507, '5T': 0.512369368619311, '10S': 0.44352723463256316}}. + +## E12 continuity prior, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.336914; relative MASE 0.783869; relative WQL 0.560914. +- term skill: long=0.3705, medium=0.3876, short=0.3028. +- domain skill: Econ/Fin=0.0580, Energy=0.1590, Healthcare=0.3286, Nature=0.4018, Sales=0.3415, Transport=0.4438, Web/CloudOps=0.4980. +- frequency skill: A=0.2499, D=0.3408, H=0.3619, M=0.0606, Q=0.1682, S=0.4261, T=0.3809, W=0.1368. +- variates skill: multivariate=0.3731, univariate=0.3066. +- Outcome: Full validation skill 0.336914 versus 0.330109 without the correction, relative MASE 0.783869 and relative WQL 0.560914; zero failures. Package inference took 69.8 seconds while three trainers shared the sole H100. Selected for atomic publication. + +## E11 corpus_control_ema1000 +- Checkpoint SHA-256: `f81bf26e2a17265332fdb3b29204d140703d7c3e9d9abdd7e3297715a7b1153a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.393452167510986 seconds. +- Overall skill 0.335216; relative MASE 0.787169; relative WQL 0.561427. +- term skill: long=0.3757, medium=0.3878, short=0.2973. +- domain skill: Econ/Fin=-0.0001, Energy=0.1627, Healthcare=0.3427, Nature=0.4053, Sales=0.3297, Transport=0.4460, Web/CloudOps=0.4926. +- frequency skill: A=0.3085, D=0.3314, H=0.3702, M=0.0765, Q=0.1659, S=0.3764, T=0.3820, W=0.1191. +- variates skill: multivariate=0.3656, univariate=0.3100. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_control_ema3000 +- Checkpoint SHA-256: `c72daec0504f6082965d689dd9a9f1a7005ac0d9694fb8d4de3d2622db9d615b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.011096715927124 seconds. +- Overall skill 0.334832; relative MASE 0.787218; relative WQL 0.562040. +- term skill: long=0.3765, medium=0.3877, short=0.2963. +- domain skill: Econ/Fin=0.0014, Energy=0.1632, Healthcare=0.3213, Nature=0.4049, Sales=0.3317, Transport=0.4468, Web/CloudOps=0.4939. +- frequency skill: A=0.2922, D=0.3214, H=0.3695, M=0.0723, Q=0.1640, S=0.3781, T=0.3850, W=0.1283. +- variates skill: multivariate=0.3670, univariate=0.3081. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_control_ema6000 +- Checkpoint SHA-256: `fa23c895ff4926b3d0df6d15267718a1dda41ad9386abbfef1306becb262da1c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.355180501937866 seconds. +- Overall skill 0.334809; relative MASE 0.788444; relative WQL 0.561205. +- term skill: long=0.3770, medium=0.3879, short=0.2960. +- domain skill: Econ/Fin=-0.0139, Energy=0.1615, Healthcare=0.3361, Nature=0.4053, Sales=0.3305, Transport=0.4466, Web/CloudOps=0.4951. +- frequency skill: A=0.2945, D=0.3215, H=0.3707, M=0.0639, Q=0.1501, S=0.3778, T=0.3855, W=0.1254. +- variates skill: multivariate=0.3680, univariate=0.3071. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema1000 +- Checkpoint SHA-256: `8c0f66d7a2377fa37b4d3358c89ae9b5786a6f5f0223b1480fb7a0b20b17ebc8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.571230411529541 seconds. +- Overall skill 0.333782; relative MASE 0.789135; relative WQL 0.562448. +- term skill: long=0.3749, medium=0.3867, short=0.2955. +- domain skill: Econ/Fin=-0.0143, Energy=0.1614, Healthcare=0.3302, Nature=0.4029, Sales=0.3292, Transport=0.4472, Web/CloudOps=0.4938. +- frequency skill: A=0.2932, D=0.3308, H=0.3695, M=0.0696, Q=0.1628, S=0.3754, T=0.3818, W=0.1103. +- variates skill: multivariate=0.3653, univariate=0.3075. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema3000 +- Checkpoint SHA-256: `51586b5ce1a426dc2f3adf42aba9599b731b62ab316159dafe681e77317015a2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.598361253738403 seconds. +- Overall skill 0.333836; relative MASE 0.789352; relative WQL 0.562201. +- term skill: long=0.3750, medium=0.3869, short=0.2954. +- domain skill: Econ/Fin=-0.0087, Energy=0.1631, Healthcare=0.3250, Nature=0.4036, Sales=0.3303, Transport=0.4468, Web/CloudOps=0.4922. +- frequency skill: A=0.3132, D=0.3259, H=0.3690, M=0.0696, Q=0.1693, S=0.3752, T=0.3829, W=0.1162. +- variates skill: multivariate=0.3659, univariate=0.3071. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema6000 +- Checkpoint SHA-256: `b82b9da6afa6b7ec864a5c4f9829a2a68b29f0923d0c556a998b9d79623d9ba9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.799206972122192 seconds. +- Overall skill 0.333432; relative MASE 0.790380; relative WQL 0.562151. +- term skill: long=0.3759, medium=0.3881, short=0.2938. +- domain skill: Econ/Fin=-0.0272, Energy=0.1621, Healthcare=0.3299, Nature=0.4047, Sales=0.3298, Transport=0.4459, Web/CloudOps=0.4936. +- frequency skill: A=0.3024, D=0.3227, H=0.3691, M=0.0639, Q=0.1574, S=0.3794, T=0.3834, W=0.1166. +- variates skill: multivariate=0.3662, univariate=0.3061. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E5 direct_large_ema12000_gate +- Checkpoint SHA-256: `202e23ba9d7560bf2bd67a609d024449facabdfd338c9268bc013ff6b613168f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.02167820930481 seconds. +- Overall skill 0.314336; relative MASE 0.813757; relative WQL 0.577734. +- term skill: long=0.3670, medium=0.3868, short=0.2623. +- domain skill: Econ/Fin=-0.0160, Energy=0.1404, Healthcare=0.2477, Nature=0.3897, Sales=0.3170, Transport=0.4355, Web/CloudOps=0.4760. +- frequency skill: A=0.3627, D=0.3141, H=0.3649, M=-0.1520, Q=0.1593, S=0.3730, T=0.3518, W=0.1342. +- variates skill: multivariate=0.3564, univariate=0.2788. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema16000_gate +- Checkpoint SHA-256: `8ba1220059af5a85180b3ad740402a48b2d38172598510da796339378e529a73`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.176010131835938 seconds. +- Overall skill 0.322612; relative MASE 0.806599; relative WQL 0.568877. +- term skill: long=0.3668, medium=0.3875, short=0.2777. +- domain skill: Econ/Fin=0.0042, Energy=0.1444, Healthcare=0.3056, Nature=0.3937, Sales=0.3266, Transport=0.4361, Web/CloudOps=0.4847. +- frequency skill: A=0.3573, D=0.3049, H=0.3646, M=-0.0462, Q=0.1603, S=0.3803, T=0.3607, W=0.1797. +- variates skill: multivariate=0.3644, univariate=0.2874. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema20000_gate +- Checkpoint SHA-256: `1ec9d54fa1270442b0023da3f7fc23f5fa5291e58210a55f63878983afccc606`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.57221269607544 seconds. +- Overall skill 0.324943; relative MASE 0.805088; relative WQL 0.566028. +- term skill: long=0.3666, medium=0.3878, short=0.2821. +- domain skill: Econ/Fin=0.0218, Energy=0.1439, Healthcare=0.2912, Nature=0.4039, Sales=0.3250, Transport=0.4352, Web/CloudOps=0.4880. +- frequency skill: A=0.3533, D=0.3058, H=0.3660, M=-0.0485, Q=0.1544, S=0.3756, T=0.3665, W=0.1840. +- variates skill: multivariate=0.3678, univariate=0.2887. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema2000_gate +- Checkpoint SHA-256: `bea7fbebdc754a6cef068a4b835e644d896305e928b4a63974c731874dc49028`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.918560028076172 seconds. +- Overall skill 0.279056; relative MASE 0.848285; relative WQL 0.612718. +- term skill: long=0.3485, medium=0.3540, short=0.2185. +- domain skill: Econ/Fin=-0.0871, Energy=0.1232, Healthcare=0.1986, Nature=0.3855, Sales=0.3094, Transport=0.3731, Web/CloudOps=0.4269. +- frequency skill: A=0.3054, D=0.2729, H=0.3360, M=-0.1424, Q=0.1034, S=0.3706, T=0.2968, W=0.1303. +- variates skill: multivariate=0.3283, univariate=0.2373. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema24000_gate +- Checkpoint SHA-256: `e5bb7f70c0adbf61b4292cfc40a419e6757854a255ef0c47d3d47c7f2d68b7a2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.641167879104614 seconds. +- Overall skill 0.323234; relative MASE 0.806197; relative WQL 0.568114. +- term skill: long=0.3665, medium=0.3864, short=0.2795. +- domain skill: Econ/Fin=0.0385, Energy=0.1492, Healthcare=0.2588, Nature=0.4037, Sales=0.3217, Transport=0.4347, Web/CloudOps=0.4807. +- frequency skill: A=0.3645, D=0.3062, H=0.3653, M=-0.0563, Q=0.1548, S=0.3766, T=0.3656, W=0.1664. +- variates skill: multivariate=0.3653, univariate=0.2877. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema4000_gate +- Checkpoint SHA-256: `2f45a9ce8bed8e0e3ebe37ba98ac36ab8b9a630a615856760f46c0763fa78b5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.853939056396484 seconds. +- Overall skill 0.296679; relative MASE 0.830007; relative WQL 0.595971. +- term skill: long=0.3569, medium=0.3692, short=0.2413. +- domain skill: Econ/Fin=-0.0411, Energy=0.1331, Healthcare=0.1511, Nature=0.3889, Sales=0.3253, Transport=0.4031, Web/CloudOps=0.4590. +- frequency skill: A=0.3534, D=0.2760, H=0.3509, M=-0.1255, Q=0.1495, S=0.3734, T=0.3314, W=0.1185. +- variates skill: multivariate=0.3480, univariate=0.2530. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema8000_gate +- Checkpoint SHA-256: `1b15662821b8c7a20d973f548dacabd237f470ffd1c75457c0b92011d3f0cc88`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.06697702407837 seconds. +- Overall skill 0.310188; relative MASE 0.816631; relative WQL 0.582688. +- term skill: long=0.3619, medium=0.3788, short=0.2604. +- domain skill: Econ/Fin=-0.0143, Energy=0.1404, Healthcare=0.2015, Nature=0.3934, Sales=0.3255, Transport=0.4210, Web/CloudOps=0.4744. +- frequency skill: A=0.3680, D=0.2929, H=0.3581, M=-0.0609, Q=0.1607, S=0.3679, T=0.3513, W=0.1178. +- variates skill: multivariate=0.3533, univariate=0.2739. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step12000_gate +- Checkpoint SHA-256: `8788d76e331dcd9cca1d6dab37db34b4c8b1257fc83da49b532c11643cd0ebfa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.492464065551758 seconds. +- Overall skill 0.304901; relative MASE 0.821804; relative WQL 0.587930. +- term skill: long=0.3555, medium=0.3694, short=0.2575. +- domain skill: Econ/Fin=-0.0110, Energy=0.1063, Healthcare=0.2456, Nature=0.3830, Sales=0.2991, Transport=0.4416, Web/CloudOps=0.4763. +- frequency skill: A=0.3131, D=0.3025, H=0.3517, M=-0.0499, Q=0.1271, S=0.3821, T=0.3324, W=0.1350. +- variates skill: multivariate=0.3451, univariate=0.2712. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step16000_gate +- Checkpoint SHA-256: `beb43e784be8db8ee5ec14e83fa9c68f7ce897790441453eb6d72cceedb80650`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.434912919998169 seconds. +- Overall skill 0.311197; relative MASE 0.820659; relative WQL 0.578132. +- term skill: long=0.3577, medium=0.3731, short=0.2667. +- domain skill: Econ/Fin=-0.0270, Energy=0.1289, Healthcare=0.2653, Nature=0.3904, Sales=0.3264, Transport=0.4341, Web/CloudOps=0.4732. +- frequency skill: A=0.3445, D=0.2986, H=0.3593, M=-0.0768, Q=0.1596, S=0.3715, T=0.3463, W=0.1472. +- variates skill: multivariate=0.3513, univariate=0.2775. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step20000_gate +- Checkpoint SHA-256: `9332e5088244bd4a2a1ad5b6470a108ebaa6bc387a525202f6bf954d9796b1a6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.937657117843628 seconds. +- Overall skill 0.319529; relative MASE 0.811224; relative WQL 0.570793. +- term skill: long=0.3661, medium=0.3842, short=0.2737. +- domain skill: Econ/Fin=0.0113, Energy=0.1395, Healthcare=0.3332, Nature=0.3983, Sales=0.3058, Transport=0.4236, Web/CloudOps=0.4804. +- frequency skill: A=0.3483, D=0.3114, H=0.3599, M=-0.0666, Q=0.1435, S=0.3671, T=0.3551, W=0.1967. +- variates skill: multivariate=0.3633, univariate=0.2825. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step2000_gate +- Checkpoint SHA-256: `f16c3270e2d4adafc8dbc1416687932a81b040bed29ad21887f7f8953437ba86`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.376563549041748 seconds. +- Overall skill 0.284757; relative MASE 0.840864; relative WQL 0.608389. +- term skill: long=0.3356, medium=0.3611, short=0.2319. +- domain skill: Econ/Fin=-0.0840, Energy=0.1152, Healthcare=0.2242, Nature=0.3840, Sales=0.3264, Transport=0.3898, Web/CloudOps=0.4386. +- frequency skill: A=0.2579, D=0.2746, H=0.3418, M=-0.0497, Q=0.1253, S=0.3787, T=0.2935, W=0.1458. +- variates skill: multivariate=0.3309, univariate=0.2458. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step24000_gate +- Checkpoint SHA-256: `b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.831688165664673 seconds. +- Overall skill 0.326279; relative MASE 0.802486; relative WQL 0.565617. +- term skill: long=0.3671, medium=0.3874, short=0.2845. +- domain skill: Econ/Fin=0.0453, Energy=0.1487, Healthcare=0.3262, Nature=0.4087, Sales=0.3234, Transport=0.4251, Web/CloudOps=0.4821. +- frequency skill: A=0.3544, D=0.3106, H=0.3612, M=-0.0014, Q=0.1548, S=0.3765, T=0.3668, W=0.1910. +- variates skill: multivariate=0.3662, univariate=0.2927. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step4000_gate +- Checkpoint SHA-256: `a085c48b8bac06dba51118942d58b632dfc8fd934455232b2f1f7c7329f1ae76`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.682147979736328 seconds. +- Overall skill 0.291006; relative MASE 0.830831; relative WQL 0.605023. +- term skill: long=0.3451, medium=0.3504, short=0.2444. +- domain skill: Econ/Fin=-0.0403, Energy=0.0877, Healthcare=0.2367, Nature=0.3707, Sales=0.3185, Transport=0.4275, Web/CloudOps=0.4638. +- frequency skill: A=0.2862, D=0.2949, H=0.3327, M=-0.1134, Q=0.1567, S=0.3705, T=0.3243, W=0.1248. +- variates skill: multivariate=0.3352, univariate=0.2538. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step8000_gate +- Checkpoint SHA-256: `7c0ca8d6f3023ecefc12818560b9bac64e044102cb27d478978c48ce82276c38`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.785595417022705 seconds. +- Overall skill 0.307945; relative MASE 0.812528; relative WQL 0.589444. +- term skill: long=0.3650, medium=0.3688, short=0.2592. +- domain skill: Econ/Fin=-0.0843, Energy=0.1539, Healthcare=0.1762, Nature=0.3845, Sales=0.3220, Transport=0.4223, Web/CloudOps=0.4730. +- frequency skill: A=0.3235, D=0.2684, H=0.3578, M=-0.0688, Q=0.1156, S=0.3591, T=0.3615, W=0.1148. +- variates skill: multivariate=0.3471, univariate=0.2751. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E13/E14 matched large-model continuations +- Parent: raw E5 step 24000 (random-init pretraining here, seed 23), selected after final gated and sign-symmetric/continuity comparisons. +- Three runs share seed 43, batch 256, 6,000 steps, AdamW 8e-5 with 400-step warmup/cosine decay, the original packed sample, and the E8 median/seasonal-error-weighted objective. All use EMA. GPU: the one H100; three CPU threads per trainer. +- large_loss: unchanged synthetic generator, control for applying E8 loss to the larger model. +- large_synth: replace half of the 20% synthetic windows with newly generated integrated colored innovations, stochastic local-linear trends with level shifts, or sharp periodic pulses with slowly drifting amplitude. Generator is in large_synth/data.py; no external synthetic assets. +- large_sign: independently negate each sampled context and target with probability 0.5. Context seasonal scales are sign-invariant. Data RNG is shared with augmentation, so later draws diverge from the control despite the matched seed; this is a single-seed comparison. +- All inference rules remain fixed (sign symmetry, seasonal confidence gate and 24-step continuity). Results pending. + +## E15 final-checkpoint ensemble +- Hypothesis: the differently trained small and large models have complementary median and distribution errors. Fixed equal weights, both members forecast every instance. E8 EMA6000 (seed31 continuation of seed17) plus E5 raw24000 (seed23). Same fixed inference rules applied separately before averaging. +- Cached prediction diagnostic skill 0.344733 exceeds the small model 0.341604 and large model 0.343219. Actual bundled inference and full validation are required before publication. + +## E15 actual bundled ensemble screening +- Checkpoint SHA-256: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.611496925354004 seconds. +- Overall skill 0.344715; relative MASE 0.780210; relative WQL 0.550363. +- term skill: long=0.3780, medium=0.3928, short=0.3118. +- domain skill: Econ/Fin=0.0849, Energy=0.1725, Healthcare=0.3305, Nature=0.4119, Sales=0.3307, Transport=0.4448, Web/CloudOps=0.5036. +- frequency skill: A=0.2873, D=0.3348, H=0.3699, M=0.0563, Q=0.1938, S=0.4258, T=0.3912, W=0.1713. +- variates skill: multivariate=0.3825, univariate=0.3130. +- Outcome: Actual package inference skill 0.344715, within 0.000019 of cached averaging; zero failures. The difference comes from numerical batching. Full package inference remains required. + +## E15 bundled ensemble, full validation +- Checkpoint SHA-256: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.340239; relative MASE 0.782773; relative WQL 0.556081. +- term skill: long=0.3706, medium=0.3906, short=0.3076. +- domain skill: Econ/Fin=0.0668, Energy=0.1633, Healthcare=0.3369, Nature=0.4112, Sales=0.3436, Transport=0.4446, Web/CloudOps=0.4963. +- frequency skill: A=0.2315, D=0.3371, H=0.3638, M=0.0773, Q=0.1704, S=0.4258, T=0.3837, W=0.1660. +- variates skill: multivariate=0.3783, univariate=0.3083. +- Outcome: Full skill 0.340239, relative MASE 0.782773, relative WQL 0.556081, zero failed configurations. Improves the previous published 0.336914. Relocated package inference took 119.3 seconds while three 37M trainers shared the sole H100. Repeated example calls were bitwise identical, finite and monotone. Selected for atomic publication. + +## E16 earlier-window diagnostic +- Hypothesis: a second cutoff reveals whether gains on single-series configurations are stable over time. +- Constructed the immediately preceding nonoverlapping window from each selected validation context (never used for training). All 97 configurations remain; short histories with fewer than H+8 points are omitted. Seasonal-error scales use the available capped prefix and Seasonal Naive is recomputed on that same input, so these are diagnostic scores on a separate scale. +- The small E8 EMA6000 model improves from 0.308552 without continuity to 0.314127 with it. The large parent scores 0.312321; the first sign-augmented checkpoint scores 0.312240. Thus continuity is supported at both cutoffs, while the first sign-augmentation gain does not yet repeat on the earlier cutoff. No weights or rules are adapted on the diagnostic contexts. + +## Full-validation checkpoint identity audit +- valid-report-1000.json: `ebdd9eaa223c2bb6e38b8faec6f465a227fcd735b654a26f3b617a757addb0d3`, skill 0.206132. +- valid-report-4000-gate.json: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`, skill 0.296168. +- valid-report-swa-gate.json: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`, skill 0.315325. +- valid-report-symmetric.json: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`, skill 0.323978. +- valid-report-objective.json: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`, skill 0.330109. +- valid-report-continuity.json: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`, skill 0.336914. +- valid-report-ensemble.json: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`, skill 0.340239. + +## E13/E14 large_loss_ema1000_continuity +- Checkpoint SHA-256: `872c92ee27b0d63f310b7be7434ffe3d5342b19a42d48fefd0a468b87501b28e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.880280256271362 seconds. +- Overall skill 0.342546; relative MASE 0.782779; relative WQL 0.552194. +- term skill: long=0.3792, medium=0.3907, short=0.3082. +- domain skill: Econ/Fin=0.0879, Energy=0.1741, Healthcare=0.2781, Nature=0.4155, Sales=0.3277, Transport=0.4454, Web/CloudOps=0.5007. +- frequency skill: A=0.2788, D=0.3141, H=0.3715, M=0.0511, Q=0.1869, S=0.4248, T=0.3925, W=0.1774. +- variates skill: multivariate=0.3827, univariate=0.3087. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_loss_ema3000_continuity +- Checkpoint SHA-256: `18c2788192e4028dd45255512b1c4bcddf12a50eb813e34fa0987b8949d75f15`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.631194829940796 seconds. +- Overall skill 0.345993; relative MASE 0.778768; relative WQL 0.549233. +- term skill: long=0.3793, medium=0.3902, short=0.3147. +- domain skill: Econ/Fin=0.0850, Energy=0.1714, Healthcare=0.3423, Nature=0.4181, Sales=0.3281, Transport=0.4479, Web/CloudOps=0.5015. +- frequency skill: A=0.2956, D=0.3232, H=0.3727, M=0.0705, Q=0.1917, S=0.4274, T=0.3904, W=0.1972. +- variates skill: multivariate=0.3829, univariate=0.3150. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_loss_ema6000_continuity +- Checkpoint SHA-256: `f5c7327b365832e8bd2d1b7b01e61c334f5bf620f5cae5f4d45feef2041090e8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.797317266464233 seconds. +- Overall skill 0.346864; relative MASE 0.778052; relative WQL 0.548275. +- term skill: long=0.3803, medium=0.3907, short=0.3157. +- domain skill: Econ/Fin=0.0848, Energy=0.1765, Healthcare=0.3460, Nature=0.4171, Sales=0.3275, Transport=0.4491, Web/CloudOps=0.4990. +- frequency skill: A=0.2988, D=0.3201, H=0.3724, M=0.0715, Q=0.1909, S=0.4236, T=0.3942, W=0.2029. +- variates skill: multivariate=0.3831, univariate=0.3165. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema1000_continuity +- Checkpoint SHA-256: `393950048f9d0487869b7aa5e6bd01e7ea1715dba16b1367ee8be353eac7f408`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.772316932678223 seconds. +- Overall skill 0.347448; relative MASE 0.776694; relative WQL 0.548252. +- term skill: long=0.3829, medium=0.3908, short=0.3157. +- domain skill: Econ/Fin=0.0975, Energy=0.1743, Healthcare=0.3647, Nature=0.4116, Sales=0.3348, Transport=0.4489, Web/CloudOps=0.5001. +- frequency skill: A=0.3764, D=0.3250, H=0.3728, M=0.0605, Q=0.1918, S=0.4294, T=0.3920, W=0.1973. +- variates skill: multivariate=0.3811, univariate=0.3193. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema3000_continuity +- Checkpoint SHA-256: `24a38240b540c1311317103b880d4be47e17b7de883f535ef95977a3acc596dd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.933598279953003 seconds. +- Overall skill 0.348060; relative MASE 0.775887; relative WQL 0.547794. +- term skill: long=0.3822, medium=0.3909, short=0.3171. +- domain skill: Econ/Fin=0.1095, Energy=0.1761, Healthcare=0.3575, Nature=0.4106, Sales=0.3331, Transport=0.4503, Web/CloudOps=0.5000. +- frequency skill: A=0.3842, D=0.3252, H=0.3741, M=0.0510, Q=0.1966, S=0.4324, T=0.3901, W=0.2089. +- variates skill: multivariate=0.3815, univariate=0.3201. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema6000_continuity +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.297121286392212 seconds. +- Overall skill 0.349298; relative MASE 0.774499; relative WQL 0.546694. +- term skill: long=0.3853, medium=0.3928, short=0.3172. +- domain skill: Econ/Fin=0.1160, Energy=0.1799, Healthcare=0.3608, Nature=0.4057, Sales=0.3338, Transport=0.4511, Web/CloudOps=0.5017. +- frequency skill: A=0.3836, D=0.3247, H=0.3752, M=0.0334, Q=0.1968, S=0.4300, T=0.3937, W=0.2168. +- variates skill: multivariate=0.3827, univariate=0.3214. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema1000_continuity +- Checkpoint SHA-256: `c04fc8cad141754a2cb540b636cc3ac7744554cc85e201b4b291e777b2aee196`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.066582441329956 seconds. +- Overall skill 0.343871; relative MASE 0.781301; relative WQL 0.551010. +- term skill: long=0.3732, medium=0.3938, short=0.3118. +- domain skill: Econ/Fin=0.1001, Energy=0.1746, Healthcare=0.2638, Nature=0.4169, Sales=0.3281, Transport=0.4461, Web/CloudOps=0.5042. +- frequency skill: A=0.3050, D=0.3243, H=0.3716, M=-0.0066, Q=0.1903, S=0.4298, T=0.3943, W=0.1851. +- variates skill: multivariate=0.3847, univariate=0.3094. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema3000_continuity +- Checkpoint SHA-256: `aa73bdf3e3b2d44e69c716f2dc788789949b96d69f4cd92c2b0169bfd4dc89ce`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.854033946990967 seconds. +- Overall skill 0.343138; relative MASE 0.782085; relative WQL 0.551689. +- term skill: long=0.3690, medium=0.3946, short=0.3119. +- domain skill: Econ/Fin=0.1103, Energy=0.1771, Healthcare=0.2214, Nature=0.4199, Sales=0.3279, Transport=0.4472, Web/CloudOps=0.5016. +- frequency skill: A=0.2856, D=0.3228, H=0.3725, M=0.0162, Q=0.1940, S=0.4277, T=0.3929, W=0.1727. +- variates skill: multivariate=0.3849, univariate=0.3079. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema6000_continuity +- Checkpoint SHA-256: `f23469b8d187d0304e0accdc424ddd2233ed87dd77b97500176eec73644e0591`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.708917140960693 seconds. +- Overall skill 0.343184; relative MASE 0.781828; relative WQL 0.551793. +- term skill: long=0.3706, medium=0.3947, short=0.3112. +- domain skill: Econ/Fin=0.1127, Energy=0.1747, Healthcare=0.2160, Nature=0.4195, Sales=0.3267, Transport=0.4485, Web/CloudOps=0.5041. +- frequency skill: A=0.2764, D=0.3186, H=0.3736, M=0.0181, Q=0.1970, S=0.4302, T=0.3934, W=0.1723. +- variates skill: multivariate=0.3851, univariate=0.3077. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E16 earlier-window diagnostic large_loss6000 +- Checkpoint SHA-256: `f5c7327b365832e8bd2d1b7b01e61c334f5bf620f5cae5f4d45feef2041090e8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.924073696136475 seconds. +- Overall skill 0.311219; relative MASE 0.824887; relative WQL 0.575132. +- term skill: long=0.3825, medium=0.3465, short=0.2673. +- domain skill: Econ/Fin=0.1171, Energy=0.2168, Healthcare=0.3670, Nature=0.3256, Sales=0.3803, Transport=0.3468, Web/CloudOps=0.4260. +- frequency skill: A=0.2543, D=0.3358, H=0.3410, M=0.1505, Q=0.2187, S=0.3402, T=0.3096, W=0.2343. +- variates skill: multivariate=0.3301, univariate=0.2958. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_parent +- Checkpoint SHA-256: `b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 15.111237525939941 seconds. +- Overall skill 0.312321; relative MASE 0.824141; relative WQL 0.573812. +- term skill: long=0.3880, medium=0.3443, short=0.2678. +- domain skill: Econ/Fin=0.1255, Energy=0.2150, Healthcare=0.3460, Nature=0.3326, Sales=0.3821, Transport=0.3403, Web/CloudOps=0.4349. +- frequency skill: A=0.2124, D=0.3388, H=0.3399, M=0.1428, Q=0.2091, S=0.3387, T=0.3160, W=0.2326. +- variates skill: multivariate=0.3359, univariate=0.2930. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_sign1000 +- Checkpoint SHA-256: `393950048f9d0487869b7aa5e6bd01e7ea1715dba16b1367ee8be353eac7f408`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 14.428916931152344 seconds. +- Overall skill 0.312240; relative MASE 0.821151; relative WQL 0.576037. +- term skill: long=0.3855, medium=0.3437, short=0.2691. +- domain skill: Econ/Fin=0.1296, Energy=0.2106, Healthcare=0.3560, Nature=0.3340, Sales=0.3905, Transport=0.3466, Web/CloudOps=0.4302. +- frequency skill: A=0.3161, D=0.3390, H=0.3442, M=0.1574, Q=0.2111, S=0.3426, T=0.3054, W=0.2304. +- variates skill: multivariate=0.3287, univariate=0.2988. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_sign6000 +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.61752462387085 seconds. +- Overall skill 0.318367; relative MASE 0.813893; relative WQL 0.570866. +- term skill: long=0.3826, medium=0.3453, short=0.2811. +- domain skill: Econ/Fin=0.1456, Energy=0.2164, Healthcare=0.3902, Nature=0.3427, Sales=0.3912, Transport=0.3501, Web/CloudOps=0.4291. +- frequency skill: A=0.3181, D=0.3498, H=0.3477, M=0.1673, Q=0.2198, S=0.3427, T=0.3048, W=0.2686. +- variates skill: multivariate=0.3320, univariate=0.3073. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_synth6000 +- Checkpoint SHA-256: `f23469b8d187d0304e0accdc424ddd2233ed87dd77b97500176eec73644e0591`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.829549789428711 seconds. +- Overall skill 0.311804; relative MASE 0.824530; relative WQL 0.574404. +- term skill: long=0.3704, medium=0.3520, short=0.2715. +- domain skill: Econ/Fin=0.1602, Energy=0.2091, Healthcare=0.3496, Nature=0.3283, Sales=0.3808, Transport=0.3477, Web/CloudOps=0.4301. +- frequency skill: A=0.2270, D=0.3331, H=0.3416, M=0.1436, Q=0.2168, S=0.3434, T=0.3110, W=0.2438. +- variates skill: multivariate=0.3289, univariate=0.2979. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic small_continuity +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 12.578126668930054 seconds. +- Overall skill 0.314127; relative MASE 0.818301; relative WQL 0.574876. +- term skill: long=0.3797, medium=0.3430, short=0.2755. +- domain skill: Econ/Fin=0.1152, Energy=0.2137, Healthcare=0.3801, Nature=0.3283, Sales=0.3845, Transport=0.3460, Web/CloudOps=0.4366. +- frequency skill: A=0.2537, D=0.3362, H=0.3448, M=0.1858, Q=0.2208, S=0.3366, T=0.3083, W=0.2433. +- variates skill: multivariate=0.3331, univariate=0.2986. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic small_no_continuity +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 11.378507137298584 seconds. +- Overall skill 0.308552; relative MASE 0.826361; relative WQL 0.578561. +- term skill: long=0.3803, medium=0.3416, short=0.2654. +- domain skill: Econ/Fin=0.0571, Energy=0.2115, Healthcare=0.3152, Nature=0.3257, Sales=0.3845, Transport=0.3471, Web/CloudOps=0.4427. +- frequency skill: A=0.2363, D=0.3288, H=0.3546, M=0.1261, Q=0.1813, S=0.3403, T=0.3019, W=0.2031. +- variates skill: multivariate=0.3334, univariate=0.2881. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E14 final sign-augmented single model, full validation +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.344508; relative MASE 0.777383; relative WQL 0.552713. +- term skill: long=0.3776, medium=0.3912, short=0.3123. +- domain skill: Econ/Fin=0.0926, Energy=0.1707, Healthcare=0.3648, Nature=0.4053, Sales=0.3446, Transport=0.4514, Web/CloudOps=0.4943. +- frequency skill: A=0.2937, D=0.3275, H=0.3694, M=0.0521, Q=0.1776, S=0.4300, T=0.3859, W=0.2124. +- variates skill: multivariate=0.3784, univariate=0.3162. +- Outcome: Full skill 0.344508, relative MASE 0.777383, relative WQL 0.552713, zero failures. Outperforms the published two-model ensemble (0.340239) and also improves the earlier-cutoff diagnostic. Full inference 57.2 s. Relocated repeated example calls are bitwise deterministic, finite and monotone. Selected for atomic publication. + +## E18 remove symmetric inference after sign-augmented training +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 13.020774841308594 seconds. +- Overall skill 0.345482; relative MASE 0.778014; relative WQL 0.550625. +- term skill: long=0.3817, medium=0.3909, short=0.3125. +- domain skill: Econ/Fin=0.1197, Energy=0.1784, Healthcare=0.3304, Nature=0.4074, Sales=0.3304, Transport=0.4474, Web/CloudOps=0.4960. +- frequency skill: A=0.3782, D=0.3248, H=0.3710, M=0.0198, Q=0.1916, S=0.4321, T=0.3889, W=0.2113. +- variates skill: multivariate=0.3767, univariate=0.3195. +- Outcome: Negative result: removing the x/-x average lowers screening skill from 0.349298 to 0.345482 despite sign-augmented training. We retain symmetric inference; the speed saving is not needed for the contract budget. + +## E17 16-point projection conversion before continuation +- Checkpoint SHA-256: `d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 17.147535800933838 seconds. +- Overall skill 0.341987; relative MASE 0.782323; relative WQL 0.553456. +- term skill: long=0.3765, medium=0.3855, short=0.3105. +- domain skill: Econ/Fin=0.0851, Energy=0.1664, Healthcare=0.3542, Nature=0.4067, Sales=0.3482, Transport=0.4386, Web/CloudOps=0.4996. +- frequency skill: A=0.2894, D=0.3469, H=0.3634, M=-0.0442, Q=0.1930, S=0.4414, T=0.3853, W=0.1987. +- variates skill: multivariate=0.3808, univariate=0.3093. +- Outcome: Conversion of our own E14 EMA6000 checkpoint loses screening skill from 0.349298 to 0.341987 before updates. Input/query projection halves are folded by summation, constant-feature activation preserved, first 16 output rows retained, and physical sine positions remain in 32-point units. No external weights. Continuation is needed. + +## E17 matched patch-resolution continuation +- Hypothesis: finer patches improve short-horizon detail and align common seasonal periods more closely without shortening context. +- Control: 32-point patches, 37,002,816 parameters; treatment: 16-point patches, 36,764,960 parameters, initialized by conversion of the same owned parent E14 EMA6000. Only patch projections and positional spacing change. Physical position units remain 32 points; metadata horizon is floored at 32 to preserve short-horizon conditioning. +- Both use the same window stream: seed47, batch256, 6000steps, AdamW8e-5, same sign-augmented sampler and median/seasonal-error-weighted loss/EMA. Context remains4096, maximum output1024. One H100 shared between runs. +- Conversion code: patch16/convert.py. The converted checkpoint retains its parent hash and conversion description. Training and runtime require the model in patch16/model.py, copied to patch16_inference/model.py. Results pending final matched checkpoints. + +## E17 patch16_trial_ema1000 +- Checkpoint SHA-256: `396a7e827e8ddd068535f96f590e710f1931818c4e0b4cc589648bf68c830ba1`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.109450101852417 seconds. +- Overall skill 0.348957; relative MASE 0.771301; relative WQL 0.549536. +- term skill: long=0.3832, medium=0.3926, short=0.3175. +- domain skill: Econ/Fin=0.0969, Energy=0.1735, Healthcare=0.3953, Nature=0.4077, Sales=0.3495, Transport=0.4526, Web/CloudOps=0.4982. +- frequency skill: A=0.3699, D=0.3389, H=0.3688, M=0.0874, Q=0.1860, S=0.4381, T=0.3905, W=0.1934. +- variates skill: multivariate=0.3799, univariate=0.3232. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch16_trial_ema3000 +- Checkpoint SHA-256: `aad4bb2f079c957b1c2a064fc245e660bd9992bf0a01b57c9a48b0d33a44436e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 13.450159549713135 seconds. +- Overall skill 0.348611; relative MASE 0.772343; relative WQL 0.549378. +- term skill: long=0.3843, medium=0.3974, short=0.3144. +- domain skill: Econ/Fin=0.1014, Energy=0.1753, Healthcare=0.3863, Nature=0.4037, Sales=0.3479, Transport=0.4516, Web/CloudOps=0.4997. +- frequency skill: A=0.3647, D=0.3298, H=0.3718, M=0.0756, Q=0.1866, S=0.4393, T=0.3930, W=0.1879. +- variates skill: multivariate=0.3823, univariate=0.3204. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch16_trial_ema6000 +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.25124716758728 seconds. +- Overall skill 0.351398; relative MASE 0.770359; relative WQL 0.546090. +- term skill: long=0.3847, medium=0.3993, short=0.3185. +- domain skill: Econ/Fin=0.1048, Energy=0.1768, Healthcare=0.3969, Nature=0.4061, Sales=0.3499, Transport=0.4528, Web/CloudOps=0.5033. +- frequency skill: A=0.3673, D=0.3318, H=0.3738, M=0.0802, Q=0.1913, S=0.4391, T=0.3969, W=0.1924. +- variates skill: multivariate=0.3843, univariate=0.3240. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema1000 +- Checkpoint SHA-256: `56edd93dd7e80399be57a359574b2fb89eba843fa1ddf01f1d3f3a2d9c2fd73b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 12.499926567077637 seconds. +- Overall skill 0.347764; relative MASE 0.775926; relative WQL 0.548263. +- term skill: long=0.3840, medium=0.3930, short=0.3148. +- domain skill: Econ/Fin=0.1090, Energy=0.1783, Healthcare=0.3531, Nature=0.4057, Sales=0.3333, Transport=0.4508, Web/CloudOps=0.5005. +- frequency skill: A=0.3826, D=0.3190, H=0.3738, M=0.0404, Q=0.1937, S=0.4305, T=0.3927, W=0.2146. +- variates skill: multivariate=0.3815, univariate=0.3196. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema3000 +- Checkpoint SHA-256: `fe46ac478011854b20eeba3bbde42023f299e2d8544d223f046be0e234ae7c6e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.177376747131348 seconds. +- Overall skill 0.349507; relative MASE 0.774280; relative WQL 0.546496. +- term skill: long=0.3853, medium=0.3964, short=0.3160. +- domain skill: Econ/Fin=0.1062, Energy=0.1803, Healthcare=0.3631, Nature=0.4048, Sales=0.3322, Transport=0.4510, Web/CloudOps=0.5041. +- frequency skill: A=0.3765, D=0.3187, H=0.3755, M=0.0515, Q=0.1928, S=0.4362, T=0.3953, W=0.2095. +- variates skill: multivariate=0.3848, univariate=0.3199. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema6000 +- Checkpoint SHA-256: `3ee55007ebabdc41a5bbb6553dcd0c4b86e90b717dd1cff758d2318f538c0929`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.685351848602295 seconds. +- Overall skill 0.350171; relative MASE 0.774332; relative WQL 0.545345. +- term skill: long=0.3851, medium=0.3971, short=0.3171. +- domain skill: Econ/Fin=0.1122, Energy=0.1816, Healthcare=0.3633, Nature=0.4023, Sales=0.3323, Transport=0.4516, Web/CloudOps=0.5054. +- frequency skill: A=0.3791, D=0.3172, H=0.3768, M=0.0518, Q=0.1910, S=0.4349, T=0.3964, W=0.2119. +- variates skill: multivariate=0.3854, univariate=0.3207. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E19 prefix-consistent direct decoder +- Hypothesis: requested total horizon should not change predictions of the same first steps. The context-only probe compared H48 versus H720 after all inference rules; mean absolute median-prefix differences were 0.0059–0.0582 context standard deviations across six sampled configurations (prefix_probe.json). +- Change: future-query self-attention becomes causal and the total-horizon metadata feature is replaced by its constant training-mixture mean. Forecasts remain direct and parallel; no generated output is fed back. Encoder/cross attention and all data/loss settings stay unchanged. +- Seed47, batch256, 6000steps, same original E14 EMA6000 parent and sampled-window stream as E17 patch32_control. Reuse that completed control instead of repeating it. Only the new decoder variant trains. Runtime/model: prefix_consistent/model.py, copied into prefix_inference. +- Results pending. + +## E17 patch16, full validation +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.346729; relative MASE 0.773486; relative WQL 0.551739. +- term skill: long=0.3768, medium=0.3979, short=0.3138. +- domain skill: Econ/Fin=0.0839, Energy=0.1675, Healthcare=0.4022, Nature=0.4059, Sales=0.3593, Transport=0.4530, Web/CloudOps=0.4957. +- frequency skill: A=0.2818, D=0.3356, H=0.3684, M=0.0967, Q=0.1741, S=0.4391, T=0.3887, W=0.1870. +- variates skill: multivariate=0.3799, univariate=0.3190. +- Outcome: Full skill 0.346729, relative MASE 0.773486 and relative WQL 0.551739, zero failures; improves the previous published 0.344508. Inference 57.5 seconds. Earlier-window skill 0.322486 versus control 0.319021. Relocated repeated example outputs are bitwise identical, finite and monotone. Initial assembly failed on a symlinked lineage path, was never published, and was rebuilt after canonicalizing paths; the missing-output score from that failed pipeline is discarded. + +## E19 prefix_consistent_ema1000 +- Checkpoint SHA-256: `aa797f3356c30e1859821bd807202298774b8d44b59b8325cc73956796a83b21`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.920389413833618 seconds. +- Overall skill 0.347132; relative MASE 0.775797; relative WQL 0.549418. +- term skill: long=0.3820, medium=0.3928, short=0.3146. +- domain skill: Econ/Fin=0.1091, Energy=0.1769, Healthcare=0.3709, Nature=0.4082, Sales=0.3333, Transport=0.4492, Web/CloudOps=0.4954. +- frequency skill: A=0.3824, D=0.3200, H=0.3727, M=0.0361, Q=0.1918, S=0.4265, T=0.3902, W=0.2278. +- variates skill: multivariate=0.3798, univariate=0.3199. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E19 prefix_consistent_ema3000 +- Checkpoint SHA-256: `11094f18080cd31f38a7f33d1df852adc957d9f1705653360b21e790e55b6648`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.28545594215393 seconds. +- Overall skill 0.348148; relative MASE 0.775101; relative WQL 0.548201. +- term skill: long=0.3814, medium=0.3951, short=0.3158. +- domain skill: Econ/Fin=0.1060, Energy=0.1786, Healthcare=0.3758, Nature=0.4101, Sales=0.3323, Transport=0.4489, Web/CloudOps=0.4963. +- frequency skill: A=0.3799, D=0.3215, H=0.3735, M=0.0487, Q=0.1876, S=0.4294, T=0.3915, W=0.2202. +- variates skill: multivariate=0.3812, univariate=0.3206. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E19 prefix_consistent_ema6000 +- Checkpoint SHA-256: `2572d0401c85966c3936b3feed906dee4206ca403a778c2356406aca57988ef7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.322679996490479 seconds. +- Overall skill 0.349313; relative MASE 0.774658; relative WQL 0.546555. +- term skill: long=0.3800, medium=0.3960, short=0.3181. +- domain skill: Econ/Fin=0.1130, Energy=0.1774, Healthcare=0.3765, Nature=0.4114, Sales=0.3328, Transport=0.4502, Web/CloudOps=0.4987. +- frequency skill: A=0.3795, D=0.3224, H=0.3737, M=0.0589, Q=0.1895, S=0.4294, T=0.3930, W=0.2214. +- variates skill: multivariate=0.3825, univariate=0.3216. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E20: learned cross-variable adapter on the frozen E17 backbone +Hypothesis: a jointly trained attention layer can exploit synchronized channels, especially on multivariate energy and weather series. Only a new 1.05M-parameter axial attention adapter is optimized; every backbone weight is frozen. Adapter output starts at zero, and univariate contexts bypass it exactly. Attention is confined to the channels of one instance. Context rows are grouped by whole instance in inference. +Training: seed 53, 6,000 steps, 32 groups per batch, 2/3/4/8 variates, learning rate 2e-4 with 200-step warmup, AdamW, same median/quantile seasonal-scaled objective as E17, EMA. Joint pack has 334,868,547 aligned observations from 26 allow-listed directories. Thirty percent locally generated multivariate series use mixtures of latent seasonal/AR drivers with random channel lags, optional integrated noise, and observation noise. Channel signs/scales and missing observations are augmented. No validation observations are used by training. The new adapter is zero-initialized so step 0 supplies an inference grouping control. + +## E21: longer context at inference, without retraining +Hypothesis: the encoder can benefit from histories longer than its 4,096-point training maximum. Hold E17 weights and all rules fixed and compare 8,192/16,384-point context caps with the current 4,096-point cap on all 97 screen configurations. This is a selection diagnostic, not adaptation; checkpoint tensor values are unchanged. + +## E22: function-preserving depth expansion +Hypothesis: more learned capacity can improve the persistent energy and economic errors. Expand E17 from 6 encoder/4 decoder layers to 12 encoder/8 decoder layers, 72,499,488 parameters. Keep original blocks at even positions and insert random blocks with zero attention and feedforward output projections at odd positions. The initial enlarged model produces bitwise identical quantiles in a synthetic bf16 forward check. Conversion seed 59; both the expanded model and a continued 36.8M control will use seed 59, identical sampled windows, sign augmentation, revised seasonal-scaled median/quantile loss, and 24,000 AdamW steps, batch 256, learning rate 8e-5. Data remains packed_sample from 95 allowed sources plus the original local generator. GPU jobs share the single H100 if overlapping; elapsed training-process seconds will be reported. + +## E21 untrained 8192 context cap +- Checkpoint SHA-256: `4cdcd096105c711926d1be912debeecf2999cc4e70389385ea60e516a211d035`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.263309001922607 seconds. +- Overall skill 0.350147; relative MASE 0.769937; relative WQL 0.548498. +- term skill: long=0.3906, medium=0.3940, short=0.3160. +- domain skill: Econ/Fin=0.1042, Energy=0.1740, Healthcare=0.4046, Nature=0.3925, Sales=0.3499, Transport=0.4581, Web/CloudOps=0.5047. +- frequency skill: A=0.3673, D=0.3338, H=0.3751, M=0.0802, Q=0.1913, S=0.4410, T=0.3905, W=0.1924. +- variates skill: multivariate=0.3814, univariate=0.3241. +- Outcome: Screen skill 0.350147 is below the 4096-point parent 0.351398. Not selected. + +## E21 untrained 16384 context cap +- Checkpoint SHA-256: `a7504466f8d21bf752f3d99c32927a57cd63d0af5d5f15618ef4e8e1bdbeeb47`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.697236776351929 seconds. +- Overall skill 0.347052; relative MASE 0.771167; relative WQL 0.552852. +- term skill: long=0.3936, medium=0.3900, short=0.3107. +- domain skill: Econ/Fin=0.1042, Energy=0.1694, Healthcare=0.4046, Nature=0.3838, Sales=0.3499, Transport=0.4577, Web/CloudOps=0.5032. +- frequency skill: A=0.3673, D=0.3345, H=0.3752, M=0.0802, Q=0.1913, S=0.4410, T=0.3807, W=0.1924. +- variates skill: multivariate=0.3779, univariate=0.3214. +- Outcome: Below the 4096-point parent; longer context needs training and is not selected. + +## E23: fixed local-level diffusion prior (negative result) +Hypothesis: smooth series might benefit from a decaying blend with their last value and random-walk intervals. Keep E17 forecasts fixed, estimate RMS consecutive differences from the last 512 context points, and blend Gaussian last-value forecasts with weight capped at 0.8, active only where squared-difference/context-variance ratio is below 0.05. Sweep decay 24/96/384 steps; no training, no fitting, no new random seed. All variants substantially regress on the 97-configuration screen, so none is adopted. Probe elapsed 5.3 CPU seconds. Parent checkpoint SHA-256: 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. +- Decay 0: skill 0.3513976241007074; term skills {"short": 0.3185422008330211, "medium": 0.3993234467710519, "long": 0.38466658538687104}; domain skills {"Econ/Fin": 0.1047749678551001, "Energy": 0.17678999618615132, "Healthcare": 0.3968888878939394, "Nature": 0.4060764075001204, "Sales": 0.349917064856452, "Transport": 0.4527521728604965, "Web/CloudOps": 0.50332745421581}. +- Decay 24: skill 0.34165742688714285; term skills {"short": 0.30882663252618237, "medium": 0.38422047231265555, "long": 0.3803807240673608}; domain skills {"Econ/Fin": 0.09820862504146799, "Energy": 0.14638236482304767, "Healthcare": 0.3994101685341417, "Nature": 0.4097541459355638, "Sales": 0.34991701707454004, "Transport": 0.45281938688271317, "Web/CloudOps": 0.49437598362265067}. +- Decay 96: skill 0.3235906270632306; term skills {"short": 0.30736381494165377, "medium": 0.31870169010171356, "long": 0.3688721255257502}; domain skills {"Econ/Fin": 0.09505897302445243, "Energy": 0.1285464282539771, "Healthcare": 0.3977611664977332, "Nature": 0.41574057336372194, "Sales": 0.34991700862256025, "Transport": 0.45284743770041946, "Web/CloudOps": 0.43886394048274135}. +- Decay 384: skill 0.28712372958270105; term skills {"short": 0.30561653681994894, "medium": 0.2119589494208397, "long": 0.3091633781775974}; domain skills {"Econ/Fin": 0.09383616546291695, "Energy": 0.10801096739511007, "Healthcare": 0.3957240300486188, "Nature": 0.4179314810204363, "Sales": 0.3499170061816316, "Transport": 0.4526991548827556, "Web/CloudOps": 0.3016411139705769}. + +## E20 joint adapter full validation +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.348181; relative MASE 0.773070; relative WQL 0.549586. +- term skill: long=0.3789, medium=0.3973, short=0.3159. +- domain skill: Econ/Fin=0.0839, Energy=0.1670, Healthcare=0.4022, Nature=0.4151, Sales=0.3593, Transport=0.4530, Web/CloudOps=0.4958. +- frequency skill: A=0.2818, D=0.3370, H=0.3714, M=0.0967, Q=0.1741, S=0.4354, T=0.3901, W=0.1878. +- variates skill: multivariate=0.3830, univariate=0.3190. +- Outcome: Full validation improves from 0.346729 to 0.348181 with no failures. Main screen improves from 0.351398 to 0.352838, but the earlier-window diagnostic regresses from 0.322486 to 0.321225. Selected on the task full validation metric, with this temporal limitation recorded. Training 157.8 process seconds on the single shared H100; full inference 63.7 seconds excluding startup. Frozen backbone equality, within-instance isolation, and repeated relocated example determinism verified. + +## E20 joint adapter screen +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.721086978912354 seconds. +- Overall skill 0.352838; relative MASE 0.769945; relative WQL 0.543959. +- term skill: long=0.3868, medium=0.3987, short=0.3205. +- domain skill: Econ/Fin=0.1048, Energy=0.1763, Healthcare=0.3969, Nature=0.4152, Sales=0.3499, Transport=0.4528, Web/CloudOps=0.5034. +- frequency skill: A=0.3673, D=0.3332, H=0.3768, M=0.0802, Q=0.1913, S=0.4354, T=0.3982, W=0.1932. +- variates skill: multivariate=0.3874, univariate=0.3240. +- Outcome: The added adapter improves weather forecasts most; some ETT and cloud configurations regress. Original univariate forecasts are unchanged. + +## E20 joint adapter earlier-window diagnostic +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 16.06979727745056 seconds. +- Overall skill 0.321225; relative MASE 0.812345; relative WQL 0.567168. +- term skill: long=0.3839, medium=0.3520, short=0.2830. +- domain skill: Econ/Fin=0.1423, Energy=0.2143, Healthcare=0.3841, Nature=0.3485, Sales=0.3968, Transport=0.3596, Web/CloudOps=0.4341. +- frequency skill: A=0.3026, D=0.3536, H=0.3503, M=0.1681, Q=0.2189, S=0.3405, T=0.3157, W=0.2466. +- variates skill: multivariate=0.3338, univariate=0.3110. +- Outcome: Temporal diagnostic regression; this limits confidence in the small primary-validation gain. + +## E24: seasonal-template recency +Hypothesis: averaging the last four cycles induces bias when level or amplitude changes. Compare fixed 4/2/1-cycle means, four-cycle mean shifted to the latest cycle mean, and exponentially weighted four-cycle mean. The rest of the E17 forecaster and all confidence thresholds are fixed. Validation only; no parameter fitting. Centering improves the main screen 0.351398 to 0.353163 but decreases the earlier-window diagnostic 0.322486 to 0.321979. Other variants show larger temporal disagreement. Detailed per-configuration and group results remain in research/seasonal_recency/{screen,backcast}.json. Probe runtime: 15.3 and 15.0 CPU seconds. No variant published yet. + +## E25: learned recency features +Hypothesis: adding level and amplitude change features to future queries lets the model learn when seasonal recency matters, instead of imposing a uniform template rule. Add a zero-initialized 32,768-parameter query projection receiving, for each of the two periods, latest-cycle minus four-cycle mean and the phase template times the latest/four-cycle standard deviation ratio minus one. Ratios are clipped to [0.5,2]; features require three observed cycles. Existing query and median heads stay structurally unchanged. Starting function is preserved; all weights are then trained. Same seed 59, parent E17, 24,000-step learning-rate schedule, batch 256 and identical sampler stream as E22's 36.8M control. Checkpoints every 3,000 steps; an unpromising trial can be stopped early. No validation data is used by training. + +## E26: second earlier-cutoff diagnostic +Create a second nonoverlapping diagnostic window by removing another forecast horizon from E16 inputs. All observations remain within supplied validation histories and are never passed to trainers. 94 configurations and 8,934 instances have usable normalizers; Seasonal Naive and seasonal-error normalizers are recomputed for these prefixes. This diagnostic has its own scale and cannot be compared directly to primary validation or held-out reward. Purpose: assess temporal stability of the adapter and recency changes after the first earlier diagnostic disagreed with primary validation. + +E26 eligibility correction: SZ_TAXI long has exactly one seasonal period (96 points) left, so its prefix seasonal error is undefined. It is excluded from this diagnostic, alongside two configurations with insufficient context. An initial reference attempt detected the undefined metric; no candidate was selected on that invalid draft. + +E26 paired comparison on the 94 common configurations: adapter minus parent mean log geometric error by cutoff = [-0.0023015101916589752, 0.0019472848873323858, 0.0034041402255075566]. Positive means worse; the three-cutoff mean is 0.0010166383070603225. The adapter improves primary full validation but regresses on both earlier cutoffs, so its apparent gain is not temporally robust. + +E24 complete recency-rule ablation; parent checkpoint SHA-256 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. No training, no random seed; model weights unchanged. + +screen diagnostic, 15.3 CPU seconds total: +- (4, 'mean'): skill 0.3513976241007074; group skills {"term": {"short": 0.3185422008330211, "medium": 0.3993234467710519, "long": 0.38466658538687104}, "domain": {"Econ/Fin": 0.1047749678551001, "Energy": 0.17678999618615132, "Healthcare": 0.3968888878939394, "Nature": 0.4060764075001204, "Sales": 0.349917064856452, "Transport": 0.4527521728604965, "Web/CloudOps": 0.50332745421581}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19127390925064935, "M": 0.08024694183722458, "W-SUN": 0.035758619864346475, "D": 0.3318015817783623, "H": 0.37383534533108864, "15T": 0.1940857197364374, "W-FRI": -0.03678057554518466, "10T": 0.4946120106982924, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5069054537063827, "10S": 0.43906058031696027}} +- (2, 'mean'): skill 0.3515869592249251; group skills {"term": {"short": 0.31946055343361235, "medium": 0.395564454113736, "long": 0.3871567716641673}, "domain": {"Econ/Fin": 0.12253197026836216, "Energy": 0.18298948886090993, "Healthcare": 0.39741811166060514, "Nature": 0.40643913101885387, "Sales": 0.34900834734187824, "Transport": 0.45646747263938636, "Web/CloudOps": 0.4921796292797348}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19172301173815798, "M": 0.07891640026491331, "W-SUN": 0.04042355013060539, "D": 0.3321769544067552, "H": 0.38073675441614074, "15T": 0.20117188206554237, "W-FRI": -0.03695866316509533, "10T": 0.49452343668884957, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5070472862431538, "10S": 0.3973951356554515}} +- (1, 'mean'): skill 0.3435908999493934; group skills {"term": {"short": 0.3116909988543801, "medium": 0.38160533975903543, "long": 0.384670295110323}, "domain": {"Econ/Fin": 0.13426770743669836, "Energy": 0.18216526583305703, "Healthcare": 0.40167072012279914, "Nature": 0.4064404130881688, "Sales": 0.3492754711813856, "Transport": 0.4589127441324581, "Web/CloudOps": 0.45693278131755455}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19143020771042418, "M": 0.08285832779020297, "W-SUN": 0.04327272071755062, "D": 0.33288417189993846, "H": 0.38267829909706397, "15T": 0.19937252608994493, "W-FRI": -0.037004579119138015, "10T": 0.4945270610078465, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067187989779461, "10S": 0.25271387987938276}} +- (4, 'centered'): skill 0.3531633226160329; group skills {"term": {"short": 0.3207293873053654, "medium": 0.3969450585806461, "long": 0.38964518179731034}, "domain": {"Econ/Fin": 0.12636396756466373, "Energy": 0.1800705780909143, "Healthcare": 0.3992839589819721, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45585497734478375, "Web/CloudOps": 0.5005422814848317}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19175192579993316, "M": 0.07909511983098594, "W-SUN": 0.042408325150654624, "D": 0.33302767036606196, "H": 0.37896395394765425, "15T": 0.19862358212653608, "W-FRI": -0.03667482636982777, "10T": 0.49458872561779677, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067600572208003, "10S": 0.43120160792893125}} +- (4, 'exponential'): skill 0.3506285650976836; group skills {"term": {"short": 0.31758444696147214, "medium": 0.39583120771209657, "long": 0.38712405721550214}, "domain": {"Econ/Fin": 0.11941316839573946, "Energy": 0.1820733009344513, "Healthcare": 0.39881728965443064, "Nature": 0.4063573767251085, "Sales": 0.3492900874450249, "Transport": 0.45600364485060096, "Web/CloudOps": 0.4900268042948257}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19155754727480623, "M": 0.08126365276376935, "W-SUN": 0.0395554234837493, "D": 0.3321922474298862, "H": 0.3798686284876259, "15T": 0.19972610305133176, "W-FRI": -0.036894372612062964, "10T": 0.49455551047271673, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.507021365412977, "10S": 0.38828731350299905}} + +backcast diagnostic, 15.0 CPU seconds total: +- (4, 'mean'): skill 0.3224855500998881; group skills {"term": {"short": 0.2849500928667269, "medium": 0.35106641415497664, "long": 0.3858074289185036}, "domain": {"Econ/Fin": 0.14231294402320693, "Energy": 0.22033739564654398, "Healthcare": 0.38413791496286065, "Nature": 0.34419561689971845, "Sales": 0.3968014140531252, "Transport": 0.35961999575754544, "Web/CloudOps": 0.43501924471773445}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21891811984740894, "M": 0.16812726492063224, "W-SUN": -0.010729530876487425, "D": 0.35222355718445886, "H": 0.3519096502404674, "15T": 0.2228803711964017, "W-FRI": 0.24958026063282224, "10T": 0.28160966000223076, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41752089397176684, "10S": 0.3420520567149261}} +- (2, 'mean'): skill 0.31641087380554034; group skills {"term": {"short": 0.2768742380592605, "medium": 0.34943272384716806, "long": 0.38006754913357355}, "domain": {"Econ/Fin": 0.1588024863579226, "Energy": 0.21997369353201524, "Healthcare": 0.371350308865825, "Nature": 0.34524192786763674, "Sales": 0.3968014140531252, "Transport": 0.3617399277122316, "Web/CloudOps": 0.4078808317401613}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21832950345882607, "M": 0.1660037727174999, "W-SUN": -0.006617407115359519, "D": 0.3510532765644364, "H": 0.35322947177285846, "15T": 0.2251426669096147, "W-FRI": 0.2495544318494044, "10T": 0.28154255982923526, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.417584870977882, "10S": 0.23197125321775225}} +- (1, 'mean'): skill 0.31723500000228033; group skills {"term": {"short": 0.28111182113787236, "medium": 0.34369676593720844, "long": 0.3794207668157681}, "domain": {"Econ/Fin": 0.16484876593565279, "Energy": 0.2163334841815111, "Healthcare": 0.34937996041769215, "Nature": 0.3461425603980003, "Sales": 0.3968014140531252, "Transport": 0.36432827783243815, "Web/CloudOps": 0.4170717985814322}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21811526606513132, "M": 0.17155750755784438, "W-SUN": -0.004083126467642861, "D": 0.34319459279654896, "H": 0.35193709208671076, "15T": 0.22385514627514524, "W-FRI": 0.249535867076202, "10T": 0.28142605167103807, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41764726501313276, "10S": 0.27470089184112967}} +- (4, 'centered'): skill 0.3219793532222529; group skills {"term": {"short": 0.28513766744425706, "medium": 0.34881946541915476, "long": 0.3853894132385529}, "domain": {"Econ/Fin": 0.15718749322076342, "Energy": 0.220305778786681, "Healthcare": 0.3623301744180454, "Nature": 0.34528108993797224, "Sales": 0.3968014140531252, "Transport": 0.3641900819387449, "Web/CloudOps": 0.4312095523303556}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21945119732749618, "M": 0.17114892410654747, "W-SUN": -0.005425657907346837, "D": 0.3478712397506638, "H": 0.3538545808265424, "15T": 0.22504062323947938, "W-FRI": 0.24955455634324242, "10T": 0.28170410454547445, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176757195719526, "10S": 0.32801909847059685}} +- (4, 'exponential'): skill 0.3212088988374776; group skills {"term": {"short": 0.282531844032045, "medium": 0.3501930275891618, "long": 0.386723067036399}, "domain": {"Econ/Fin": 0.15471014663681715, "Energy": 0.22088089450488246, "Healthcare": 0.3714910427574707, "Nature": 0.3450102784118355, "Sales": 0.3968014140531252, "Transport": 0.3619509561390626, "Web/CloudOps": 0.4275124121699033}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21855293965122158, "M": 0.16975398671452624, "W-SUN": -0.007489648663621784, "D": 0.3494275697398366, "H": 0.3534238823299253, "15T": 0.22624199923728783, "W-FRI": 0.24956090397954467, "10T": 0.28154140034619046, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176567607348064, "10S": 0.31322950674661665}} + +backcast2 diagnostic, 11.3 CPU seconds total: +- (4, 'mean'): skill 0.3455098962011296; group skills {"term": {"short": 0.3290580626564209, "medium": 0.3700339540817553, "long": 0.36380280474970406}, "domain": {"Econ/Fin": 0.08514981056677962, "Energy": 0.22004402556428637, "Healthcare": 0.34077993948093876, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.4089471064366391, "Web/CloudOps": 0.4235634025112891}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14846418792970395, "M": 0.1666731962215917, "W-SUN": 0.04822698344798482, "D": 0.4221052975732391, "H": 0.37954447462865715, "15T": 0.09066258444282005, "W-FRI": 0.10650868616967224, "10T": 0.4524242293365175, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45460956828782484, "10S": 0.2830610169711695}} +- (2, 'mean'): skill 0.34268288377692957; group skills {"term": {"short": 0.3260103214844039, "medium": 0.3650713522346687, "long": 0.36394907927583375}, "domain": {"Econ/Fin": 0.10626345560515471, "Energy": 0.21855508043330296, "Healthcare": 0.33494058443346464, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41262361590216645, "Web/CloudOps": 0.40733619806789245}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14853117890045908, "M": 0.15637649692786237, "W-SUN": 0.05109649829750129, "D": 0.4226979938774772, "H": 0.3810140667041473, "15T": 0.10084524164002151, "W-FRI": 0.10650868616967224, "10T": 0.4522402959584214, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45675628129488266, "10S": 0.20569731261667445}} +- (1, 'mean'): skill 0.3445039461555758; group skills {"term": {"short": 0.332077466515454, "medium": 0.3668808106296455, "long": 0.3542531601492346}, "domain": {"Econ/Fin": 0.10936035558443968, "Energy": 0.21764038800605967, "Healthcare": 0.3307656098951277, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41137296882664487, "Web/CloudOps": 0.4178001938815905}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14899214852623166, "M": 0.14771341656467907, "W-SUN": 0.05292218751297184, "D": 0.42303155789223856, "H": 0.3788342098211268, "15T": 0.10485120143271387, "W-FRI": 0.10650868616967224, "10T": 0.45177551404888616, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4576208051300459, "10S": 0.24855961647506852}} +- (4, 'centered'): skill 0.34598093527842033; group skills {"term": {"short": 0.3300325159298324, "medium": 0.3728154676891604, "long": 0.3603198134443867}, "domain": {"Econ/Fin": 0.10766883532595528, "Energy": 0.21948028584715717, "Healthcare": 0.3411805258187349, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41219265214646406, "Web/CloudOps": 0.4193348965687418}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14770244416717793, "M": 0.16665926477245963, "W-SUN": 0.05081321100071179, "D": 0.4226895384052014, "H": 0.3801908053318377, "15T": 0.10067740700220107, "W-FRI": 0.10650868616967224, "10T": 0.45281662963561176, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4517952090885672, "10S": 0.27767832330559383}} +- (4, 'exponential'): skill 0.3469706591030196; group skills {"term": {"short": 0.330791312305022, "medium": 0.3720978115862891, "long": 0.36385111952680094}, "domain": {"Econ/Fin": 0.1001234277395946, "Energy": 0.2202025077634595, "Healthcare": 0.336380045647639, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41155494383831315, "Web/CloudOps": 0.4258605737282435}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.1486686416475177, "M": 0.15834250660686766, "W-SUN": 0.05058427650785369, "D": 0.42264469285933903, "H": 0.38114337578655855, "15T": 0.10061532381315941, "W-FRI": 0.10650868616967224, "10T": 0.4522176935148189, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45594734272112136, "10S": 0.2839470264038111}} + +Centered four-cycle templates improve primary full validation and the second earlier diagnostic, while slightly reducing the first earlier diagnostic. They replace the joint adapter package: full validation 0.348797 versus adapter 0.348181, with better temporal stability. The joint adapter remains an archived experiment after worsening on both earlier cutoffs. + +## E24 centered seasonal template full validation +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.348797; relative MASE 0.771273; relative WQL 0.549826. +- term skill: long=0.3827, medium=0.3957, short=0.3161. +- domain skill: Econ/Fin=0.1051, Energy=0.1719, Healthcare=0.4042, Nature=0.4059, Sales=0.3592, Transport=0.4561, Web/CloudOps=0.4931. +- frequency skill: A=0.2818, D=0.3368, H=0.3739, M=0.0954, Q=0.1765, S=0.4312, T=0.3905, W=0.1880. +- variates skill: multivariate=0.3783, univariate=0.3243. +- Outcome: Published. Same 36,764,960 learned parameters as E17; fixed seasonal template now preserves four-cycle shape while aligning its mean to the latest cycle. Full validation 0.348797 with zero failures; screen 0.353163; earlier diagnostics 0.321979 and 0.345981. Full inference 79.6 seconds while three training processes shared the one H100. Repeated relocated examples bitwise identical, finite, monotone. + +## E27: quantile width calibration diagnostic +Hypothesis: the changed training objective and sign-averaged forecasts may change interval calibration relative to the early E3 width sweep. Hold current E24 medians fixed and compare global width multipliers 0.75, 1.0 and 1.25, preserving positivity and monotone deciles. No training or new random seed. Evaluate primary full validation and both earlier diagnostics; retain the same multiplier for every instance and horizon if adopted. Record per-configuration decile coverage to distinguish interval calibration from point-forecast errors. + +## E28: stronger seasonal-error scaling in the training loss +Hypothesis: the existing floor 0.25 and maximum weight 4 underweight highly predictable series, whose small seasonal-error denominators make small biases costly in MASE. Change only this loss factor to floor 0.05 and maximum weight 20. The weight is derived from training contexts only; no validation observations enter gradients. Same E17 parent, seed 59, batch 256, sampled windows, 8e-5 learning rate and 24,000-step schedule as E22 control. Assess at 3,000 and 6,000 steps before deciding whether to continue. No architecture or inference changes. All training processes use the same single H100. + +E27 completed: global interval-width calibration is unchanged. The 1.0 multiplier wins on all three cutoffs; 0.75 and 1.25 are rejected. Parent checkpoint SHA-256: 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. + +full, 21.961196422576904 CPU seconds: +- Width 0.75: skill 0.3452164549545038; group skills {"term": {"short": 0.313465550024141, "medium": 0.3915340298847654, "long": 0.37755696642578507}, "domain": {"Econ/Fin": 0.10580171688867446, "Energy": 0.16637482564763484, "Healthcare": 0.40914268073244664, "Nature": 0.4019524649941506, "Sales": 0.3530144630644825, "Transport": 0.4556672339606386, "Web/CloudOps": 0.4876214368641769}, "freq": {"A-DEC": 0.28725493449470174, "Q-DEC": 0.1801084712445944, "M": 0.11175276948966328, "W-SUN": 0.0323370845377442, "D": 0.3312199981338694, "H": 0.3695069715804825, "15T": 0.18168253390246492, "W-FRI": -0.056487631535321325, "10T": 0.49352637886384465, "W-TUE": 0.5378585205934543, "W-THU": 0.18433827097062172, "W-WED": 0.31349093490925006, "5T": 0.49222999321979144, "10S": 0.42390324244202104}} +- Width 1.0: skill 0.3487966789303172; group skills {"term": {"short": 0.3161336626027256, "medium": 0.3956796502512826, "long": 0.38269594016340247}, "domain": {"Econ/Fin": 0.10510484967413847, "Energy": 0.171919600185363, "Healthcare": 0.4042072222593659, "Nature": 0.40589812140398485, "Sales": 0.3591878025853771, "Transport": 0.4560779320618533, "Web/CloudOps": 0.4931146707071308}, "freq": {"A-DEC": 0.2818339423423022, "Q-DEC": 0.17653014662394806, "M": 0.09542703722254098, "W-SUN": 0.028486795465021086, "D": 0.336759380183841, "H": 0.3739148859162613, "15T": 0.18778774397400844, "W-FRI": -0.055524607369072276, "10T": 0.49458872561912703, "W-TUE": 0.552193186183172, "W-THU": 0.16944597281618878, "W-WED": 0.3192454710115562, "5T": 0.4977061545271937, "10S": 0.431201607928979}} +- Width 1.25: skill 0.34610650213535965; group skills {"term": {"short": 0.31181715347067873, "medium": 0.39425414652966917, "long": 0.3825681229603841}, "domain": {"Econ/Fin": 0.09501414185590251, "Energy": 0.17012785606235192, "Healthcare": 0.3929707629727902, "Nature": 0.4039288459201795, "Sales": 0.3578978997303499, "Transport": 0.4512528387663022, "Web/CloudOps": 0.49362461046923467}, "freq": {"A-DEC": 0.2690929347470029, "Q-DEC": 0.16432266959209074, "M": 0.07072014222773326, "W-SUN": 0.01173769854460438, "D": 0.3347121204957273, "H": 0.37299271990393135, "15T": 0.18526873151735845, "W-FRI": -0.07163417179692866, "10T": 0.49168735086319126, "W-TUE": 0.562370097705067, "W-THU": 0.14458649403408286, "W-WED": 0.32018515385552937, "5T": 0.4992200637780666, "10S": 0.43174911263031324}} + +backcast, 8.311058759689331 CPU seconds: +- Width 0.75: skill 0.31957721298205577; group skills {"term": {"short": 0.2849135227503923, "medium": 0.3430617259135954, "long": 0.3812505435660858}, "domain": {"Econ/Fin": 0.16020201234615272, "Energy": 0.21754177729190793, "Healthcare": 0.3694068614617043, "Nature": 0.3429441402339167, "Sales": 0.39134717268523767, "Transport": 0.36216325202164235, "Web/CloudOps": 0.42635659392097536}, "freq": {"A-DEC": 0.3052930254291859, "Q-DEC": 0.22988988761857532, "M": 0.17459013453754524, "W-SUN": 0.007398260950902569, "D": 0.3450062706602839, "H": 0.3480315684129901, "15T": 0.22233620685464417, "W-FRI": 0.30096387619142784, "10T": 0.27185481492835484, "W-TUE": 0.5329255178801061, "W-THU": 0.18370602390723068, "W-WED": 0.33814381573585706, "5T": 0.40916267988319677, "10S": 0.3313031636056427}} +- Width 1.0: skill 0.3219793532184254; group skills {"term": {"short": 0.28513766744059266, "medium": 0.34881946541549136, "long": 0.3853894132342357}, "domain": {"Econ/Fin": 0.15718749322715975, "Energy": 0.22030577879293345, "Healthcare": 0.3623301744205766, "Nature": 0.34528108990726747, "Sales": 0.39680141405427904, "Transport": 0.36419008193684854, "Web/CloudOps": 0.431209552326686}, "freq": {"A-DEC": 0.30258726544387415, "Q-DEC": 0.2194511972962907, "M": 0.1711489239900802, "W-SUN": -0.005425657920283156, "D": 0.3478712397620801, "H": 0.35385458082566135, "15T": 0.22504062321275653, "W-FRI": 0.24955455634173984, "10T": 0.2817041045341433, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316324492524, "W-WED": 0.3400228795175667, "5T": 0.41767571957575267, "10S": 0.32801909847013033}} +- Width 1.25: skill 0.31790201775956073; group skills {"term": {"short": 0.2784084543186459, "medium": 0.34919365386981416, "long": 0.38309258280714664}, "domain": {"Econ/Fin": 0.14485063305112178, "Energy": 0.2160406174537144, "Healthcare": 0.34843021568184673, "Nature": 0.3414042631923321, "Sales": 0.3949701602051685, "Transport": 0.36064559654919026, "Web/CloudOps": 0.43041506837139865}, "freq": {"A-DEC": 0.289217486212048, "Q-DEC": 0.20086669955100855, "M": 0.15692994437261798, "W-SUN": -0.02840754711998872, "D": 0.34384490006115054, "H": 0.35403896763656184, "15T": 0.21854779190662021, "W-FRI": 0.19508006514698906, "10T": 0.2864956555409153, "W-TUE": 0.4740288982750931, "W-THU": 0.15896541765809558, "W-WED": 0.3390816757566152, "5T": 0.42177642249121394, "10S": 0.3165112734495428}} + +backcast2, 8.009549379348755 CPU seconds: +- Width 0.75: skill 0.34409820450993134; group skills {"term": {"short": 0.3290162458924437, "medium": 0.3688383955368778, "long": 0.3584446274583232}, "domain": {"Econ/Fin": 0.1059670159637679, "Energy": 0.2168683811981844, "Healthcare": 0.3413880194250112, "Nature": 0.45062953387079285, "Sales": 0.5547232267111362, "Transport": 0.4100430663915112, "Web/CloudOps": 0.41729590695067253}, "freq": {"A-DEC": 0.34005157942217423, "Q-DEC": 0.1412869592685284, "M": 0.16881189749680703, "W-SUN": 0.047625092062016594, "D": 0.4231522928214516, "H": 0.37698957063440086, "15T": 0.0904235813541534, "W-FRI": 0.11812283700385673, "10T": 0.44881967454327965, "W-TUE": 0.07442882063540968, "W-THU": 0.2788710322691663, "W-WED": 0.5437864115591705, "5T": 0.444848784038935, "10S": 0.2913075712082248}} +- Width 1.0: skill 0.34598093529199403; group skills {"term": {"short": 0.33003251595401095, "medium": 0.3728154676872124, "long": 0.3603198134466531}, "domain": {"Econ/Fin": 0.10766883533558247, "Energy": 0.2194802858514432, "Healthcare": 0.34118052581938385, "Nature": 0.4518189405691444, "Sales": 0.5552026877071643, "Transport": 0.4121926521487488, "Web/CloudOps": 0.41933489656663536}, "freq": {"A-DEC": 0.33512027884784024, "Q-DEC": 0.14770244414049571, "M": 0.16665926486843274, "W-SUN": 0.05081321100210512, "D": 0.42268953844805357, "H": 0.3801908053296258, "15T": 0.10067740700216166, "W-FRI": 0.10650868616810949, "10T": 0.45281662963431724, "W-TUE": 0.0831470254212826, "W-THU": 0.2681259389949434, "W-WED": 0.5394413576971099, "5T": 0.45179520908580906, "10S": 0.2776783233055614}} +- Width 1.25: skill 0.3413902485820186; group skills {"term": {"short": 0.32419069585401805, "medium": 0.37023913422459476, "long": 0.35685627734091574}, "domain": {"Econ/Fin": 0.09962820431101826, "Energy": 0.21472017584206793, "Healthcare": 0.3337184668053308, "Nature": 0.44788650255350915, "Sales": 0.5519703061689909, "Transport": 0.4091113202517557, "Web/CloudOps": 0.41471225075769447}, "freq": {"A-DEC": 0.3220090566072281, "Q-DEC": 0.14689640454759956, "M": 0.15748943073554222, "W-SUN": 0.043428818988100804, "D": 0.4159786673838306, "H": 0.3773278172245832, "15T": 0.1020767647441726, "W-FRI": 0.08603022609757915, "10T": 0.45227993224331775, "W-TUE": 0.07815927778447074, "W-THU": 0.25035502046342106, "W-WED": 0.53163473233605, "5T": 0.4537783408350755, "10S": 0.2545513618912605}} + +Decile coverage uses <=, so ties at zero contribute excess lower-tail coverage on intermittent nonnegative series. Coverage alone is not evidence for changing intervals; the proper quantile loss favors the existing widths. + +## E22 control 3000-step checkpoint +- Checkpoint SHA-256: `8fcb7dd923c415a0a93261be09f4b29a73674bc6188f33afb50130d615643715`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 16.52501678466797 seconds. +- Overall skill 0.350784; relative MASE 0.771331; relative WQL 0.546434. +- term skill: long=0.3855, medium=0.3992, short=0.3171. +- domain skill: Econ/Fin=0.1025, Energy=0.1770, Healthcare=0.3901, Nature=0.4076, Sales=0.3484, Transport=0.4531, Web/CloudOps=0.5016. +- frequency skill: A=0.3699, D=0.3270, H=0.3752, M=0.0777, Q=0.1894, S=0.4382, T=0.3953, W=0.1970. +- variates skill: multivariate=0.3839, univariate=0.3232. +- Outcome: Matched continuation control; primary screen 0.350784. Continuing training. + +## E22 control 6000-step checkpoint +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.943427324295044 seconds. +- Overall skill 0.352399; relative MASE 0.769997; relative WQL 0.544661. +- term skill: long=0.3861, medium=0.4001, short=0.3195. +- domain skill: Econ/Fin=0.1064, Energy=0.1818, Healthcare=0.3888, Nature=0.4095, Sales=0.3482, Transport=0.4533, Web/CloudOps=0.5013. +- frequency skill: A=0.3691, D=0.3297, H=0.3767, M=0.0899, Q=0.1951, S=0.4372, T=0.3967, W=0.1945. +- variates skill: multivariate=0.3861, univariate=0.3242. +- Outcome: Screen 0.352399; 869.5 elapsed training-process seconds through this checkpoint on shared single H100. Continuing training. + +## E22 expanded depth 3000-step checkpoint +- Checkpoint SHA-256: `606808eaa8f41a4d8ffd7a336639c197cdb656b462d7b74cda0425a9c7b7ab88`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.74061632156372 seconds. +- Overall skill 0.349903; relative MASE 0.771470; relative WQL 0.547820. +- term skill: long=0.3846, medium=0.3995, short=0.3157. +- domain skill: Econ/Fin=0.1036, Energy=0.1753, Healthcare=0.3821, Nature=0.4103, Sales=0.3478, Transport=0.4524, Web/CloudOps=0.5003. +- frequency skill: A=0.3697, D=0.3271, H=0.3737, M=0.0851, Q=0.1912, S=0.4378, T=0.3939, W=0.1942. +- variates skill: multivariate=0.3823, univariate=0.3229. +- Outcome: Screen 0.349903 versus matched control 0.350784. 768.0 elapsed training-process seconds. Continuing to assess a longer run. + +## E25 learned recency 3000-step checkpoint +- Checkpoint SHA-256: `ff6465dac03192cfc5f8837d8c6ab9524b0fb81c1a73867ff6e08aaf83a53398`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.54782772064209 seconds. +- Overall skill 0.351702; relative MASE 0.770454; relative WQL 0.545509. +- term skill: long=0.3852, medium=0.3988, short=0.3191. +- domain skill: Econ/Fin=0.1014, Energy=0.1767, Healthcare=0.4078, Nature=0.4093, Sales=0.3476, Transport=0.4541, Web/CloudOps=0.5002. +- frequency skill: A=0.3707, D=0.3341, H=0.3745, M=0.0812, Q=0.1898, S=0.4360, T=0.3954, W=0.1980. +- variates skill: multivariate=0.3834, univariate=0.3253. +- Outcome: Screen 0.351702 versus matched control 0.350784. 510.3 elapsed training-process seconds. This is a modest early improvement; further checkpoints and temporal diagnostics remain. + +## E22 control 6000 with centered seasonal template, full validation +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.349953; relative MASE 0.770650; relative WQL 0.548317. +- term skill: long=0.3842, medium=0.3966, short=0.3172. +- domain skill: Econ/Fin=0.1065, Energy=0.1770, Healthcare=0.3987, Nature=0.4093, Sales=0.3570, Transport=0.4567, Web/CloudOps=0.4912. +- frequency skill: A=0.2855, D=0.3349, H=0.3766, M=0.1068, Q=0.1785, S=0.4296, T=0.3905, W=0.1906. +- variates skill: multivariate=0.3802, univariate=0.3248. +- Outcome: Published: full validation 0.349953 versus previous 0.348797, with zero failures. Earlier diagnostics improve to 0.322147 and 0.348634 from 0.321979 and 0.345981. Full inference took 98.8 seconds while four training processes shared the one H100. Repeated relocated example checks passed. Training continues beyond this milestone. + +## E22 control 6000 centered, earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.958669662475586 seconds. +- Overall skill 0.322147; relative MASE 0.812166; relative WQL 0.565752. +- term skill: long=0.3872, medium=0.3503, short=0.2840. +- domain skill: Econ/Fin=0.1531, Energy=0.2205, Healthcare=0.3579, Nature=0.3475, Sales=0.3966, Transport=0.3647, Web/CloudOps=0.4317. +- frequency skill: A=0.3153, D=0.3426, H=0.3545, M=0.1663, Q=0.2129, S=0.3286, T=0.3204, W=0.2542. +- variates skill: multivariate=0.3358, univariate=0.3111. +- Outcome: Small improvement over the preceding package. + +## E22 control 6000 centered, second earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.61665678024292 seconds. +- Overall skill 0.348634; relative MASE 0.779607; relative WQL 0.544220. +- term skill: long=0.3637, medium=0.3753, short=0.3325. +- domain skill: Econ/Fin=0.1024, Energy=0.2199, Healthcare=0.3508, Nature=0.4590, Sales=0.5576, Transport=0.4153, Web/CloudOps=0.4205. +- frequency skill: A=0.3380, D=0.4233, H=0.3833, M=0.1690, Q=0.1387, S=0.2800, T=0.3398, W=0.2426. +- variates skill: multivariate=0.3512, univariate=0.3465. +- Outcome: Improvement over the preceding package. + +## E29: coarse memory of older context (prepared) +Hypothesis: a separately trained memory can extract useful information from points 4,097–16,384 without changing the frozen backbone’s treatment of its recent 4,096 points. Older observations are normalized using the recent window and averaged in groups of four, then encoded by two extra blocks. A zero-output cross-attention projection adds this memory to recent encoder states. Initial function is preserved; recent seasonal and continuity rules remain unchanged. The added embedding and two encoder blocks start from copies of our own trained weights, and the cross-attention output starts at zero. No external weights. Total 44,401,952 parameters; 7,636,992 trainable. Eight-step batch-16 smoke run on allowed packed_sample with seed 67 produced finite weights and updated only the history module. Full training has not started. + +## E30: seasonal amplitude alignment +Hypothesis: four-cycle shape averaging also lags changes in seasonal amplitude. Starting from E24 centered templates, scale their deviations around the mean to the latest cycle standard deviation, correcting both variance estimates for observation noise inferred from seasonal differences. Scale ratio is clipped to [0.5,2], and amplitude alignment requires at least 75% finite observations in the latest cycle. All thresholds, intervals, learned weights and confidence gates remain fixed. Compare centered versus aligned templates on three diagnostic cutoffs using cached E17 raw forecasts; no training or new random seed. + +E30 initial amplitude-alignment results, parent checkpoint SHA-256 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3: + +screen, 7.7 CPU seconds total: +- (4, 'centered'): skill 0.3531633226160329; group skills {"term": {"short": 0.3207293873053654, "medium": 0.3969450585806461, "long": 0.38964518179731034}, "domain": {"Econ/Fin": 0.12636396756466373, "Energy": 0.1800705780909143, "Healthcare": 0.3992839589819721, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45585497734478375, "Web/CloudOps": 0.5005422814848317}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19175192579993316, "M": 0.07909511983098594, "W-SUN": 0.042408325150654624, "D": 0.33302767036606196, "H": 0.37896395394765425, "15T": 0.19862358212653608, "W-FRI": -0.03667482636982777, "10T": 0.49458872561779677, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067600572208003, "10S": 0.43120160792893125}} +- (4, 'aligned'): skill 0.35398462796791796; group skills {"term": {"short": 0.3217411363550048, "medium": 0.39832598201137914, "long": 0.3894451118078128}, "domain": {"Econ/Fin": 0.128986533479437, "Energy": 0.1846259909517678, "Healthcare": 0.3989632452392111, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45834957050423264, "Web/CloudOps": 0.4970505147956361}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.1913923357266032, "M": 0.07925704481777684, "W-SUN": 0.04248196090218248, "D": 0.332866037279251, "H": 0.38330094783509405, "15T": 0.20143473054459382, "W-FRI": -0.036466297970424444, "10T": 0.49454418004359824, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.506404214769247, "10S": 0.4192979394083295}} + +backcast, 8.3 CPU seconds total: +- (4, 'centered'): skill 0.3219793532222529; group skills {"term": {"short": 0.28513766744425706, "medium": 0.34881946541915476, "long": 0.3853894132385529}, "domain": {"Econ/Fin": 0.15718749322076342, "Energy": 0.220305778786681, "Healthcare": 0.3623301744180454, "Nature": 0.34528108993797224, "Sales": 0.3968014140531252, "Transport": 0.3641900819387449, "Web/CloudOps": 0.4312095523303556}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21945119732749618, "M": 0.17114892410654747, "W-SUN": -0.005425657907346837, "D": 0.3478712397506638, "H": 0.3538545808265424, "15T": 0.22504062323947938, "W-FRI": 0.24955455634324242, "10T": 0.28170410454547445, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176757195719526, "10S": 0.32801909847059685}} +- (4, 'aligned'): skill 0.32199923078598136; group skills {"term": {"short": 0.2839405542344856, "medium": 0.34882959423473925, "long": 0.38815021409803896}, "domain": {"Econ/Fin": 0.15740802100053652, "Energy": 0.21807242823144724, "Healthcare": 0.36213507616373974, "Nature": 0.3461350653810715, "Sales": 0.3968014140531252, "Transport": 0.3649195243648111, "Web/CloudOps": 0.4328434979914423}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.2183391142623865, "M": 0.1754893176389558, "W-SUN": -0.004377726385369485, "D": 0.3466775300728464, "H": 0.3524837610290207, "15T": 0.2254592175464284, "W-FRI": 0.24954835437149747, "10T": 0.2817431568124176, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41754999889925704, "10S": 0.3353593007357636}} + +backcast2, 9.4 CPU seconds total: +- (4, 'centered'): skill 0.34598093527842033; group skills {"term": {"short": 0.3300325159298324, "medium": 0.3728154676891604, "long": 0.3603198134443867}, "domain": {"Econ/Fin": 0.10766883532595528, "Energy": 0.21948028584715717, "Healthcare": 0.3411805258187349, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41219265214646406, "Web/CloudOps": 0.4193348965687418}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14770244416717793, "M": 0.16665926477245963, "W-SUN": 0.05081321100071179, "D": 0.4226895384052014, "H": 0.3801908053318377, "15T": 0.10067740700220107, "W-FRI": 0.10650868616967224, "10T": 0.45281662963561176, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4517952090885672, "10S": 0.27767832330559383}} +- (4, 'aligned'): skill 0.3467340001955017; group skills {"term": {"short": 0.3300823793890595, "medium": 0.3753689052243039, "long": 0.36094597324048516}, "domain": {"Econ/Fin": 0.10766542601267182, "Energy": 0.22063331078456605, "Healthcare": 0.33410091914860696, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.4141243473009397, "Web/CloudOps": 0.42142071217676347}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14888883016351762, "M": 0.15492673811864788, "W-SUN": 0.05041601533475526, "D": 0.4227650502464607, "H": 0.38160118363487416, "15T": 0.10559542335780892, "W-FRI": 0.10650868616967224, "10T": 0.4528840561650268, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45189525302575095, "10S": 0.2812440461970862}} + +The new rule improves all three aggregate diagnostics on the E17 weights. A complete package evaluation with the newer E22 control weights is in progress before adoption. + +E29 zero-initialization verification: all 97 screen configurations exactly reproduce the E17 centered runtime skill 0.3531633226160329. Evaluation 21.35 seconds on the shared H100. The eight-step smoke changed the history output projection by 1.4182e-5 maximum while all frozen backbone weights remained bitwise equal and all weights finite. + +## E25 learned recency 6000-step checkpoint +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.591322422027588 seconds. +- Overall skill 0.352851; relative MASE 0.769426; relative WQL 0.544305. +- term skill: long=0.3876, medium=0.3997, short=0.3198. +- domain skill: Econ/Fin=0.1086, Energy=0.1828, Healthcare=0.3943, Nature=0.4120, Sales=0.3475, Transport=0.4545, Web/CloudOps=0.4982. +- frequency skill: A=0.3715, D=0.3323, H=0.3775, M=0.0905, Q=0.1942, S=0.4343, T=0.3965, W=0.1950. +- variates skill: multivariate=0.3855, univariate=0.3256. +- Outcome: Screen 0.352851 versus matched control 0.352399; modest improvement persists. Temporal diagnostics and later checkpoints remain. + +## E30 amplitude aligned template, full validation +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.350837; relative MASE 0.770162; relative WQL 0.547174. +- term skill: long=0.3846, medium=0.3975, short=0.3183. +- domain skill: Econ/Fin=0.1090, Energy=0.1818, Healthcare=0.3984, Nature=0.4093, Sales=0.3570, Transport=0.4592, Web/CloudOps=0.4877. +- frequency skill: A=0.2855, D=0.3348, H=0.3812, M=0.1070, Q=0.1786, S=0.4173, T=0.3911, W=0.1906. +- variates skill: multivariate=0.3791, univariate=0.3274. +- Outcome: Published. With the E22 control 6000-step weights, full validation improves 0.349953 to 0.350837, first earlier diagnostic 0.322147 to 0.322219, and second earlier diagnostic 0.348634 to 0.349310. No failures; deterministic relocated example checks passed. Full inference 96.8 seconds while sharing the one H100 with four training processes. All template changes are fixed formulas; learned parameters remain unchanged. + +## E30 aligned template first earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 20.561070680618286 seconds. +- Overall skill 0.322219; relative MASE 0.811128; relative WQL 0.566355. +- term skill: long=0.3898, medium=0.3504, short=0.2830. +- domain skill: Econ/Fin=0.1533, Energy=0.2182, Healthcare=0.3588, Nature=0.3483, Sales=0.3966, Transport=0.3655, Web/CloudOps=0.4333. +- frequency skill: A=0.3153, D=0.3418, H=0.3532, M=0.1706, Q=0.2117, S=0.3358, T=0.3205, W=0.2543. +- variates skill: multivariate=0.3369, univariate=0.3103. +- Outcome: Small improvement over centered templates. + +## E30 aligned template second earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.08868408203125 seconds. +- Overall skill 0.349310; relative MASE 0.778190; relative WQL 0.544080. +- term skill: long=0.3643, medium=0.3777, short=0.3325. +- domain skill: Econ/Fin=0.1024, Energy=0.2210, Healthcare=0.3434, Nature=0.4590, Sales=0.5576, Transport=0.4172, Web/CloudOps=0.4224. +- frequency skill: A=0.3380, D=0.4234, H=0.3847, M=0.1568, Q=0.1399, S=0.2828, T=0.3413, W=0.2426. +- variates skill: multivariate=0.3522, univariate=0.3470. +- Outcome: Improvement over centered templates. + +## E28 stronger seasonal loss 3000-step checkpoint +- Checkpoint SHA-256: `a514371332282d8ff1cf42e0c2127683e6bb95bfb98c1a6df6332c604d72c865`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.41924524307251 seconds. +- Overall skill 0.350569; relative MASE 0.771378; relative WQL 0.546763. +- term skill: long=0.3829, medium=0.3988, short=0.3180. +- domain skill: Econ/Fin=0.1028, Energy=0.1748, Healthcare=0.4041, Nature=0.4086, Sales=0.3488, Transport=0.4526, Web/CloudOps=0.4996. +- frequency skill: A=0.3725, D=0.3288, H=0.3734, M=0.0932, Q=0.1901, S=0.4387, T=0.3933, W=0.1988. +- variates skill: multivariate=0.3818, univariate=0.3246. +- Outcome: Screen 0.350569 versus matched control 0.350784. No gain at this checkpoint; continue to 6000 steps before deciding. + +E29 full trial started from the E22 control 6000-step backbone, seed 67, batch 64, 6,000 steps, learning rate 2e-4 with 200-step warmup and cosine decay. Only the 7.64M history-memory parameters train. Batch size is reduced to fit concurrent experiments on the one H100. Context lengths 8,192/16,384 with probabilities 0.4/0.6; horizon mixture remains 32/128/512/1024. Inference uses the current amplitude-aligned seasonal rule on the recent 4,096 points, so the additional history affects only the learned memory. The parent differs from the newly published E25 branch; zero-step evaluation supplies the exact matched control. + +## E25 learned recency 6000 with aligned templates, full validation +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.351407; relative MASE 0.769733; relative WQL 0.546517. +- term skill: long=0.3860, medium=0.3973, short=0.3189. +- domain skill: Econ/Fin=0.1113, Energy=0.1828, Healthcare=0.4050, Nature=0.4118, Sales=0.3571, Transport=0.4604, Web/CloudOps=0.4845. +- frequency skill: A=0.2870, D=0.3384, H=0.3819, M=0.1083, Q=0.1800, S=0.4144, T=0.3909, W=0.1904. +- variates skill: multivariate=0.3786, univariate=0.3289. +- Outcome: Published. Full validation 0.351407 versus preceding 0.350837; earlier diagnostics 0.323269 and 0.350071 versus 0.322219 and 0.349310. No failures; repeated relocated examples are bitwise identical, finite and monotone. Total 36,797,728 parameters. Full inference 96.7 seconds while the one H100 was shared with training. Training continues. + +## E25 recency 6000 aligned first earlier diagnostic +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 20.321524143218994 seconds. +- Overall skill 0.323269; relative MASE 0.809492; relative WQL 0.565744. +- term skill: long=0.3896, medium=0.3509, short=0.2848. +- domain skill: Econ/Fin=0.1588, Energy=0.2200, Healthcare=0.3660, Nature=0.3488, Sales=0.3987, Transport=0.3659, Web/CloudOps=0.4318. +- frequency skill: A=0.3196, D=0.3433, H=0.3536, M=0.1780, Q=0.2165, S=0.3305, T=0.3218, W=0.2570. +- variates skill: multivariate=0.3369, univariate=0.3122. +- Outcome: Improves the matched continued model with the same aligned-template runtime. + +## E25 recency 6000 aligned second earlier diagnostic +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.002116203308105 seconds. +- Overall skill 0.350071; relative MASE 0.777410; relative WQL 0.543353. +- term skill: long=0.3631, medium=0.3788, short=0.3338. +- domain skill: Econ/Fin=0.1067, Energy=0.2234, Healthcare=0.3529, Nature=0.4590, Sales=0.5596, Transport=0.4165, Web/CloudOps=0.4198. +- frequency skill: A=0.3409, D=0.4269, H=0.3856, M=0.1584, Q=0.1427, S=0.2730, T=0.3428, W=0.2398. +- variates skill: multivariate=0.3525, univariate=0.3481. +- Outcome: Improves the matched continued model with the same aligned-template runtime. + +E22 depth trial pruned after two matched comparisons: 3000-step skill 0.349903 versus control 0.350784, and 6000-step skill 0.351873 versus control 0.352399. The 6000-step checkpoint cost 1961.8 elapsed training-process seconds, versus 869.5 for the control under different shared-GPU contention. The planned 24,000 steps were not completed. This establishes no benefit at the tested budgets, not that greater depth can never help. Saved checkpoints remain available. Stop receipt: [{"pid": 4519, "kind": "training", "elapsed_seconds": 2108}, {"pid": 4914, "kind": "watcher", "elapsed_seconds": 1723}]. + +## E22 expanded depth 6000-step checkpoint +- Checkpoint SHA-256: `a1efd06cff13f7f47559d83d37ea63f6bc65692df49fd2bfe039502d33978632`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.713934898376465 seconds. +- Overall skill 0.351873; relative MASE 0.770476; relative WQL 0.545206. +- term skill: long=0.3864, medium=0.4005, short=0.3182. +- domain skill: Econ/Fin=0.1070, Energy=0.1815, Healthcare=0.3779, Nature=0.4133, Sales=0.3487, Transport=0.4524, Web/CloudOps=0.4999. +- frequency skill: A=0.3690, D=0.3292, H=0.3764, M=0.0873, Q=0.1951, S=0.4370, T=0.3963, W=0.1928. +- variates skill: multivariate=0.3859, univariate=0.3234. +- Outcome: Below the matched 36.8M control for the second comparison. Stop this trial and retain its checkpoints; prioritize the smaller learned-feature and history-memory experiments on one H100. + +## E31: stochastic seasonal amplitude in synthetic pretraining (prepared) +Hypothesis: the original generator has constant Fourier amplitudes, whereas the added recency features describe changing amplitudes. Modulate the seasonal component in half of synthetic draws by a positive AR log-amplitude with time constant 100–10,000, stationary log standard deviation 0.05–0.4 and log-value clipping [-2,2]. The modulation is applied before trends, observation noise, missing values and intermittence. A separate RNG seed = main seed + 100003 preserves all source selection, corpus windows, horizon/context choices and original generator random draws relative to E25. Planned seed 59 and E17 initialization allow comparison with existing E25 checkpoints without retraining a control. No training started yet. + +## E29 history memory 1000-step checkpoint +- Checkpoint SHA-256: `a3bdc3a7525ed869d48fc1ce2b54785bb82aa64573e3b3d8a0de98df10680af3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.969539165496826 seconds. +- Overall skill 0.355846; relative MASE 0.766420; relative WQL 0.541393. +- term skill: long=0.3920, medium=0.3994, short=0.3237. +- domain skill: Econ/Fin=0.1304, Energy=0.1908, Healthcare=0.3939, Nature=0.4095, Sales=0.3479, Transport=0.4592, Web/CloudOps=0.4963. +- frequency skill: A=0.3691, D=0.3317, H=0.3867, M=0.0892, Q=0.1952, S=0.4178, T=0.4001, W=0.1953. +- variates skill: multivariate=0.3846, univariate=0.3320. +- Outcome: Improves the matched zero-step screen score 0.354979. Elapsed training-process time 104.3 seconds on the shared single H100. Temporal diagnostics determine whether the gain transfers across cutoffs. + +## E29 history memory 3000-step checkpoint +- Checkpoint SHA-256: `81b1e8dfae60e87a20a2f0ff6d3464a608c8b86624cfc3383ca29441e9f1fd92`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.785941123962402 seconds. +- Overall skill 0.356376; relative MASE 0.765914; relative WQL 0.540860. +- term skill: long=0.3932, medium=0.3995, short=0.3240. +- domain skill: Econ/Fin=0.1306, Energy=0.1923, Healthcare=0.3934, Nature=0.4102, Sales=0.3479, Transport=0.4591, Web/CloudOps=0.4965. +- frequency skill: A=0.3691, D=0.3318, H=0.3878, M=0.0892, Q=0.1952, S=0.4179, T=0.4005, W=0.1953. +- variates skill: multivariate=0.3854, univariate=0.3323. +- Outcome: Improves the matched zero-step screen score 0.354979. Elapsed training-process time 283.3 seconds on the shared single H100. Temporal diagnostics determine whether the gain transfers across cutoffs. + +E31 training started: seed 59, batch 256, 24,000-step schedule, learning rate 8e-5, E17 initialization, same query-feature architecture as E25. Tests verified that all corpus-only rows are identical to E25 and that the main RNG states remain identical after both corpus-only and synthetic-only batches; 11 of 32 synthetic test rows changed. The independent modulation stream is seed 100062. Evaluate at 3000/6000 steps before extending this trial. + +## E22 control 12000 with aligned templates, full validation +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.355096; relative MASE 0.766848; relative WQL 0.542351. +- term skill: long=0.3891, medium=0.3999, short=0.3233. +- domain skill: Econ/Fin=0.1147, Energy=0.1853, Healthcare=0.3958, Nature=0.4163, Sales=0.3582, Transport=0.4612, Web/CloudOps=0.4938. +- frequency skill: A=0.2887, D=0.3392, H=0.3848, M=0.1131, Q=0.1870, S=0.4202, T=0.3967, W=0.1906. +- variates skill: multivariate=0.3845, univariate=0.3307. +- Outcome: Published. Full validation 0.355096 versus preceding E25-6000 package 0.351407, first earlier diagnostic 0.325963 versus 0.323269, and second earlier diagnostic 0.352462 versus 0.350071. No failures; repeated relocated examples are bitwise identical, finite and monotone. Full inference 98.8 seconds under shared H100 contention. The matched E25-12000 checkpoint is still training. + +## E22 control12000 aligned first earlier diagnostic +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.49058723449707 seconds. +- Overall skill 0.325963; relative MASE 0.809373; relative WQL 0.561330. +- term skill: long=0.3895, medium=0.3521, short=0.2893. +- domain skill: Econ/Fin=0.1619, Energy=0.2209, Healthcare=0.3713, Nature=0.3541, Sales=0.3962, Transport=0.3666, Web/CloudOps=0.4365. +- frequency skill: A=0.3123, D=0.3490, H=0.3551, M=0.1691, Q=0.2293, S=0.3380, T=0.3258, W=0.2557. +- variates skill: multivariate=0.3406, univariate=0.3141. +- Outcome: Improves the preceding package. + +## E22 control12000 aligned second earlier diagnostic +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.788399934768677 seconds. +- Overall skill 0.352462; relative MASE 0.775936; relative WQL 0.540386. +- term skill: long=0.3649, medium=0.3793, short=0.3372. +- domain skill: Econ/Fin=0.1068, Energy=0.2227, Healthcare=0.3661, Nature=0.4623, Sales=0.5608, Transport=0.4167, Web/CloudOps=0.4248. +- frequency skill: A=0.3383, D=0.4276, H=0.3860, M=0.1616, Q=0.1520, S=0.2793, T=0.3458, W=0.2493. +- variates skill: multivariate=0.3545, univariate=0.3508. +- Outcome: Improves the preceding package. + +## E32: transfer the learned history memory to the improved backbone +Hypothesis: the frozen history memory learns useful features that remain compatible with a later continuation of the same backbone architecture. Combine E29 history-memory tensors at 6000 steps with every backbone tensor from E22 control at 12000 steps. This is a deterministic combination of our own trained assets, with no new training and no external weights. Both parent checkpoint hashes and full training lineages are retained. The publication utility now traverses both parent branches and declares all their sources and generator seeds. Compare to the E22-12000 aligned-template runtime across three cutoffs before adoption. + +## E29 history memory 6000-step screen +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 43.3264684677124 seconds. +- Overall skill 0.357127; relative MASE 0.765099; relative WQL 0.540174. +- term skill: long=0.3941, medium=0.3993, short=0.3251. +- domain skill: Econ/Fin=0.1303, Energy=0.1925, Healthcare=0.3999, Nature=0.4104, Sales=0.3479, Transport=0.4597, Web/CloudOps=0.4973. +- frequency skill: A=0.3691, D=0.3342, H=0.3893, M=0.0892, Q=0.1952, S=0.4179, T=0.4002, W=0.1953. +- variates skill: multivariate=0.3861, univariate=0.3331. +- Outcome: Screen 0.357127 versus zero-step 0.354979. Training completed in 531.4 process seconds on the shared single H100. First earlier diagnostic regresses while the second improves; do not publish standalone without broader evidence. + +## E29 history memory first earlier diagnostic +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.55209970474243 seconds. +- Overall skill 0.321189; relative MASE 0.812469; relative WQL 0.567141. +- term skill: long=0.3883, medium=0.3470, short=0.2831. +- domain skill: Econ/Fin=0.1541, Energy=0.2165, Healthcare=0.3555, Nature=0.3461, Sales=0.3966, Transport=0.3649, Web/CloudOps=0.4336. +- frequency skill: A=0.3153, D=0.3408, H=0.3550, M=0.1706, Q=0.2117, S=0.3336, T=0.3162, W=0.2543. +- variates skill: multivariate=0.3353, univariate=0.3098. +- Outcome: Regresses from the matched parent 0.322219 to 0.321189. + +## E29 history memory second earlier diagnostic +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.82407259941101 seconds. +- Overall skill 0.350315; relative MASE 0.776760; relative WQL 0.543398. +- term skill: long=0.3664, medium=0.3780, short=0.3334. +- domain skill: Econ/Fin=0.1037, Energy=0.2222, Healthcare=0.3446, Nature=0.4601, Sales=0.5576, Transport=0.4171, Web/CloudOps=0.4239. +- frequency skill: A=0.3380, D=0.4241, H=0.3857, M=0.1568, Q=0.1399, S=0.2820, T=0.3431, W=0.2426. +- variates skill: multivariate=0.3544, univariate=0.3470. +- Outcome: Improves from the matched parent 0.349310 to 0.350315. + +## E28 stronger seasonal loss 6000-step checkpoint +- Checkpoint SHA-256: `6208c74c3a6902d0410708741fd3ee609649e28732e5d5ee2696169685768e9b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.053489208221436 seconds. +- Overall skill 0.352533; relative MASE 0.769384; relative WQL 0.544869. +- term skill: long=0.3857, medium=0.3986, short=0.3205. +- domain skill: Econ/Fin=0.1093, Energy=0.1807, Healthcare=0.4083, Nature=0.4098, Sales=0.3497, Transport=0.4525, Web/CloudOps=0.4985. +- frequency skill: A=0.3742, D=0.3386, H=0.3743, M=0.0874, Q=0.1946, S=0.4388, T=0.3951, W=0.1953. +- variates skill: multivariate=0.3844, univariate=0.3260. +- Outcome: Screen 0.352533 versus matched control 0.352399; first earlier diagnostic 0.322419 versus control 0.322598. Differences are small and inconsistent; continue to the 12000-step comparison. Training time through 6000: 1375.1 process seconds. + +## E22 pruned depth model earlier diagnostic +- Checkpoint SHA-256: `a1efd06cff13f7f47559d83d37ea63f6bc65692df49fd2bfe039502d33978632`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 29.58867907524109 seconds. +- Overall skill 0.322537; relative MASE 0.811436; relative WQL 0.565609. +- term skill: long=0.3876, medium=0.3519, short=0.2839. +- domain skill: Econ/Fin=0.1430, Energy=0.2205, Healthcare=0.3835, Nature=0.3473, Sales=0.3985, Transport=0.3592, Web/CloudOps=0.4331. +- frequency skill: A=0.3156, D=0.3515, H=0.3521, M=0.1655, Q=0.2142, S=0.3417, T=0.3184, W=0.2490. +- variates skill: multivariate=0.3364, univariate=0.3113. +- Outcome: Score 0.322537 versus matched control 0.322598, confirming no useful advantage in the tested budgets. + +## E33: global quantile ensemble of the newer backbone and transferred memory +Hypothesis: averaging the unmodified E22-12000 forecasts with E32 reduces the history memory’s temporal instability. Compare fixed backbone weights 0.25/0.5/0.75, with the complementary weight on the memory model, across all three diagnostics. Both members must forecast every instance in any deployed package. This is a cached-output diagnostic first, with no training or per-dataset choice. Actual package inference and full validation remain required before publication. + +## E32 transferred history memory screen +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.279379844665527 seconds. +- Overall skill 0.361285; relative MASE 0.762270; relative WQL 0.535186. +- term skill: long=0.3979, medium=0.4009, short=0.3306. +- domain skill: Econ/Fin=0.1354, Energy=0.1960, Healthcare=0.4004, Nature=0.4175, Sales=0.3496, Transport=0.4614, Web/CloudOps=0.5026. +- frequency skill: A=0.3746, D=0.3390, H=0.3931, M=0.0951, Q=0.1983, S=0.4210, T=0.4049, W=0.1967. +- variates skill: multivariate=0.3911, univariate=0.3365. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +## E32 transferred history memory first earlier +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.01271629333496 seconds. +- Overall skill 0.324581; relative MASE 0.811091; relative WQL 0.562442. +- term skill: long=0.3866, medium=0.3491, short=0.2893. +- domain skill: Econ/Fin=0.1617, Energy=0.2185, Healthcare=0.3678, Nature=0.3513, Sales=0.3962, Transport=0.3659, Web/CloudOps=0.4368. +- frequency skill: A=0.3123, D=0.3475, H=0.3561, M=0.1691, Q=0.2293, S=0.3357, T=0.3214, W=0.2557. +- variates skill: multivariate=0.3385, univariate=0.3133. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +## E32 transferred history memory second earlier +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.5328631401062 seconds. +- Overall skill 0.352606; relative MASE 0.775583; relative WQL 0.540391. +- term skill: long=0.3677, medium=0.3779, short=0.3370. +- domain skill: Econ/Fin=0.1079, Energy=0.2224, Healthcare=0.3668, Nature=0.4615, Sales=0.5608, Transport=0.4165, Web/CloudOps=0.4263. +- frequency skill: A=0.3383, D=0.4283, H=0.3855, M=0.1616, Q=0.1520, S=0.2804, T=0.3462, W=0.2493. +- variates skill: multivariate=0.3553, univariate=0.3504. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +E33 cached ensemble results. Neither member required new training. Backbone weights 0.25/0.5/0.75 apply globally to every instance; complementary weight is on E32. All tested mixtures retain a small first-earlier-cutoff regression. No ensemble is published yet; the simpler backbone continuations are still improving. +- screen, base weight 0.25: skill 0.3609597107729168; elapsed 31.589441299438477 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7485062013261629, "rel_wql_gmean": 0.48497053192140965}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7187220659985801, "rel_wql_gmean": 0.49872959388387217}, "short": {"n_configs": 55, "rel_mase_gmean": 0.7854775479522941, "rel_wql_gmean": 0.5715754588019885}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8766794111084217, "rel_wql_gmean": 0.8521904674160014}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9458381742339477, "rel_wql_gmean": 0.6841214470602749}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6357518097122528, "rel_wql_gmean": 0.5708050606184818}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8296139742081163, "rel_wql_gmean": 0.40898901267743815}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.8283216000359614, "rel_wql_gmean": 0.510813353500822}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6491485866452709, "rel_wql_gmean": 0.4469444592152844}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.564775788716386, "rel_wql_gmean": 0.4386209893190716}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6092189862308618, "rel_wql_gmean": 0.6444119562488515}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7923969772018941, "rel_wql_gmean": 0.5529928138595462}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7344815207835862, "rel_wql_gmean": 0.502366984331498}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9818087731317099, "rel_wql_gmean": 0.8332936324629011}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7734447483921444, "rel_wql_gmean": 0.8291183442517216}, "S": {"n_configs": 6, "rel_mase_gmean": 0.662205210700223, "rel_wql_gmean": 0.5065947056042907}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7321702800096546, "rel_wql_gmean": 0.4836230433794967}, "W": {"n_configs": 8, "rel_mase_gmean": 0.9308497588724332, "rel_wql_gmean": 0.6931956959471695}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.7176036435313308, "rel_wql_gmean": 0.5172069567399432}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.800284652420953, "rel_wql_gmean": 0.5506355529979893}}} +- screen, base weight 0.5: skill 0.36051700538130327; elapsed 1.6923091411590576 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7491443694259866, "rel_wql_gmean": 0.48552116951145263}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.717943946501363, "rel_wql_gmean": 0.49885742655549165}, "short": {"n_configs": 55, "rel_mase_gmean": 0.7862261945539069, "rel_wql_gmean": 0.572174296426093}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8767314570553127, "rel_wql_gmean": 0.8518426772129285}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9464868100785462, "rel_wql_gmean": 0.6847020626617584}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6391927294627128, "rel_wql_gmean": 0.5728774819722747}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8288486290328975, "rel_wql_gmean": 0.4095777628918776}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.828359895013336, "rel_wql_gmean": 0.5108331535102516}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6492097960109925, "rel_wql_gmean": 0.44703510569395916}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.5650725913141991, "rel_wql_gmean": 0.43904253902223594}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6107048585981317, "rel_wql_gmean": 0.6453081988530746}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7937577174837149, "rel_wql_gmean": 0.5536527716998109}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7349129886012886, "rel_wql_gmean": 0.5033244078192418}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9816729369571708, "rel_wql_gmean": 0.83284954955612}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7729642350253297, "rel_wql_gmean": 0.8282079386900584}, "S": {"n_configs": 6, "rel_mase_gmean": 0.6624714487276662, "rel_wql_gmean": 0.5067064419332115}, "T": {"n_configs": 30, "rel_mase_gmean": 0.732172046143732, "rel_wql_gmean": 0.4837994768895142}, "W": {"n_configs": 8, "rel_mase_gmean": 0.930849298960232, "rel_wql_gmean": 0.6931955559830537}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.717793296521423, "rel_wql_gmean": 0.5179713349770367}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8008210552601016, "rel_wql_gmean": 0.5508732181941426}}} +- screen, base weight 0.75: skill 0.3599500839851063; elapsed 1.4231245517730713 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.750042489425022, "rel_wql_gmean": 0.48623104748726004}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7173897864210821, "rel_wql_gmean": 0.4991516788000004}, "short": {"n_configs": 55, "rel_mase_gmean": 0.78703598003334, "rel_wql_gmean": 0.5728330044823371}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8768876674480677, "rel_wql_gmean": 0.8515997053654789}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9473562016160542, "rel_wql_gmean": 0.6855548779843715}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.642561102977203, "rel_wql_gmean": 0.5749859696863521}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8285232450849535, "rel_wql_gmean": 0.4102456883415478}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.8284086809446388, "rel_wql_gmean": 0.5108547074028001}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6493066620546145, "rel_wql_gmean": 0.44715612803391697}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.5654188677782281, "rel_wql_gmean": 0.4395078746093791}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6122299433463864, "rel_wql_gmean": 0.6462324836335608}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7950974689907988, "rel_wql_gmean": 0.5543319910897211}, "H": {"n_configs": 31, "rel_mase_gmean": 0.735615332675693, "rel_wql_gmean": 0.5044620646385107}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9815783490405571, "rel_wql_gmean": 0.832453381029195}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7726561980040161, "rel_wql_gmean": 0.8274692503440843}, "S": {"n_configs": 6, "rel_mase_gmean": 0.6627478709382408, "rel_wql_gmean": 0.5068543440740843}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7323316854508894, "rel_wql_gmean": 0.4840907541003884}, "W": {"n_configs": 8, "rel_mase_gmean": 0.9308491431521891, "rel_wql_gmean": 0.6931954208513348}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.7182293746317306, "rel_wql_gmean": 0.5189159515589695}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8014062938450294, "rel_wql_gmean": 0.5511589238591919}}} +- backcast, base weight 0.25: skill 0.32516390659459127; elapsed 25.728330373764038 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7877573688004119, "rel_wql_gmean": 0.4757505244331779}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7777646324659491, "rel_wql_gmean": 0.5427449141803178}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8320626409877416, "rel_wql_gmean": 0.6069233027764227}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731645869233648, "rel_wql_gmean": 0.8046317212772931}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9000885899955989, "rel_wql_gmean": 0.6764463826118567}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6763673902063786, "rel_wql_gmean": 0.5893498915999001}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9498042213778831, "rel_wql_gmean": 0.44171639005646535}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.7449699119735571, "rel_wql_gmean": 0.5393127533664154}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755793289890412, "rel_wql_gmean": 0.4696226318380198}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8480816283629858, "rel_wql_gmean": 0.5013822816935581}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7872906478235149, "rel_wql_gmean": 0.5262643957494131}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8611665698543136, "rel_wql_gmean": 0.5114505986034271}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7774300159704559, "rel_wql_gmean": 0.5898942963102115}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8054278932888852, "rel_wql_gmean": 0.5417010935787644}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8142697614393413, "rel_wql_gmean": 0.5786920991268066}}} +- backcast, base weight 0.5: skill 0.3255906425540577; elapsed 7.025062561035156 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7868531100085023, "rel_wql_gmean": 0.47494194797983313}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7767176724724971, "rel_wql_gmean": 0.5419949281040547}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8318845792654018, "rel_wql_gmean": 0.606991975463184}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731690390439605, "rel_wql_gmean": 0.8045484945388448}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.8993476870381677, "rel_wql_gmean": 0.6755669234996251}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6753662260274707, "rel_wql_gmean": 0.5885861458424224}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9483032085189914, "rel_wql_gmean": 0.441350380267718}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.7446948865024733, "rel_wql_gmean": 0.5392154113246899}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755391890283506, "rel_wql_gmean": 0.469748030722515}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8475410369158077, "rel_wql_gmean": 0.5011421156521402}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7875436876281503, "rel_wql_gmean": 0.5262880067026078}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8607773505813321, "rel_wql_gmean": 0.5107840537486803}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7758285204666452, "rel_wql_gmean": 0.5890117516972101}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8047280897548712, "rel_wql_gmean": 0.5410867356076619}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8138657265706295, "rel_wql_gmean": 0.5785877053648649}}} +- backcast, base weight 0.75: skill 0.32585558132181525; elapsed 1.4801208972930908 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7864118030472989, "rel_wql_gmean": 0.47433966987370835}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7760856247602924, "rel_wql_gmean": 0.541419709057465}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8317549187410698, "rel_wql_gmean": 0.6071042148592315}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731809073153128, "rel_wql_gmean": 0.8044818649657144}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.8991776752660365, "rel_wql_gmean": 0.6750015559883032}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6743591342425898, "rel_wql_gmean": 0.5878184243392145}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9471433052106504, "rel_wql_gmean": 0.4410648488568812}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.744443044974495, "rel_wql_gmean": 0.5391442286013897}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755193180086204, "rel_wql_gmean": 0.46990600477296696}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8470002930114933, "rel_wql_gmean": 0.5009052086170435}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7882647172004155, "rel_wql_gmean": 0.5264910423859007}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8604064218762162, "rel_wql_gmean": 0.5101551146076984}, "T": {"n_configs": 30, "rel_mase_gmean": 0.774442079728573, "rel_wql_gmean": 0.5883004763096262}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8044577867215783, "rel_wql_gmean": 0.5406785466562373}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8135190933822734, "rel_wql_gmean": 0.5785199260327762}}} +- backcast2, base weight 0.25: skill 0.35287154434047796; elapsed 32.718568563461304 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.7953937401265897, "rel_wql_gmean": 0.5030106493089533}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7678643593783896, "rel_wql_gmean": 0.5028055430553253}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7711270557942318, "rel_wql_gmean": 0.5695813024863108}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8805482364783594, "rel_wql_gmean": 0.9042209924611244}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9117289903338895, "rel_wql_gmean": 0.6620020860753241}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6839866145665877, "rel_wql_gmean": 0.5864976160474622}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7748252117778318, "rel_wql_gmean": 0.3733068662798137}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.6725766506204502, "rel_wql_gmean": 0.5061420572217049}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6870083960785978, "rel_wql_gmean": 0.4794994231705838}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7299533930809837, "rel_wql_gmean": 0.4479740157977664}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7604275957811419, "rel_wql_gmean": 0.4953118153144008}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9122753788008492, "rel_wql_gmean": 0.5679295721865012}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7657639848982667, "rel_wql_gmean": 0.5579672183603664}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7902445203946336, "rel_wql_gmean": 0.5253027568920817}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7633236727962595, "rel_wql_gmean": 0.5525218103974238}}} +- backcast2, base weight 0.5: skill 0.35293362223391267; elapsed 1.2891087532043457 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.795490811324907, "rel_wql_gmean": 0.5038189345476245}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7674326315874551, "rel_wql_gmean": 0.5023119643797436}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7711829671563578, "rel_wql_gmean": 0.5693457082014003}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8808378054392396, "rel_wql_gmean": 0.9044589957290904}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9113735276107076, "rel_wql_gmean": 0.6617472008949459}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6842243004747667, "rel_wql_gmean": 0.5865985548061023}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7748130011917327, "rel_wql_gmean": 0.37282859138217267}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.6724189210776539, "rel_wql_gmean": 0.5061490326925873}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6872511298933153, "rel_wql_gmean": 0.47991505019019964}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7301681468376378, "rel_wql_gmean": 0.4481185117970856}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7599867700948899, "rel_wql_gmean": 0.49504239452481336}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9125454167444352, "rel_wql_gmean": 0.5681445429462755}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7659127026855528, "rel_wql_gmean": 0.5579048015053354}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7903908108689007, "rel_wql_gmean": 0.5252368408110905}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7631277150357363, "rel_wql_gmean": 0.5524454383766455}}} +- backcast2, base weight 0.75: skill 0.35279424558075034; elapsed 1.3640234470367432 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.7960013691972241, "rel_wql_gmean": 0.5048538794748333}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7673586435302413, "rel_wql_gmean": 0.5020153819167671}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7714553413789935, "rel_wql_gmean": 0.5691840862467166}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.881145657719554, "rel_wql_gmean": 0.9047199305925011}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9115950570456508, "rel_wql_gmean": 0.6618010993808187}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6844817312954508, "rel_wql_gmean": 0.5867080808867043}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7754005359113609, "rel_wql_gmean": 0.3724980616976047}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.672286131185056, "rel_wql_gmean": 0.506183419259456}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6875722190026725, "rel_wql_gmean": 0.48037847185063465}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.730395963063022, "rel_wql_gmean": 0.4482700955304752}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7602248518219639, "rel_wql_gmean": 0.4950255629831832}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9128726300303336, "rel_wql_gmean": 0.5684332751933325}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7662563237934747, "rel_wql_gmean": 0.5579847239947101}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7911061856256687, "rel_wql_gmean": 0.5254140703891469}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7629991415479856, "rel_wql_gmean": 0.5524144817860636}}} + +## E34: multivariate attention with end-to-end pretraining and univariate rehearsal +Hypothesis: E20’s frozen backbone could not fully learn how to interpret cross-channel signals. Start from E22 control at 12000, add the same zero-output cross-variable attention layer, and train all 37,816,096 parameters. Three quarters of batches use the original 95-source univariate sampler, batch 128; one quarter use synchronized multivariate records, 32 groups with 2/3/4/8 channels. Six thousand steps, learning rate 4e-5 with 200-step warmup and cosine decay; main seed 73, independent joint-sampler seed 10073. Use only packed_sample and packed_joint and their local generators. This changes the training mixture and trainable parameter set together; it is a candidate method comparison, not a claim that either factor alone causes any gain. Zero-step output is the matched inference control. No validation observations enter gradients. + +## E25 learned recency 12000 with aligned templates, full validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.355628; relative MASE 0.765858; relative WQL 0.542156. +- term skill: long=0.3899, medium=0.4001, short=0.3239. +- domain skill: Econ/Fin=0.1162, Energy=0.1854, Healthcare=0.4030, Nature=0.4169, Sales=0.3571, Transport=0.4622, Web/CloudOps=0.4930. +- frequency skill: A=0.2912, D=0.3393, H=0.3859, M=0.1107, Q=0.1840, S=0.4221, T=0.3964, W=0.1942. +- variates skill: multivariate=0.3851, univariate=0.3311. +- Outcome: Published. Full validation 0.355628 versus matched E22-12000 package 0.355096; earlier diagnostics 0.327844 and 0.354561 versus 0.325963 and 0.352462. No failures. Repeated relocated examples are bitwise identical, finite and monotone. This extends the recency-feature benefit to a third matched training checkpoint. + +## E25 recency12000 first earlier diagnostic +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.109707355499268 seconds. +- Overall skill 0.327844; relative MASE 0.806911; relative WQL 0.559904. +- term skill: long=0.3932, medium=0.3529, short=0.2909. +- domain skill: Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- frequency skill: A=0.3134, D=0.3502, H=0.3567, M=0.1636, Q=0.2250, S=0.3402, T=0.3276, W=0.2656. +- variates skill: multivariate=0.3437, univariate=0.3150. +- Outcome: Improves the matched control. + +## E25 recency12000 second earlier diagnostic +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.91800332069397 seconds. +- Overall skill 0.354561; relative MASE 0.773267; relative WQL 0.538742. +- term skill: long=0.3642, medium=0.3828, short=0.3397. +- domain skill: Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- frequency skill: A=0.3385, D=0.4319, H=0.3875, M=0.1660, Q=0.1478, S=0.2841, T=0.3480, W=0.2461. +- variates skill: multivariate=0.3588, univariate=0.3511. +- Outcome: Improves the matched control. + +Measured continuation compute (elapsed training-process seconds, shared single H100; these are not additive dedicated GPU-seconds): +- depth36_control, step 1000: 124.8 seconds. +- depth36_control, step 3000: 365.5 seconds. +- depth36_control, step 6000: 869.5 seconds. +- depth36_control, step 12000: 2211.3 seconds. +- recency_features, step 1000: 168.9 seconds. +- recency_features, step 3000: 510.3 seconds. +- recency_features, step 6000: 1158.7 seconds. +- recency_features, step 12000: 2481.6 seconds. +- strong_loss, step 1000: 224.1 seconds. +- strong_loss, step 3000: 672.8 seconds. +- strong_loss, step 6000: 1375.1 seconds. +- amplitude_synth, step 1000: 227.1 seconds. +- amplitude_synth, step 3000: 678.7 seconds. +- joint_rehearsal, step 1000: 172.6 seconds. + +## E35: explicit local trend increments in future queries (prepared) +Hypothesis: the original damped trend feature clips normalized slopes at 0.03 per step, suppressing trends in short annual and quarterly contexts. Add two zero-initialized query features from differences of adjacent 4-point and 16-point means, extrapolated to each future step and softly capped at 3 context standard deviations. Each mean needs at least half its observations and at least two finite values. This is a fixed context calculation, not a fitted per-instance model. A separate 16,384-parameter query projection preserves the existing recency projection and all pretrained-in-this-workspace tensors. Planned E17 initialization, seed 59, batch 256 and 24,000-step schedule match E25 exactly; no new synthetic generator. Training not yet started. + +E28 stopped after the 12000-step comparison. Screen 0.355930 is below matched control 0.356664; earlier checkpoints gave small inconsistent differences. Training through 12000 took 2731.8 process seconds on the shared H100. Checkpoints are retained, but the stronger seasonal-error weighting is not adopted. + +## E28 stronger seasonal loss 12000-step checkpoint +- Checkpoint SHA-256: `9f67f75960a568c9bc42fdb2ec99c8852bb5136ae869b7f63ac3fd6aeb359aab`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.34673237800598 seconds. +- Overall skill 0.355930; relative MASE 0.766619; relative WQL 0.541111. +- term skill: long=0.3886, medium=0.4019, short=0.3241. +- domain skill: Econ/Fin=0.1123, Energy=0.1843, Healthcare=0.4078, Nature=0.4143, Sales=0.3492, Transport=0.4532, Web/CloudOps=0.5040. +- frequency skill: A=0.3801, D=0.3350, H=0.3784, M=0.1213, Q=0.1929, S=0.4399, T=0.3989, W=0.1948. +- variates skill: multivariate=0.3880, univariate=0.3292. +- Outcome: Below matched control; stop this branch after three comparisons without a consistent advantage. + +E35 training started with the planned matched seed 59, batch 256, learning rate 8e-5 and 24000-step schedule, replacing E28 GPU work. A synthetic forward check verified bitwise equality at zero projection, and backward propagation produced finite nonzero gradients for the new trend projection. No additional training source or generator is introduced. + +## E31 synthetic amplitude 3000-step screen +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.430498361587524 seconds. +- Overall skill 0.352625; relative MASE 0.768870; relative WQL 0.545079. +- term skill: long=0.3854, medium=0.3995, short=0.3204. +- domain skill: Econ/Fin=0.1023, Energy=0.1772, Healthcare=0.4136, Nature=0.4097, Sales=0.3467, Transport=0.4530, Web/CloudOps=0.5025. +- frequency skill: A=0.3691, D=0.3356, H=0.3748, M=0.0875, Q=0.1887, S=0.4366, T=0.3965, W=0.1978. +- variates skill: multivariate=0.3840, univariate=0.3265. +- Outcome: Improves matched E25-3000 screen from 0.351702 to 0.352625. First earlier diagnostic improves 0.321665 to 0.322014. Keep training to assess persistence. + +## E34 joint rehearsal 1000-step screen +- Checkpoint SHA-256: `394f2003a6c00cdcb0f2b944d1e9cc8ae4f7aca9e513bf46dbb1f8a2489c8670`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.026655912399292 seconds. +- Overall skill 0.360583; relative MASE 0.762757; relative WQL 0.536022. +- term skill: long=0.3975, medium=0.4014, short=0.3292. +- domain skill: Econ/Fin=0.1394, Energy=0.1926, Healthcare=0.3956, Nature=0.4177, Sales=0.3466, Transport=0.4620, Web/CloudOps=0.5034. +- frequency skill: A=0.3785, D=0.3382, H=0.3903, M=0.0963, Q=0.1994, S=0.4210, T=0.4059, W=0.1960. +- variates skill: multivariate=0.3895, univariate=0.3366. +- Outcome: Improves matched zero-step control on main screen and both earlier diagnostics. Later checkpoints are needed before selecting a package. + +## E34 joint rehearsal 3000-step screen +- Checkpoint SHA-256: `6dd1560fb4d63eae0fa8d414252b55329371e397cee44dcff4c656ff3e2f3416`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.9136745929718 seconds. +- Overall skill 0.358556; relative MASE 0.764675; relative WQL 0.538072. +- term skill: long=0.3976, medium=0.4016, short=0.3253. +- domain skill: Econ/Fin=0.1364, Energy=0.1912, Healthcare=0.3737, Nature=0.4189, Sales=0.3465, Transport=0.4616, Web/CloudOps=0.5016. +- frequency skill: A=0.3793, D=0.3315, H=0.3904, M=0.0787, Q=0.2012, S=0.4202, T=0.4046, W=0.1966. +- variates skill: multivariate=0.3887, univariate=0.3335. +- Outcome: Screen falls below the zero-step control after the earlier gain; do not publish this checkpoint. Continue to the planned 6000-step endpoint to assess the lower learning rate. + +## E36: equal-weight control and recency ensemble +Hypothesis: averaging two strong continuations reduces differences across validation cutoffs. Compare a fixed 50/50 quantile average of E25 recency12000 and E22 control18000, each forecasting every instance with the aligned seasonal rule. No training or new data; no dataset-specific selection. Screen and both earlier diagnostics are computed from cached forecasts before constructing a runtime package. + +## E37: fixed zero-mass projection +Hypothesis: small positive forecasts on histories with an observed mass at exactly zero cause disproportionate median error. Diagnostic candidates snap nonnegative quantiles below 0, 0.001, 0.005 or 0.02 context standard deviations to zero, only when the recent4096 history is nonnegative and contains at least4 zeros comprising at least10% of observed points. All thresholds are fixed globally; no per-instance fitting. Test the same four candidates at all three validation cutoffs using E25 recency12000 aligned outputs. No training and no extra data. + +E37 initial sweep: threshold0.02 improved screen 0.359868→0.360509, first earlier0.327844→0.328180 and second earlier0.354561→0.354943. Smaller nonzero thresholds gave smaller gains. Build and fully evaluate the0.02 runtime. A separate follow-up will compare0.05 and0.1 to assess whether the original upper endpoint truncated the useful range; no additional fitted parameters. + +## E38: broader packed corpus for the 36.8M recency model (prepared) +Hypothesis: the earlier negative corpus-expansion result at6.7M parameters may not hold for the larger, more-trained model. Compare packed_sample (0.959B points) with packed_expanded (5.653B points), initializing both from E25 recency12000. Keep source mixture weights calculated from packed_sample in both arms, isolating broader series and crop coverage from source-reweighting. Seed79, batch256, learning rate5e-5, 12000-step schedule, saves every3000, same architecture/loss/window mixture/synthetic generator. Each arm uses two Torch CPU threads. Training will start after current jobs release GPU capacity. No new corpus directories or generators. + +E37 wider sweep: thresholds0.02/0.05/0.1 gave screen0.360509/0.362121/0.364736, earlier1 0.328180/0.328643/0.329276, earlier2 0.354943/0.355475/0.356263. All three improve with the larger threshold. A final bracket at0.1/0.2/0.4/0.8 will locate an interior useful range before full runtime selection. + +## E39: bounded quantiles during pretraining (prepared) +Hypothesis: the current continuous output head incurs small positive errors on genuinely zero-valued futures. Extend the existing nonnegativity heuristic symmetrically inside the training forward pass: histories entirely nonnegative clamp normalized output quantiles at standardized zero; entirely nonpositive histories clamp above at zero. This lets pinball loss learn exact boundary probability mass through negative latent quantiles, rather than requiring exact equality of a continuous prediction. No additional model parameters. Match E38 packed_sample control: own E25 recency12000 initialization, seed79, batch256, LR5e-5, 12000 steps, original source mixture and generator. Training not yet started; this is separate from the fixed E37 inference projection. + +E37 final bracket selected threshold0.4: screen/earlier1/earlier2 =0.370559/0.330696/0.357884, versus parent0.359868/0.327844/0.354561. Threshold0.8 regresses to0.364344/0.327637/0.350745, providing an interior optimum common to all three cutoffs. No finer sweep is planned. Assemble and fully evaluate threshold0.4 before publication. + +E36 equal-weight blend gives screen0.361191, earlier1 0.328179, earlier2 0.354067. The main screen remains below control18000 alone (0.361735), and second earlier remains below recency12000 (0.354561). Not selected; no ensemble runtime is published. + +E38 packed_sample control started with the planned seed79 and schedule after E34 completed. A sampler check confirmed bitwise equality with the original sampler and identical source probabilities for both packed corpora. The expanded arm remains prepared, awaiting GPU capacity. + +## E22 control18000 full validation with aligned seasonal rule +- Checkpoint SHA-256: `b7bbb7473a317145235c133492a0d743a90a01ff252577a4c8a4651db008a138`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.357537; relative MASE 0.764724; relative WQL 0.539749. +- term skill: long=0.3898, medium=0.4009, short=0.3270. +- domain skill: Econ/Fin=0.1117, Energy=0.1855, Healthcare=0.4146, Nature=0.4204, Sales=0.3566, Transport=0.4642, Web/CloudOps=0.4949. +- frequency skill: A=0.2833, D=0.3419, H=0.3872, M=0.1236, Q=0.1877, S=0.4206, T=0.3976, W=0.1997. +- variates skill: multivariate=0.3862, univariate=0.3338. +- Outcome: Improves full validation to0.357537; first and second earlier0.327746/0.352885 remain slightly below published recency12000. Candidate retained while matched recency18000 is evaluated. + +## E31 amplitude synthetic 6000-step screen +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.376917362213135 seconds. +- Overall skill 0.355543; relative MASE 0.766576; relative WQL 0.541792. +- term skill: long=0.3869, medium=0.3997, short=0.3251. +- domain skill: Econ/Fin=0.1054, Energy=0.1826, Healthcare=0.4173, Nature=0.4166, Sales=0.3471, Transport=0.4535, Web/CloudOps=0.5020. +- frequency skill: A=0.3700, D=0.3444, H=0.3777, M=0.0986, Q=0.1941, S=0.4367, T=0.3980, W=0.1929. +- variates skill: multivariate=0.3869, univariate=0.3294. +- Outcome: Screen0.355543 improves matched E25-6000 0.352851. First earlier0.324002 is effectively tied with matched0.324008; second earlier0.349572 improves matched0.349098. Continue to12000. + +## E34 joint rehearsal 6000-step screen +- Checkpoint SHA-256: `44aa5f702a58845a427ad76818631e808362b7dc236a3648232db47d621db219`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.278470993041992 seconds. +- Overall skill 0.360025; relative MASE 0.763498; relative WQL 0.536437. +- term skill: long=0.3986, medium=0.4027, short=0.3272. +- domain skill: Econ/Fin=0.1375, Energy=0.1934, Healthcare=0.3748, Nature=0.4209, Sales=0.3465, Transport=0.4619, Web/CloudOps=0.5031. +- frequency skill: A=0.3720, D=0.3320, H=0.3916, M=0.0873, Q=0.1998, S=0.4184, T=0.4071, W=0.1973. +- variates skill: multivariate=0.3917, univariate=0.3337. +- Outcome: Final screen0.360025 improves parent0.359242 but is below the1000-step peak0.360583. Evaluate both earlier cutoffs; do not publish solely from the small screen gain. + +E34 completed6000 steps in1049.5 training-process seconds. Earlier1/earlier2 =0.326344/0.350746: first improves parent0.325963, second regresses from0.352462. The1000-step checkpoint remains the better joint candidate, but neither is selected over the stronger recency model. All weights are archived. + +## E37 threshold0.02 full package validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.356254; relative MASE 0.764978; relative WQL 0.541726. +- term skill: long=0.3904, medium=0.4005, short=0.3246. +- domain skill: Econ/Fin=0.1162, Energy=0.1871, Healthcare=0.4030, Nature=0.4175, Sales=0.3571, Transport=0.4622, Web/CloudOps=0.4933. +- frequency skill: A=0.2912, D=0.3393, H=0.3863, M=0.1108, Q=0.1840, S=0.4221, T=0.3979, W=0.1942. +- variates skill: multivariate=0.3855, univariate=0.3320. +- Outcome: Full skill0.356254 improves parent0.355628 with zero failed configurations. Repeated relocated examples are bitwise identical, finite and monotone. Temporarily published while the larger, consistently better threshold0.4 completes full validation. + +## E40: zero-mass projection with empirical phase probability +E37 helps solar and several zero-heavy channels but slightly hurts some sales and cloud series. Hypothesis: a quantile should be snapped only when the observed zero probability supports its level. Keep threshold0.4 fixed; compare unrestricted E37, global observed zero fraction, and phase-specific zero frequencies from the last4 or8 primary seasonal cycles. For phase estimates with at least3 observations use (zero_count+0.5)/(count+1), otherwise the global fraction. Only levels at or below that zero probability are eligible. All rules are fixed context formulas, applied independently per variate. Compare cached E25 recency12000 forecasts on all three cutoffs; no training. + +E37 final selection: use the18,000-step recency checkpoint with threshold0.4. Full validation0.370171 exceeds12,000-step+0.4 at0.366390; earlier1 improves0.330696→0.332400, while earlier2 decreases0.357884→0.356697. The three-cutoff mean improves, and all three exceed the previously published12,000-step+0.02 package. Prefer the newer checkpoint for its full-validation and first-earlier gains; retain the second-earlier regression as a limitation. Both candidate packages passed repeated relocated example inference, with exact equality, finite outputs and monotone quantiles. +- Measured depth36_control step18000: 3529.7 elapsed training-process seconds on the shared single H100. +- Measured recency_features step18000: 4008.8 elapsed training-process seconds on the shared single H100. +- Measured amplitude_synth step6000: 1498.1 elapsed training-process seconds on the shared single H100. +- Measured joint_rehearsal step6000: 1049.5 elapsed training-process seconds on the shared single H100. + +## E37 threshold0.4 on recency12000 full validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.366390; relative MASE 0.754640; relative WQL 0.531990. +- term skill: long=0.3917, medium=0.4037, short=0.3414. +- domain skill: Econ/Fin=0.1162, Energy=0.2258, Healthcare=0.4030, Nature=0.4203, Sales=0.3559, Transport=0.4622, Web/CloudOps=0.4911. +- frequency skill: A=0.2912, D=0.3374, H=0.3884, M=0.1159, Q=0.1840, S=0.4221, T=0.4262, W=0.1943. +- variates skill: multivariate=0.3853, univariate=0.3509. +- Outcome: Full0.366390, earlier1 0.330696, earlier2 0.357884. Clear improvement over the same checkpoint without zero projection. Superseded by the18000-step candidate on full validation and average across cutoffs. + +## E25 plus E37 recency18000 threshold0.4 full validation +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.370171; relative MASE 0.750532; relative WQL 0.528537. +- term skill: long=0.3932, medium=0.4057, short=0.3469. +- domain skill: Econ/Fin=0.1099, Energy=0.2275, Healthcare=0.4340, Nature=0.4253, Sales=0.3541, Transport=0.4653, Web/CloudOps=0.4932. +- frequency skill: A=0.2819, D=0.3468, H=0.3906, M=0.1220, Q=0.1866, S=0.4218, T=0.4285, W=0.2054. +- variates skill: multivariate=0.3878, univariate=0.3558. +- Outcome: Published atomically. Full skill0.370171; earlier1 0.332400 and earlier2 0.356697. All97 configurations and151170 instances scored, zero failures. Actual package repeated examples are bitwise deterministic, finite and monotone; full inference118.1 seconds under concurrent training. + +## Published recency18000 zero0.4 first earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.86830711364746 seconds. +- Overall skill 0.332400; relative MASE 0.801955; relative WQL 0.555755. +- term skill: long=0.3980, medium=0.3574, short=0.2953. +- domain skill: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472. +- frequency skill: A=0.2996, D=0.3516, H=0.3643, M=0.1721, Q=0.2330, S=0.3397, T=0.3325, W=0.2660. +- variates skill: multivariate=0.3492, univariate=0.3187. +- Outcome: Improves the previous published package and the12000-step zero0.4 candidate. + +## Published recency18000 zero0.4 second earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.40335988998413 seconds. +- Overall skill 0.356697; relative MASE 0.773731; relative WQL 0.534862. +- term skill: long=0.3657, medium=0.3874, short=0.3411. +- domain skill: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303. +- frequency skill: A=0.3474, D=0.4275, H=0.3891, M=0.1599, Q=0.1548, S=0.2798, T=0.3574, W=0.2434. +- variates skill: multivariate=0.3611, univariate=0.3531. +- Outcome: Improves the previous published package; slightly below the12000-step zero0.4 candidate. + +## E37 complete diagnostic sweep receipts +All use the own recency12000 checkpoint SHA-256 `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`; no training, fixed inference seed0. Compute below is CPU diagnostic elapsed time, not GPU training time. + +zero_mass, screen: 4.03 seconds. +- Setting 0.0: skill 0.359868; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.001: skill 0.359874; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.005: skill 0.359953; term short=0.3285, medium=0.4017, long=0.3961; domain Econ/Fin=0.1374, Energy=0.1933, Healthcare=0.3970, Nature=0.4171, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5006. +- Setting 0.02: skill 0.360509; term short=0.3292, medium=0.4020, long=0.3966; domain Econ/Fin=0.1374, Energy=0.1948, Healthcare=0.3970, Nature=0.4176, Sales=0.3480, Transport=0.4621, Web/CloudOps=0.5008. + +zero_mass, backcast: 3.65 seconds. +- Setting 0.0: skill 0.327844; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.001: skill 0.327849; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.005: skill 0.327890; term short=0.2909, medium=0.3529, long=0.3933; domain Econ/Fin=0.1636, Energy=0.2225, Healthcare=0.3816, Nature=0.3534, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.02: skill 0.328180; term short=0.2912, medium=0.3532, long=0.3937; domain Econ/Fin=0.1636, Energy=0.2229, Healthcare=0.3816, Nature=0.3537, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4409. + +zero_mass, backcast2: 3.62 seconds. +- Setting 0.0: skill 0.354561; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- Setting 0.001: skill 0.354567; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4282. +- Setting 0.005: skill 0.354631; term short=0.3398, medium=0.3829, long=0.3643; domain Econ/Fin=0.1095, Energy=0.2260, Healthcare=0.3738, Nature=0.4622, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4282. +- Setting 0.02: skill 0.354943; term short=0.3400, medium=0.3834, long=0.3646; domain Econ/Fin=0.1095, Energy=0.2266, Healthcare=0.3738, Nature=0.4627, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4283. + +zero_mass_wide, screen: 3.91 seconds. +- Setting 0.0: skill 0.359868; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.02: skill 0.360509; term short=0.3292, medium=0.4020, long=0.3966; domain Econ/Fin=0.1374, Energy=0.1948, Healthcare=0.3970, Nature=0.4176, Sales=0.3480, Transport=0.4621, Web/CloudOps=0.5008. +- Setting 0.05: skill 0.362121; term short=0.3316, medium=0.4026, long=0.3972; domain Econ/Fin=0.1374, Energy=0.1998, Healthcare=0.3970, Nature=0.4186, Sales=0.3483, Transport=0.4621, Web/CloudOps=0.5012. +- Setting 0.1: skill 0.364736; term short=0.3357, medium=0.4036, long=0.3981; domain Econ/Fin=0.1374, Energy=0.2086, Healthcare=0.3970, Nature=0.4195, Sales=0.3487, Transport=0.4621, Web/CloudOps=0.5017. + +zero_mass_wide, backcast: 3.55 seconds. +- Setting 0.0: skill 0.327844; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.02: skill 0.328180; term short=0.2912, medium=0.3532, long=0.3937; domain Econ/Fin=0.1636, Energy=0.2229, Healthcare=0.3816, Nature=0.3537, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4409. +- Setting 0.05: skill 0.328643; term short=0.2914, medium=0.3540, long=0.3942; domain Econ/Fin=0.1636, Energy=0.2235, Healthcare=0.3816, Nature=0.3546, Sales=0.3957, Transport=0.3666, Web/CloudOps=0.4415. +- Setting 0.1: skill 0.329276; term short=0.2917, medium=0.3550, long=0.3953; domain Econ/Fin=0.1636, Energy=0.2243, Healthcare=0.3816, Nature=0.3553, Sales=0.3959, Transport=0.3666, Web/CloudOps=0.4426. + +zero_mass_wide, backcast2: 3.53 seconds. +- Setting 0.0: skill 0.354561; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- Setting 0.02: skill 0.354943; term short=0.3400, medium=0.3834, long=0.3646; domain Econ/Fin=0.1095, Energy=0.2266, Healthcare=0.3738, Nature=0.4627, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4283. +- Setting 0.05: skill 0.355475; term short=0.3406, medium=0.3840, long=0.3651; domain Econ/Fin=0.1095, Energy=0.2278, Healthcare=0.3738, Nature=0.4637, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4284. +- Setting 0.1: skill 0.356263; term short=0.3413, medium=0.3849, long=0.3660; domain Econ/Fin=0.1095, Energy=0.2295, Healthcare=0.3738, Nature=0.4650, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4287. + +zero_mass_range, screen: 3.63 seconds. +- Setting 0.1: skill 0.364736; term short=0.3357, medium=0.4036, long=0.3981; domain Econ/Fin=0.1374, Energy=0.2086, Healthcare=0.3970, Nature=0.4195, Sales=0.3487, Transport=0.4621, Web/CloudOps=0.5017. +- Setting 0.2: skill 0.368575; term short=0.3420, medium=0.4046, long=0.3988; domain Econ/Fin=0.1374, Energy=0.2225, Healthcare=0.3970, Nature=0.4210, Sales=0.3475, Transport=0.4621, Web/CloudOps=0.5015. +- Setting 0.4: skill 0.370559; term short=0.3458, medium=0.4052, long=0.3979; domain Econ/Fin=0.1374, Energy=0.2332, Healthcare=0.3970, Nature=0.4205, Sales=0.3463, Transport=0.4621, Web/CloudOps=0.4986. +- Setting 0.8: skill 0.364344; term short=0.3385, medium=0.4008, long=0.3925; domain Econ/Fin=0.1374, Energy=0.2220, Healthcare=0.3970, Nature=0.4198, Sales=0.3444, Transport=0.4621, Web/CloudOps=0.4869. + +zero_mass_range, backcast: 3.50 seconds. +- Setting 0.1: skill 0.329276; term short=0.2917, medium=0.3550, long=0.3953; domain Econ/Fin=0.1636, Energy=0.2243, Healthcare=0.3816, Nature=0.3553, Sales=0.3959, Transport=0.3666, Web/CloudOps=0.4426. +- Setting 0.2: skill 0.330173; term short=0.2923, medium=0.3563, long=0.3966; domain Econ/Fin=0.1636, Energy=0.2253, Healthcare=0.3816, Nature=0.3560, Sales=0.3970, Transport=0.3666, Web/CloudOps=0.4444. +- Setting 0.4: skill 0.330696; term short=0.2928, medium=0.3550, long=0.3988; domain Econ/Fin=0.1636, Energy=0.2247, Healthcare=0.3816, Nature=0.3559, Sales=0.3972, Transport=0.3666, Web/CloudOps=0.4472. +- Setting 0.8: skill 0.327637; term short=0.2916, medium=0.3471, long=0.3961; domain Econ/Fin=0.1636, Energy=0.2180, Healthcare=0.3815, Nature=0.3525, Sales=0.3939, Transport=0.3666, Web/CloudOps=0.4454. + +zero_mass_range, backcast2: 3.39 seconds. +- Setting 0.1: skill 0.356263; term short=0.3413, medium=0.3849, long=0.3660; domain Econ/Fin=0.1095, Energy=0.2295, Healthcare=0.3738, Nature=0.4650, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4287. +- Setting 0.2: skill 0.357389; term short=0.3423, medium=0.3862, long=0.3671; domain Econ/Fin=0.1095, Energy=0.2319, Healthcare=0.3738, Nature=0.4665, Sales=0.5592, Transport=0.4168, Web/CloudOps=0.4293. +- Setting 0.4: skill 0.357884; term short=0.3425, medium=0.3883, long=0.3665; domain Econ/Fin=0.1095, Energy=0.2327, Healthcare=0.3738, Nature=0.4661, Sales=0.5573, Transport=0.4168, Web/CloudOps=0.4312. +- Setting 0.8: skill 0.350745; term short=0.3358, medium=0.3808, long=0.3588; domain Econ/Fin=0.1095, Energy=0.2213, Healthcare=0.3737, Nature=0.4523, Sales=0.5499, Transport=0.4168, Web/CloudOps=0.4272. + +zero_phase, screen: 4.24 seconds. +- Setting None: skill 0.370559; term short=0.3458, medium=0.4052, long=0.3979; domain Econ/Fin=0.1374, Energy=0.2332, Healthcare=0.3970, Nature=0.4205, Sales=0.3463, Transport=0.4621, Web/CloudOps=0.4986. +- Setting 0: skill 0.367375; term short=0.3412, medium=0.4029, long=0.3972; domain Econ/Fin=0.1374, Energy=0.2196, Healthcare=0.3970, Nature=0.4183, Sales=0.3529, Transport=0.4621, Web/CloudOps=0.5008. +- Setting 4: skill 0.369637; term short=0.3443, medium=0.4040, long=0.3986; domain Econ/Fin=0.1374, Energy=0.2277, Healthcare=0.3970, Nature=0.4202, Sales=0.3515, Transport=0.4621, Web/CloudOps=0.5001. +- Setting 8: skill 0.369822; term short=0.3448, medium=0.4037, long=0.3986; domain Econ/Fin=0.1374, Energy=0.2278, Healthcare=0.3970, Nature=0.4202, Sales=0.3518, Transport=0.4621, Web/CloudOps=0.5007. + +zero_phase, backcast: 4.22 seconds. +- Setting None: skill 0.330696; term short=0.2928, medium=0.3550, long=0.3988; domain Econ/Fin=0.1636, Energy=0.2247, Healthcare=0.3816, Nature=0.3559, Sales=0.3972, Transport=0.3666, Web/CloudOps=0.4472. +- Setting 0: skill 0.328679; term short=0.2917, medium=0.3538, long=0.3940; domain Econ/Fin=0.1636, Energy=0.2231, Healthcare=0.3816, Nature=0.3547, Sales=0.4001, Transport=0.3666, Web/CloudOps=0.4412. +- Setting 4: skill 0.329503; term short=0.2920, medium=0.3549, long=0.3957; domain Econ/Fin=0.1636, Energy=0.2254, Healthcare=0.3816, Nature=0.3555, Sales=0.3995, Transport=0.3666, Web/CloudOps=0.4415. +- Setting 8: skill 0.329633; term short=0.2921, medium=0.3549, long=0.3960; domain Econ/Fin=0.1636, Energy=0.2252, Healthcare=0.3816, Nature=0.3555, Sales=0.4003, Transport=0.3666, Web/CloudOps=0.4420. + +zero_phase, backcast2: 3.98 seconds. +- Setting None: skill 0.357884; term short=0.3425, medium=0.3883, long=0.3665; domain Econ/Fin=0.1095, Energy=0.2327, Healthcare=0.3738, Nature=0.4661, Sales=0.5573, Transport=0.4168, Web/CloudOps=0.4312. +- Setting 0: skill 0.355941; term short=0.3416, medium=0.3833, long=0.3653; domain Econ/Fin=0.1095, Energy=0.2288, Healthcare=0.3738, Nature=0.4641, Sales=0.5605, Transport=0.4168, Web/CloudOps=0.4286. +- Setting 4: skill 0.357313; term short=0.3424, medium=0.3856, long=0.3670; domain Econ/Fin=0.1095, Energy=0.2321, Healthcare=0.3738, Nature=0.4661, Sales=0.5605, Transport=0.4168, Web/CloudOps=0.4289. +- Setting 8: skill 0.357230; term short=0.3422, medium=0.3858, long=0.3672; domain Econ/Fin=0.1095, Energy=0.2314, Healthcare=0.3738, Nature=0.4664, Sales=0.5608, Transport=0.4168, Web/CloudOps=0.4291. + +E40 outcome: unrestricted E37 threshold0.4 beats all global/phase-probability guards on every cutoff. Phase4 gives0.369637/0.329503/0.357313; phase8 gives0.369822/0.329633/0.357230; unrestricted gives0.370559/0.330696/0.357884. Do not add the probability guard. + +E36 component checkpoint hashes: recency12000 `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`; control18000 `b7bbb7473a317145235c133492a0d743a90a01ff252577a4c8a4651db008a138`. These were cached diagnostic blends only, without additional training. + +## E41: learned zero-probability classifier with a frozen backbone +Hypothesis: a classifier trained on allowed windows can make the zero projection conditional on future zero probability more accurately than the empirical guards rejected in E40. Freeze E25 recency18000 and train only a small MLP on decoder representations, global zero fraction, two four-cycle phase zero frequencies and absolute normalized median forecast. The classifier receives BCE loss for exact-zero futures only on sign-homogeneous contexts containing at least4 zeros and10% zeros. At inference, average probabilities from both sign orientations and allow the existing threshold0.4 projection only for quantile levels at or below that probability. Every instance passes through the same backbone and classifier. Bias5 initialization makes probability0.993 and preserves E37 forecasts. Own packed_sample and unchanged synthetic generator; seed83, batch128, LR2e-4, 6000-step schedule, one Torch CPU thread. This adds no external data and trains no backbone parameters. + +## E35 explicit trend inputs 3000-step screen +- Checkpoint SHA-256: `17d346dde232341672545210839ea10fc6e147d6e1d65d2457497d790fc652f6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.317448616027832 seconds. +- Overall skill 0.351994; relative MASE 0.770114; relative WQL 0.545259. +- term skill: long=0.3848, medium=0.3991, short=0.3197. +- domain skill: Econ/Fin=0.1029, Energy=0.1770, Healthcare=0.4091, Nature=0.4082, Sales=0.3492, Transport=0.4538, Web/CloudOps=0.5011. +- frequency skill: A=0.3685, D=0.3335, H=0.3745, M=0.0901, Q=0.1894, S=0.4379, T=0.3955, W=0.1971. +- variates skill: multivariate=0.3833, univariate=0.3260. +- Outcome: Small improvement over matched E25: screen0.351994 versus0.351702, first earlier0.321829 versus0.321665. Continue to6000 to determine whether this persists. + +E35 training through3000 took850.6 elapsed process seconds on the shared H100. + +## E42: match training decoder horizons to available labels (prepared) +Hypothesis: short pretraining series supply fewer finite future labels than the requested32/128/512/1024 horizon, yet the current decoder sees every requested future token and receives that larger horizon in its metadata. During training only, infer each row's available horizon as its last finite target position, rounded up to the patch boundary; use that length for horizon metadata and mask unused future tokens as self-attention keys in every decoder layer. The label mask and loss remain unchanged. At inference the full requested horizon is used exactly as before, with no new inputs or fitting. Match E38 packed_sample control: own recency12000 initialization, seed79, batch256, LR5e-5, 12000 steps, unchanged sampler. No new model parameters or data. Planned to begin after the small frozen classifier releases memory; GPU evaluations are serialized to bound peak memory. + +E38 expanded corpus arm training started at 2026-10-22T04:02:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E41 initialization check: all original backbone tensors match the parent bitwise. With identical screen batches, every quantile in all97 configurations is bitwise equal to the parent; maximum difference0. The parent direct-screen score is0.374499664. The cached subset of full-validation predictions scores0.374469795 because batch composition and padding differ slightly; matched direct evaluations are used for E41 comparisons. The classifier has75,920 trainable parameters; total36,873,648. At1000/3000 steps, screen0.373402/0.374243 remains below the unchanged parent. Continue to the planned6000-step endpoint. + +E42 data diagnostic (only packed pretraining data, seed79, 640 windows per requested horizon): H32: 6.4% partial futures, mean available31.0; H128: 14.5% partial futures, mean available117.9; H512: 16.7% partial futures, mean available456.8; H1024: 19.2% partial futures, mean available886.4. CPU elapsed 0.93 seconds. A forward check verified bitwise unchanged ordinary inference and agreement within5.4e-7 between a padded masked short target and an actual short-horizon call. + +E35 first three cutoff comparisons at3000 steps: screen0.351994 versus matched0.351702; earlier1 0.321829 versus0.321665; earlier2 0.346465 versus0.346396. All gains are small; keep the6000-step comparison before drawing an architectural conclusion. + +## E22 depth36 control final24000-step screen +- Checkpoint SHA-256: `d60cdc55e693df0caf601ded61031be859ee027b0da46585586a3c6a3b5276ba`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.044859170913696 seconds. +- Overall skill 0.359867; relative MASE 0.762956; relative WQL 0.537082. +- term skill: long=0.3922, medium=0.4034, short=0.3293. +- domain skill: Econ/Fin=0.1126, Energy=0.1866, Healthcare=0.4038, Nature=0.4208, Sales=0.3464, Transport=0.4583, Web/CloudOps=0.5101. +- frequency skill: A=0.3718, D=0.3396, H=0.3822, M=0.0911, Q=0.1974, S=0.4422, T=0.4054, W=0.2072. +- variates skill: multivariate=0.3956, univariate=0.3299. +- Outcome: Final mean-template screen0.359867 improves its18000-step0.359224 but remains below E25 recency18000 at0.361265. Finished5206.4 elapsed training-process seconds; no new package selected. GPU capacity transferred to E38 expanded corpus arm. + +E42 partial target horizons training started at 2026-10-22T04:06:37Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E43: recheck fixed prior strengths on the stronger backbone +Hypothesis: the seasonal and continuity corrections selected on earlier models may be too strong after continued pretraining. Cache uncorrected symmetric neural forecasts from E25 recency18000, then compare all nine combinations of seasonal blend strength0/0.5/1 and continuity blend strength0/0.5/1. The candidate seasonal forecast is the existing aligned rule; partial strength interpolates it with the neural forecast. Continuity strength similarly interpolates the existing tau24 correction with its input. Keep the selected zero-mass threshold0.4 fixed and apply it last. Use the same global settings on all three cutoffs. No training or new data; inference seed0. + +## E41 frozen zero classifier3000-step screen +- Checkpoint SHA-256: `08b5cc376746c87331cee4628ec56126adf48076aa08ffd2f2bd3f74427d4d96`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.868639707565308 seconds. +- Overall skill 0.374243; relative MASE 0.746287; relative WQL 0.524694. +- term skill: long=0.3998, medium=0.4060, short=0.3515. +- domain skill: Econ/Fin=0.1332, Energy=0.2307, Healthcare=0.4319, Nature=0.4244, Sales=0.3502, Transport=0.4650, Web/CloudOps=0.5035. +- frequency skill: A=0.3692, D=0.3463, H=0.3950, M=0.1023, Q=0.2006, S=0.4218, T=0.4344, W=0.2127. +- variates skill: multivariate=0.3931, univariate=0.3588. +- Outcome: Screen0.374243 is below unchanged parent0.374500. Earlier1 0.331330 versus0.332400; earlier2 0.356106 versus0.356697. The classifier repairs some sales and cloud errors but gives back more solar improvement; no package change. + +## E44: training-consistent trend summary on short contexts +Code review found that the original trend basis chooses its averaging width from padded tensor width: min(128,max(4,c//4)). Training always pads to at least512, making this width128, whereas short inference batches often select smaller widths. This also makes the fixed trend summary sensitive to batch padding. Test a globally fixed128-point width at inference, preserving the exact formula used throughout training. It uses only each row's observed values; other features and all selected corrections remain unchanged. No new parameters, training or data. Compare the recency18000 checkpoint on the screen and both earlier windows before selecting a package. + +E44 first diagnostic launch failed before producing a forecast: a source-edit comment accidentally hid the adjacent recent-mean assignment. Corrected the assignment and restarted all three diagnostics; no failed output was scored or published. + +## E41 frozen zero classifier final6000-step screen +- Checkpoint SHA-256: `9dcf4fa821ca636b648447e0516258a3da7056b5e98ec944d0251c73e5ae3006`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.14689803123474 seconds. +- Overall skill 0.374576; relative MASE 0.746312; relative WQL 0.524117. +- term skill: long=0.3999, medium=0.4061, short=0.3520. +- domain skill: Econ/Fin=0.1332, Energy=0.2315, Healthcare=0.4319, Nature=0.4249, Sales=0.3502, Transport=0.4650, Web/CloudOps=0.5037. +- frequency skill: A=0.3692, D=0.3465, H=0.3951, M=0.1017, Q=0.2006, S=0.4218, T=0.4353, W=0.2127. +- variates skill: multivariate=0.3934, univariate=0.3592. +- Outcome: Final screen0.374576 versus unchanged parent0.374500 is nearly tied. Both earlier cutoffs regress:0.331200 versus0.332400 and0.356162 versus0.356697. Do not select this classifier; retain fixed zero projection. Training took559.8 process seconds; backbone stayed frozen. + +## E43 complete prior-strength comparison +Checkpoint SHA-256 `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`; fixed inference seed0; no training. + +screen: 10.68 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.352854; term short=0.3372, medium=0.3820, long=0.3635; domain Econ/Fin=0.0649, Energy=0.2249, Healthcare=0.3918, Nature=0.4305, Sales=0.3458, Transport=0.4676, Web/CloudOps=0.4394. +- Seasonal0.0, continuity0.5: skill0.358015; term short=0.3463, medium=0.3820, long=0.3639; domain Econ/Fin=0.1059, Energy=0.2325, Healthcare=0.4145, Nature=0.4284, Sales=0.3457, Transport=0.4662, Web/CloudOps=0.4421. +- Seasonal0.0, continuity1.0: skill0.358419; term short=0.3472, medium=0.3814, long=0.3642; domain Econ/Fin=0.1280, Energy=0.2289, Healthcare=0.4280, Nature=0.4258, Sales=0.3457, Transport=0.4637, Web/CloudOps=0.4444. +- Seasonal0.5, continuity0.0: skill0.361594; term short=0.3390, medium=0.3982, long=0.3816; domain Econ/Fin=0.0723, Energy=0.2304, Healthcare=0.3951, Nature=0.4304, Sales=0.3450, Transport=0.4683, Web/CloudOps=0.4668. +- Seasonal0.5, continuity0.5: skill0.367185; term short=0.3491, medium=0.3978, long=0.3823; domain Econ/Fin=0.1132, Energy=0.2381, Healthcare=0.4171, Nature=0.4282, Sales=0.3449, Transport=0.4670, Web/CloudOps=0.4713. +- Seasonal0.5, continuity1.0: skill0.367831; term short=0.3505, medium=0.3970, long=0.3826; domain Econ/Fin=0.1347, Energy=0.2340, Healthcare=0.4301, Nature=0.4256, Sales=0.3449, Transport=0.4647, Web/CloudOps=0.4751. +- Seasonal1.0, continuity0.0: skill0.366912; term short=0.3385, medium=0.4065, long=0.3980; domain Econ/Fin=0.0640, Energy=0.2315, Healthcare=0.3974, Nature=0.4301, Sales=0.3440, Transport=0.4682, Web/CloudOps=0.4881. +- Seasonal1.0, continuity0.5: skill0.373401; term short=0.3497, medium=0.4072, long=0.3989; domain Econ/Fin=0.1094, Energy=0.2393, Healthcare=0.4192, Nature=0.4280, Sales=0.3439, Transport=0.4672, Web/CloudOps=0.4952. +- Seasonal1.0, continuity1.0: skill0.374500; term short=0.3517, medium=0.4069, long=0.3994; domain Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007. + +backcast: 11.26 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.307142; term short=0.2826, medium=0.3351, long=0.3410; domain Econ/Fin=0.1076, Energy=0.2255, Healthcare=0.3430, Nature=0.3552, Sales=0.3986, Transport=0.3768, Web/CloudOps=0.3599. +- Seasonal0.0, continuity0.5: skill0.312170; term short=0.2916, medium=0.3354, long=0.3411; domain Econ/Fin=0.1400, Energy=0.2277, Healthcare=0.3844, Nature=0.3556, Sales=0.3986, Transport=0.3764, Web/CloudOps=0.3620. +- Seasonal0.0, continuity1.0: skill0.314938; term short=0.2967, medium=0.3353, long=0.3409; domain Econ/Fin=0.1539, Energy=0.2269, Healthcare=0.4209, Nature=0.3555, Sales=0.3986, Transport=0.3753, Web/CloudOps=0.3636. +- Seasonal0.5, continuity0.0: skill0.318715; term short=0.2868, medium=0.3483, long=0.3683; domain Econ/Fin=0.1210, Energy=0.2277, Healthcare=0.3359, Nature=0.3556, Sales=0.3986, Transport=0.3747, Web/CloudOps=0.4076. +- Seasonal0.5, continuity0.5: skill0.323130; term short=0.2948, medium=0.3486, long=0.3682; domain Econ/Fin=0.1519, Energy=0.2300, Healthcare=0.3781, Nature=0.3560, Sales=0.3986, Transport=0.3744, Web/CloudOps=0.4072. +- Seasonal0.5, continuity1.0: skill0.325194; term short=0.2988, medium=0.3485, long=0.3679; domain Econ/Fin=0.1645, Energy=0.2291, Healthcare=0.4163, Nature=0.3559, Sales=0.3986, Transport=0.3733, Web/CloudOps=0.4059. +- Seasonal1.0, continuity0.0: skill0.326613; term short=0.2844, medium=0.3570, long=0.3986; domain Econ/Fin=0.1011, Energy=0.2252, Healthcare=0.3156, Nature=0.3558, Sales=0.3986, Transport=0.3713, Web/CloudOps=0.4530. +- Seasonal1.0, continuity0.5: skill0.330837; term short=0.2922, medium=0.3575, long=0.3984; domain Econ/Fin=0.1366, Energy=0.2277, Healthcare=0.3596, Nature=0.3563, Sales=0.3986, Transport=0.3710, Web/CloudOps=0.4510. +- Seasonal1.0, continuity1.0: skill0.332400; term short=0.2953, medium=0.3574, long=0.3980; domain Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472. + +backcast2: 10.77 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.342833; term short=0.3444, medium=0.3372, long=0.3447; domain Econ/Fin=0.0850, Energy=0.2421, Healthcare=0.3909, Nature=0.4651, Sales=0.5517, Transport=0.4200, Web/CloudOps=0.3492. +- Seasonal0.0, continuity0.5: skill0.343238; term short=0.3448, medium=0.3374, long=0.3451; domain Econ/Fin=0.1046, Energy=0.2395, Healthcare=0.3778, Nature=0.4655, Sales=0.5516, Transport=0.4195, Web/CloudOps=0.3541. +- Seasonal0.0, continuity1.0: skill0.341670; term short=0.3421, medium=0.3372, long=0.3453; domain Econ/Fin=0.1096, Energy=0.2345, Healthcare=0.3641, Nature=0.4656, Sales=0.5516, Transport=0.4183, Web/CloudOps=0.3571. +- Seasonal0.5, continuity0.0: skill0.353176; term short=0.3476, medium=0.3630, long=0.3580; domain Econ/Fin=0.0889, Energy=0.2454, Healthcare=0.3896, Nature=0.4651, Sales=0.5517, Transport=0.4202, Web/CloudOps=0.3933. +- Seasonal0.5, continuity0.5: skill0.353075; term short=0.3473, medium=0.3630, long=0.3584; domain Econ/Fin=0.1076, Energy=0.2421, Healthcare=0.3764, Nature=0.4655, Sales=0.5516, Transport=0.4198, Web/CloudOps=0.3966. +- Seasonal0.5, continuity1.0: skill0.350860; term short=0.3435, medium=0.3626, long=0.3584; domain Econ/Fin=0.1107, Energy=0.2362, Healthcare=0.3627, Nature=0.4656, Sales=0.5516, Transport=0.4185, Web/CloudOps=0.3980. +- Seasonal1.0, continuity0.0: skill0.359824; term short=0.3464, medium=0.3881, long=0.3655; domain Econ/Fin=0.0796, Energy=0.2431, Healthcare=0.3878, Nature=0.4651, Sales=0.5517, Transport=0.4196, Web/CloudOps=0.4291. +- Seasonal1.0, continuity0.5: skill0.359396; term short=0.3456, medium=0.3880, long=0.3658; domain Econ/Fin=0.1008, Energy=0.2396, Healthcare=0.3747, Nature=0.4655, Sales=0.5516, Transport=0.4192, Web/CloudOps=0.4307. +- Seasonal1.0, continuity1.0: skill0.356697; term short=0.3411, medium=0.3874, long=0.3657; domain Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303. + +E43 outcome: retain both corrections at full strength. Seasonal full strength wins at every cutoff. Full continuity wins the main screen and first earlier cutoff; removing or weakening it helps the second earlier cutoff. Half continuity has essentially the same three-cutoff average but lowers the main screen, so the current rule is retained. This confirms that the fixed corrections still contribute after additional pretraining. + +E39 pre-launch correction: require at least one strictly positive or negative observed value before imposing the corresponding training bound. All-zero contexts otherwise satisfy both signs and would force every quantile to zero. Such contexts retain the original unconstrained training forward pass; the existing final nonnegative inference projection remains unchanged. This correction was made before E39 training started. + +E44 selected: full validation0.371267 versus previous0.370171; matched direct screen0.375386 versus0.374500; earlier1 0.333401 versus0.332400; earlier2 0.357015 versus0.356697. All improve. Full package inference took116.2 seconds under concurrent training, with97 configurations and151170 instances, zero failures and no quantile crossings. Repeated relocated examples are bitwise identical. With the actual trained model, adding left padding to histories of lengths8/16/40 changes raw forecasts by at most3.82e-6 in float32, consistent with numerical reduction differences. The averaging width is now independent of batch padding and matches all pretraining context lengths. No training or parameter changes were needed. + +## E44 fixed128 trend summary full package validation +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371267; relative MASE 0.749824; relative WQL 0.527198. +- term skill: long=0.3932, medium=0.4057, short=0.3489. +- domain skill: Econ/Fin=0.1097, Energy=0.2283, Healthcare=0.4445, Nature=0.4270, Sales=0.3536, Transport=0.4653, Web/CloudOps=0.4932. +- frequency skill: A=0.2900, D=0.3545, H=0.3906, M=0.1144, Q=0.1842, S=0.4218, T=0.4285, W=0.2081. +- variates skill: multivariate=0.3889, univariate=0.3569. +- Outcome: Published atomically. Full0.371267, screen0.375386, first earlier0.333401, second earlier0.357015. All improve over the previous package; repeated relocated inference is bitwise deterministic and all151170 instances score successfully. + +## E44 first earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.190837860107422 seconds. +- Overall skill 0.333401; relative MASE 0.800857; relative WQL 0.554849. +- term skill: long=0.3980, medium=0.3574, short=0.2971. +- domain skill: Econ/Fin=0.1546, Energy=0.2269, Healthcare=0.4152, Nature=0.3561, Sales=0.3982, Transport=0.3697, Web/CloudOps=0.4472. +- frequency skill: A=0.3057, D=0.3535, H=0.3642, M=0.1858, Q=0.2322, S=0.3397, T=0.3325, W=0.2671. +- variates skill: multivariate=0.3493, univariate=0.3205. +- Outcome: Improves the preceding published package. + +## E44 second earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.125259160995483 seconds. +- Overall skill 0.357015; relative MASE 0.773709; relative WQL 0.534347. +- term skill: long=0.3657, medium=0.3874, short=0.3417. +- domain skill: Econ/Fin=0.1037, Energy=0.2341, Healthcare=0.3586, Nature=0.4669, Sales=0.5519, Transport=0.4175, Web/CloudOps=0.4304. +- frequency skill: A=0.3474, D=0.4297, H=0.3890, M=0.1482, Q=0.1491, S=0.2798, T=0.3574, W=0.2484. +- variates skill: multivariate=0.3619, univariate=0.3530. +- Outcome: Improves the preceding published package. + +E35 follow-up: compare both6000-step models again with the now-selected E44 fixed128 basis and E37 zero0.4 rule. The old adaptive-width basis may interact with the new learned short-trend features, so this paired diagnostic will check whether their small gain changes once training/inference formulas agree. No retraining or new thresholds. + +## E31 amplitude synthetic12000-step screen +- Checkpoint SHA-256: `88d6ebecc5342e428b803fcb60af38cafa8f94383976621f3f200abee9b2eb0e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.205806970596313 seconds. +- Overall skill 0.358165; relative MASE 0.764973; relative WQL 0.538519. +- term skill: long=0.3902, medium=0.4022, short=0.3275. +- domain skill: Econ/Fin=0.1122, Energy=0.1848, Healthcare=0.3959, Nature=0.4185, Sales=0.3479, Transport=0.4568, Web/CloudOps=0.5094. +- frequency skill: A=0.3775, D=0.3345, H=0.3814, M=0.0974, Q=0.1993, S=0.4416, T=0.4040, W=0.1998. +- variates skill: multivariate=0.3933, univariate=0.3287. +- Outcome: Mean-template screen0.358165 remains above matched E25-12000 0.357241, after gains at3000 and6000. The advantage is smaller than at6000; continue to18000 and24000 before selecting a new package. + +## E35 explicit trend6000-step screen +- Checkpoint SHA-256: `2ad3f9148954d7b3a16365ec529767cc3a0803b4488c7a475838725497c13565`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.423240423202515 seconds. +- Overall skill 0.353152; relative MASE 0.769279; relative WQL 0.543902. +- term skill: long=0.3873, medium=0.3990, short=0.3208. +- domain skill: Econ/Fin=0.1103, Energy=0.1816, Healthcare=0.3998, Nature=0.4115, Sales=0.3496, Transport=0.4548, Web/CloudOps=0.4989. +- frequency skill: A=0.3705, D=0.3396, H=0.3769, M=0.0764, Q=0.1986, S=0.4369, T=0.3960, W=0.1933. +- variates skill: multivariate=0.3851, univariate=0.3265. +- Outcome: Mean-template screen0.353152 versus matched E25 0.352851; earlier1 0.323894 versus0.324008; earlier2 0.349429 versus0.349098. With all selected fixed rules, screen0.366300 versus matched0.366032. The effect remains small; retain checkpoints and compare at12000. + +amplitude_synth through12000: 3311.5 elapsed training-process seconds on the shared H100. + +trend_features through6000: 1795.6 elapsed training-process seconds on the shared H100. + +E39 bounded quantiles training started at 2026-10-22T04:19:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E25 recency final24000-step matched mean-template screen +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.549001216888428 seconds. +- Overall skill 0.361808; relative MASE 0.760201; relative WQL 0.535765. +- term skill: long=0.3930, medium=0.4043, short=0.3321. +- domain skill: Econ/Fin=0.1144, Energy=0.1875, Healthcare=0.4304, Nature=0.4242, Sales=0.3432, Transport=0.4595, Web/CloudOps=0.5080. +- frequency skill: A=0.3731, D=0.3487, H=0.3832, M=0.0957, Q=0.1965, S=0.4423, T=0.4054, W=0.2079. +- variates skill: multivariate=0.3953, univariate=0.3338. +- Outcome: Final screen0.361808 versus matched E22-24000 0.359867. The learned recency features improve the matched comparison at every evaluated checkpoint. Completed5879.4 elapsed training-process seconds; full validation with selected fixed rules is pending. + +## E38 expanded corpus3000-step screen +- Checkpoint SHA-256: `13cb3d2a222cd09f622eff3fe1657c4aebe2b1f2ca22a226462ecd0bb2c94026`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.664713144302368 seconds. +- Overall skill 0.358667; relative MASE 0.763557; relative WQL 0.538674. +- term skill: long=0.3925, medium=0.4038, short=0.3268. +- domain skill: Econ/Fin=0.1145, Energy=0.1852, Healthcare=0.4021, Nature=0.4196, Sales=0.3470, Transport=0.4576, Web/CloudOps=0.5080. +- frequency skill: A=0.3749, D=0.3373, H=0.3835, M=0.0979, Q=0.1983, S=0.4405, T=0.4029, W=0.1974. +- variates skill: multivariate=0.3933, univariate=0.3297. +- Outcome: Screen0.358667 versus matched packed_sample control0.358802: nearly tied. Broader corpus coverage has not yet provided a clear advantage. Continue to6000 and12000; source probabilities remain fixed to the original mixture. + +## E38 packed_sample control6000-step screen +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.290119647979736 seconds. +- Overall skill 0.358628; relative MASE 0.763471; relative WQL 0.538799. +- term skill: long=0.3894, medium=0.4025, short=0.3286. +- domain skill: Econ/Fin=0.1093, Energy=0.1839, Healthcare=0.4157, Nature=0.4245, Sales=0.3451, Transport=0.4579, Web/CloudOps=0.5041. +- frequency skill: A=0.3762, D=0.3427, H=0.3805, M=0.1014, Q=0.1966, S=0.4404, T=0.4018, W=0.2035. +- variates skill: multivariate=0.3910, univariate=0.3316. +- Outcome: Screen0.358628 versus this restart at3000 0.358802. This restart has not surpassed uninterrupted E25 continuation. Retain as the matched control for corpus coverage, bounded quantiles and partial target horizons; assess after learning-rate decay. + +## E45: average late recency checkpoints +Hypothesis: uniform parameter averaging of the same training trajectory can reduce checkpoint variation without adding inference cost. Average own E25 EMA checkpoints at18000/21000/24000 in FP32, retaining their shared configuration. This is one model with fixed averaged weights; every parent was trained here from the same random-initialization lineage, seed59. No additional data or gradient updates. Use the selected aligned seasonal rule, continuity, zero0.4 and fixed128 trend basis. Evaluate all three cutoffs before building a full candidate. The averaging script and every parent hash are preserved. + +E25 final24000-step package selected: full0.371479 versus18000-step0.371267; direct screen0.375502 versus0.375386; first earlier0.334180 versus0.333401; second earlier0.358275 versus0.357015. All improve. Full inference126.1 seconds under concurrent training;97 configurations,151170 instances, zero failures and no quantile crossings. Repeated relocated examples are bitwise identical, finite and monotone. Fixed rules are unchanged from E44. + +E45 outcome: the uniform18000/21000/24000 EMA average scores0.375408/0.333912/0.358081 on the three cutoffs, below the final24000 checkpoint at0.375502/0.334180/0.358275 on every cutoff. Not selected; no full package evaluation. No training compute; parameter averaging was not separately timed, and individual diagnostic evaluation times are recorded below. + +## E25 final24000-step package with selected fixed rules +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371479; relative MASE 0.748783; relative WQL 0.527575. +- term skill: long=0.3935, medium=0.4057, short=0.3491. +- domain skill: Econ/Fin=0.1165, Energy=0.2279, Healthcare=0.4442, Nature=0.4287, Sales=0.3521, Transport=0.4652, Web/CloudOps=0.4925. +- frequency skill: A=0.2919, D=0.3570, H=0.3902, M=0.1164, Q=0.1836, S=0.4232, T=0.4289, W=0.2028. +- variates skill: multivariate=0.3893, univariate=0.3569. +- Outcome: Published atomically. Full0.371479, screen0.375502, earlier1 0.334180, earlier2 0.358275. All improve over the preceding18000-step package. All151170 instances score; repeated relocated examples are bitwise deterministic, finite and monotone. + +## Published recency24000 first earlier diagnostic +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.669825792312622 seconds. +- Overall skill 0.334180; relative MASE 0.799611; relative WQL 0.554415. +- term skill: long=0.3968, medium=0.3571, short=0.2993. +- domain skill: Econ/Fin=0.1593, Energy=0.2277, Healthcare=0.4063, Nature=0.3608, Sales=0.3980, Transport=0.3712, Web/CloudOps=0.4466. +- frequency skill: A=0.3097, D=0.3512, H=0.3634, M=0.1820, Q=0.2352, S=0.3426, T=0.3343, W=0.2771. +- variates skill: multivariate=0.3511, univariate=0.3204. +- Outcome: Improves the preceding package. + +## Published recency24000 second earlier diagnostic +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.378834009170532 seconds. +- Overall skill 0.358275; relative MASE 0.771140; relative WQL 0.534029. +- term skill: long=0.3653, medium=0.3854, short=0.3449. +- domain skill: Econ/Fin=0.1098, Energy=0.2362, Healthcare=0.3503, Nature=0.4701, Sales=0.5516, Transport=0.4194, Web/CloudOps=0.4299. +- frequency skill: A=0.3501, D=0.4315, H=0.3891, M=0.1569, Q=0.1519, S=0.2833, T=0.3571, W=0.2551. +- variates skill: multivariate=0.3625, univariate=0.3548. +- Outcome: Improves the preceding package. + +## E45 averaged late EMA screen +- Checkpoint SHA-256: `9b3541cfc195324574d22e27a8e3ac38edf7408712372933c645c892f39fa746`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.790673971176147 seconds. +- Overall skill 0.375408; relative MASE 0.746595; relative WQL 0.522527. +- term skill: long=0.3999, medium=0.4064, short=0.3534. +- domain skill: Econ/Fin=0.1379, Energy=0.2352, Healthcare=0.4383, Nature=0.4274, Sales=0.3404, Transport=0.4653, Web/CloudOps=0.5004. +- frequency skill: A=0.3761, D=0.3516, H=0.3953, M=0.0934, Q=0.2004, S=0.4222, T=0.4355, W=0.2141. +- variates skill: multivariate=0.3931, univariate=0.3610. +- Outcome: Below the final24000 checkpoint on all three cutoffs; not selected. + +## E42 partial target horizons3000-step screen +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.083299160003662 seconds. +- Overall skill 0.358812; relative MASE 0.763592; relative WQL 0.538405. +- term skill: long=0.3907, medium=0.4016, short=0.3287. +- domain skill: Econ/Fin=0.1123, Energy=0.1842, Healthcare=0.4163, Nature=0.4220, Sales=0.3469, Transport=0.4589, Web/CloudOps=0.5047. +- frequency skill: A=0.3754, D=0.3440, H=0.3817, M=0.1026, Q=0.1980, S=0.4409, T=0.3995, W=0.2076. +- variates skill: multivariate=0.3908, univariate=0.3321. +- Outcome: Screen0.358812 versus matched control0.358802 is effectively tied. Gains in annual, quarterly, monthly and weekly groups are offset by minute-frequency losses. Continue to6000 and12000 to assess persistence. + +## E46: use forecast slopes for the fixed continuity correction +A per-channel diagnostic found that several ETT2 short-horizon forecasts underreact to a rebound after the latest trough: truth rises about1.1–1.9 context standard deviations in multiple channels, while the model rises only0.6–0.9. The current continuity anchor extrapolates the previous eight differences and may continue the old direction across a turn. Keep the smoothness gate, tau24, seasonal rule and zero0.4 fixed; compare past8 (current), zero slope, first forecast difference, and median of the first eight forecast differences. These are fixed transformations, with no fitting. Reuse the E25-18000 raw forecast caches for a paired diagnostic on all three cutoffs; their old short-context trend basis is unchanged within this comparison. Any selected variant must transfer to the latest fixed128 package before publication. + +## E47: frozen-backbone confidence-query projection (prepared) +Hypothesis: fixed lag-difference statistics provide information about local noise and seasonal repeatability that the decoder may otherwise infer inefficiently from raw patches. Add a zero-initialized linear projection of six log-scaled normalized statistics: MAE and RMS difference at lag1 over512 points, and at each of the two frequency-derived periods over at most8 cycles. Fewer than8 valid pairs use neutral defaults1 and sqrt(2). The3072 new parameters affect decoder queries; freeze the complete E25 recency24000 backbone. Train with the original weighted quantile/median loss after averaging both sign orientations, matching inference. Own packed_sample and unchanged local generator, seed89, planned6000 steps atLR2e-4. Choose batch64 or32 after measuring maximum-shape memory, keeping the six existing trainers and serialized evaluations within the one H100. No new training data. + +E47 memory check at batch64 (paired batch128), context4096 and horizon1024 used1134.4 MiB peak allocated and1160.0 MiB peak reserved Torch memory. Gradients were finite; no optimizer update or checkpoint was made from the random fixture. Start the planned6000-step run at batch64 with only3072 trainable parameters. + +## E46 complete slope comparison +No training; checkpoint SHA-256 `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`; fixed inference seed0. + +screen: 9.50 CPU diagnostic seconds. +- past8: skill0.374500; term short=0.3517, medium=0.4069, long=0.3994; domain Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- none: skill0.370718; term short=0.3457, medium=0.4054, long=0.3986; domain Econ/Fin=0.1111, Energy=0.2246, Healthcare=0.4321, Nature=0.4266, Sales=0.3438, Transport=0.4648, Web/CloudOps=0.4996; freq A-DEC=0.3202, Q-DEC=0.1821, M=0.1025, W-SUN=0.0486, D=0.3438, H=0.3946, 15T=0.2087, W-FRI=0.0306, 10T=0.5876, W-TUE=0.5831, W-THU=0.1779, W-WED=0.3133, 5T=0.5117, 10S=0.4176. +- future1: skill0.374205; term short=0.3511, medium=0.4072, long=0.3991; domain Econ/Fin=0.1137, Energy=0.2347, Healthcare=0.4268, Nature=0.4274, Sales=0.3439, Transport=0.4665, Web/CloudOps=0.5017; freq A-DEC=0.3598, Q-DEC=0.1662, M=0.1001, W-SUN=0.0181, D=0.3420, H=0.3984, 15T=0.2072, W-FRI=0.0122, 10T=0.6164, W-TUE=0.5675, W-THU=0.1755, W-WED=0.3133, 5T=0.5109, 10S=0.4256. +- future8: skill0.373161; term short=0.3495, medium=0.4067, long=0.3990; domain Econ/Fin=0.1251, Energy=0.2298, Healthcare=0.4305, Nature=0.4272, Sales=0.3439, Transport=0.4643, Web/CloudOps=0.5016; freq A-DEC=0.3602, Q-DEC=0.1852, M=0.1008, W-SUN=0.0383, D=0.3439, H=0.3960, 15T=0.2096, W-FRI=-0.0017, 10T=0.6059, W-TUE=0.5789, W-THU=0.1738, W-WED=0.3133, 5T=0.5112, 10S=0.4252. + +backcast: 9.40 CPU diagnostic seconds. +- past8: skill0.332400; term short=0.2953, medium=0.3574, long=0.3980; domain Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- none: skill0.329297; term short=0.2895, medium=0.3574, long=0.3980; domain Econ/Fin=0.1286, Energy=0.2253, Healthcare=0.3653, Nature=0.3586, Sales=0.3986, Transport=0.3702, Web/CloudOps=0.4470; freq A-DEC=0.2562, Q-DEC=0.2285, M=0.1591, W-SUN=-0.0090, D=0.3530, H=0.3630, 15T=0.2276, W-FRI=0.2653, 10T=0.3102, W-TUE=0.4340, W-THU=0.1790, W-WED=0.3474, 5T=0.4328, 10S=0.3392. +- future1: skill0.331443; term short=0.2936, medium=0.3572, long=0.3981; domain Econ/Fin=0.1560, Energy=0.2259, Healthcare=0.3803, Nature=0.3573, Sales=0.3986, Transport=0.3708, Web/CloudOps=0.4467; freq A-DEC=0.2946, Q-DEC=0.2075, M=0.1779, W-SUN=-0.0420, D=0.3531, H=0.3699, 15T=0.2218, W-FRI=0.2626, 10T=0.3062, W-TUE=0.4321, W-THU=0.1844, W-WED=0.3474, 5T=0.4320, 10S=0.3387. +- future8: skill0.330724; term short=0.2923, medium=0.3572, long=0.3980; domain Econ/Fin=0.1495, Energy=0.2260, Healthcare=0.3767, Nature=0.3568, Sales=0.3986, Transport=0.3706, Web/CloudOps=0.4462; freq A-DEC=0.2971, Q-DEC=0.2312, M=0.1706, W-SUN=-0.0239, D=0.3528, H=0.3662, 15T=0.2272, W-FRI=0.2646, 10T=0.3066, W-TUE=0.4419, W-THU=0.1812, W-WED=0.3474, 5T=0.4320, 10S=0.3363. + +backcast2: 9.16 CPU diagnostic seconds. +- past8: skill0.356697; term short=0.3411, medium=0.3874, long=0.3657; domain Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- none: skill0.356132; term short=0.3406, medium=0.3873, long=0.3643; domain Econ/Fin=0.0852, Energy=0.2311, Healthcare=0.3675, Nature=0.4661, Sales=0.5516, Transport=0.4189, Web/CloudOps=0.4316; freq A-DEC=0.3237, Q-DEC=0.1547, M=0.1618, W-SUN=0.0515, D=0.4258, H=0.3870, 15T=0.1053, W-FRI=0.1317, 10T=0.4935, W-TUE=0.1348, W-THU=0.2945, W-WED=0.5352, 5T=0.4648, 10S=0.2854. +- future1: skill0.355261; term short=0.3386, medium=0.3872, long=0.3657; domain Econ/Fin=0.1174, Energy=0.2356, Healthcare=0.3303, Nature=0.4652, Sales=0.5516, Transport=0.4184, Web/CloudOps=0.4253; freq A-DEC=0.3497, Q-DEC=0.1386, M=0.1530, W-SUN=0.0379, D=0.4238, H=0.3954, 15T=0.1038, W-FRI=0.1264, 10T=0.4929, W-TUE=-0.1191, W-THU=0.2956, W-WED=0.5352, 5T=0.4644, 10S=0.2668. +- future8: skill0.355137; term short=0.3386, medium=0.3873, long=0.3650; domain Econ/Fin=0.1032, Energy=0.2310, Healthcare=0.3342, Nature=0.4659, Sales=0.5516, Transport=0.4189, Web/CloudOps=0.4316; freq A-DEC=0.3492, Q-DEC=0.1479, M=0.1571, W-SUN=0.0462, D=0.4251, H=0.3890, 15T=0.1053, W-FRI=0.1264, 10T=0.4931, W-TUE=-0.1021, W-THU=0.2982, W-WED=0.5352, 5T=0.4643, 10S=0.2886. + +E46 outcome: retain the existing past-eight-difference slope. It beats zero slope and both forecast-derived slopes on every cutoff. The local turning-point explanation does not justify changing the global correction. + +## E48: phase diffusion in synthetic seasonal series (queued) +Hypothesis: varying seasonal phase teaches the model when distant cycles should lose confidence, complementing E31's amplitude variation. Keep E31 unchanged except that half of synthetic calls add a Brownian phase to each Fourier period, shared across its harmonics. Draw one-cycle fundamental correlation log-uniformly from 0.90 to 0.999, with increment standard deviation sqrt(-2 log(correlation) / period). Phase RNG seed is 200062, independent of sampler seed 59 and amplitude seed 100062. Real corpus windows, frequency choices, all original generator draws, and amplitude draws remain matched to E31. A data-only check of 256 rows at each synthetic fraction 0, 0.2 and 1 verified equal original and amplitude RNG states; all corpus-only arrays were bitwise equal, and every finite output stayed finite (8.30 CPU seconds). No validation labels are used in this generator or training. + +Initialize from our E17 patch16 EMA6000; same E25 architecture, batch 256, LR 8e-5, 24000-step cosine schedule, seed 59, save every 3000. Compare to cached E31 at matched checkpoints and three cutoffs before publication. Queue after E38 control completes 12000, retaining at most six heavy trainers on the one H100. Directory phase_synth contains code and sampler_check.json; generator must be declared separately in sources_used if selected. + +## E49: uncertainty shape in the fixed seasonal correction +Hypothesis: rare seasonal jumps inflate Gaussian RMS intervals in otherwise regular series. Keep the selected seasonal median, confidence gate, continuity correction and zero projection fixed; compare Gaussian RMS intervals with centered empirical seasonal-difference quantiles and Gaussian MAD intervals. All widths use the same sqrt((1+1/cycles)/2) averaging correction. Empirical residual median is subtracted so the median forecast is unchanged. These are fixed context formulas, with no optimization. Reuse E25-18000 raw caches for an inexpensive paired test across three cutoffs; transfer any consistent improvement to the current E25-24000 fixed128 runtime before publication. No training and no new sources. + +## E38 expanded-corpus 6000-step screen +- Checkpoint SHA-256: `6f0068b79fbc501fb1ec9a76c88d91ceb9ffca46096900c18f5157a19784678f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.27088236808777 seconds. +- Overall skill 0.358532; relative MASE 0.764393; relative WQL 0.538311. +- term skill: long=0.3918, medium=0.4028, short=0.3272. +- domain skill: Econ/Fin=0.1142, Energy=0.1855, Healthcare=0.3972, Nature=0.4197, Sales=0.3475, Transport=0.4581, Web/CloudOps=0.5080. +- frequency skill: A=0.3713, D=0.3310, H=0.3829, M=0.1077, Q=0.2043, S=0.4384, T=0.4038, W=0.2044. +- variates skill: multivariate=0.3933, univariate=0.3295. +- Outcome: Skill 0.358532 versus matched control 0.358628: near tie, with no demonstrated benefit from the larger packed corpus. Continue to 12000. + +## E39 bounded quantiles 3000-step screen +- Checkpoint SHA-256: `3932f19e396a2ec597a047116ad2e4b680a0e7c9638472434388843bd358b4c7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.178418159484863 seconds. +- Overall skill 0.358466; relative MASE 0.764176; relative WQL 0.538575. +- term skill: long=0.3917, medium=0.4021, short=0.3274. +- domain skill: Econ/Fin=0.1098, Energy=0.1842, Healthcare=0.4143, Nature=0.4191, Sales=0.3505, Transport=0.4583, Web/CloudOps=0.5059. +- frequency skill: A=0.3753, D=0.3428, H=0.3828, M=0.0891, Q=0.1957, S=0.4411, T=0.4011, W=0.1992. +- variates skill: multivariate=0.3924, univariate=0.3301. +- Outcome: Skill 0.358466 versus control 0.358802: a small regression. Continue to 6000 before selection. + +## E35 trend-query features 12000-step screen +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.890631914138794 seconds. +- Overall skill 0.357547; relative MASE 0.765787; relative WQL 0.538983. +- term skill: long=0.3905, medium=0.4007, short=0.3268. +- domain skill: Econ/Fin=0.1107, Energy=0.1852, Healthcare=0.4068, Nature=0.4159, Sales=0.3502, Transport=0.4572, Web/CloudOps=0.5058. +- frequency skill: A=0.3786, D=0.3384, H=0.3803, M=0.0973, Q=0.2012, S=0.4413, T=0.4010, W=0.2023. +- variates skill: multivariate=0.3916, univariate=0.3291. +- Outcome: Skill 0.357547 versus recency control 0.357241: another small gain. Matched earlier-cutoff checks are running. + +## E31 amplitude variation 18000-step screen +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.11006808280945 seconds. +- Overall skill 0.361640; relative MASE 0.761418; relative WQL 0.535190. +- term skill: long=0.3939, medium=0.4045, short=0.3314. +- domain skill: Econ/Fin=0.1093, Energy=0.1877, Healthcare=0.4199, Nature=0.4206, Sales=0.3451, Transport=0.4594, Web/CloudOps=0.5124. +- frequency skill: A=0.3693, D=0.3400, H=0.3834, M=0.0980, Q=0.2014, S=0.4419, T=0.4075, W=0.2126. +- variates skill: multivariate=0.3966, univariate=0.3324. +- Outcome: Skill 0.361640 versus recency control 0.361265: a small gain persists. Transfer to the current fixed inference rules on three cutoffs before selection. + +## E42 paired comparison: large_corpus_control 6000, screen +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.290119647979736 seconds. +- Overall skill 0.358628; relative MASE 0.763471; relative WQL 0.538799. +- term skill: long=0.3894, medium=0.4025, short=0.3286. +- domain skill: Econ/Fin=0.1093, Energy=0.1839, Healthcare=0.4157, Nature=0.4245, Sales=0.3451, Transport=0.4579, Web/CloudOps=0.5041. +- frequency skill: A=0.3762, D=0.3427, H=0.3805, M=0.1014, Q=0.1966, S=0.4404, T=0.4018, W=0.2035. +- variates skill: multivariate=0.3910, univariate=0.3316. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, screen +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.865007400512695 seconds. +- Overall skill 0.359222; relative MASE 0.762879; relative WQL 0.538220. +- term skill: long=0.3896, medium=0.4026, short=0.3295. +- domain skill: Econ/Fin=0.1138, Energy=0.1865, Healthcare=0.4140, Nature=0.4258, Sales=0.3420, Transport=0.4581, Web/CloudOps=0.5030. +- frequency skill: A=0.3767, D=0.3422, H=0.3805, M=0.1063, Q=0.1975, S=0.4407, T=0.4017, W=0.2108. +- variates skill: multivariate=0.3906, univariate=0.3331. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: large_corpus_control 6000, backcast +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.584256172180176 seconds. +- Overall skill 0.329632; relative MASE 0.806661; relative WQL 0.557102. +- term skill: long=0.3889, medium=0.3561, short=0.2948. +- domain skill: Econ/Fin=0.1442, Energy=0.2289, Healthcare=0.4117, Nature=0.3487, Sales=0.3954, Transport=0.3632, Web/CloudOps=0.4421. +- frequency skill: A=0.3117, D=0.3564, H=0.3572, M=0.1570, Q=0.2265, S=0.3417, T=0.3299, W=0.2668. +- variates skill: multivariate=0.3466, univariate=0.3158. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, backcast +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.306365728378296 seconds. +- Overall skill 0.330300; relative MASE 0.806062; relative WQL 0.556406. +- term skill: long=0.3903, medium=0.3564, short=0.2953. +- domain skill: Econ/Fin=0.1490, Energy=0.2297, Healthcare=0.4089, Nature=0.3480, Sales=0.3970, Transport=0.3635, Web/CloudOps=0.4436. +- frequency skill: A=0.3192, D=0.3533, H=0.3582, M=0.1614, Q=0.2265, S=0.3433, T=0.3300, W=0.2726. +- variates skill: multivariate=0.3477, univariate=0.3161. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: large_corpus_control 6000, backcast2 +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.882598161697388 seconds. +- Overall skill 0.352570; relative MASE 0.776245; relative WQL 0.539992. +- term skill: long=0.3679, medium=0.3749, short=0.3381. +- domain skill: Econ/Fin=0.0867, Energy=0.2280, Healthcare=0.3674, Nature=0.4604, Sales=0.5586, Transport=0.4130, Web/CloudOps=0.4272. +- frequency skill: A=0.3401, D=0.4293, H=0.3864, M=0.1768, Q=0.1515, S=0.2810, T=0.3448, W=0.2406. +- variates skill: multivariate=0.3588, univariate=0.3475. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, backcast2 +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.302276849746704 seconds. +- Overall skill 0.352901; relative MASE 0.775671; relative WQL 0.539838. +- term skill: long=0.3689, medium=0.3760, short=0.3379. +- domain skill: Econ/Fin=0.0894, Energy=0.2294, Healthcare=0.3710, Nature=0.4595, Sales=0.5574, Transport=0.4132, Web/CloudOps=0.4264. +- frequency skill: A=0.3430, D=0.4260, H=0.3868, M=0.1778, Q=0.1500, S=0.2820, T=0.3450, W=0.2490. +- variates skill: multivariate=0.3587, univariate=0.3482. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E49 complete seasonal interval comparison +No training; inference seed 0. Own E25-18000 checkpoint SHA-256 f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd. + +screen: 12.53 CPU diagnostic seconds. +- gaussian: skill 0.374500; term: short=0.3517, medium=0.4069, long=0.3994; domain: Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- empirical: skill 0.374034; term: short=0.3515, medium=0.4062, long=0.3984; domain: Econ/Fin=0.1322, Energy=0.2332, Healthcare=0.4326, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5005; freq: A-DEC=0.3692, Q-DEC=0.2007, M=0.1029, W-SUN=0.0515, D=0.3443, H=0.3941, 15T=0.2120, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4208. +- mad: skill 0.373768; term: short=0.3513, medium=0.4061, long=0.3979; domain: Econ/Fin=0.1328, Energy=0.2325, Healthcare=0.4325, Nature=0.4254, Sales=0.3438, Transport=0.4649, Web/CloudOps=0.5001; freq: A-DEC=0.3692, Q-DEC=0.2007, M=0.1027, W-SUN=0.0515, D=0.3444, H=0.3938, 15T=0.2115, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4194. + +backcast: 12.04 CPU diagnostic seconds. +- gaussian: skill 0.332400; term: short=0.2953, medium=0.3574, long=0.3980; domain: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- empirical: skill 0.332227; term: short=0.2954, medium=0.3563, long=0.3981; domain: Econ/Fin=0.1521, Energy=0.2257, Healthcare=0.3995, Nature=0.3558, Sales=0.3986, Transport=0.3697, Web/CloudOps=0.4482; freq: A-DEC=0.2996, Q-DEC=0.2331, M=0.1717, W-SUN=-0.0053, D=0.3516, H=0.3630, 15T=0.2257, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4330, 10S=0.3436. +- mad: skill 0.331760; term: short=0.2949, medium=0.3559, long=0.3977; domain: Econ/Fin=0.1517, Energy=0.2248, Healthcare=0.3984, Nature=0.3554, Sales=0.3986, Transport=0.3696, Web/CloudOps=0.4480; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1720, W-SUN=-0.0052, D=0.3511, H=0.3620, 15T=0.2253, W-FRI=0.2597, 10T=0.3129, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4330, 10S=0.3430. + +backcast2: 10.81 CPU diagnostic seconds. +- gaussian: skill 0.356697; term: short=0.3411, medium=0.3874, long=0.3657; domain: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq: A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- empirical: skill 0.356537; term: short=0.3408, medium=0.3876, long=0.3655; domain: Econ/Fin=0.1035, Energy=0.2316, Healthcare=0.3619, Nature=0.4656, Sales=0.5516, Transport=0.4178, Web/CloudOps=0.4315; freq: A-DEC=0.3474, Q-DEC=0.1549, M=0.1602, W-SUN=0.0311, D=0.4277, H=0.3876, 15T=0.1075, W-FRI=0.1243, 10T=0.4929, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2846. +- mad: skill 0.356717; term: short=0.3409, medium=0.3871, long=0.3665; domain: Econ/Fin=0.1039, Energy=0.2307, Healthcare=0.3619, Nature=0.4656, Sales=0.5516, Transport=0.4176, Web/CloudOps=0.4335; freq: A-DEC=0.3474, Q-DEC=0.1549, M=0.1602, W-SUN=0.0312, D=0.4278, H=0.3869, 15T=0.1072, W-FRI=0.1243, 10T=0.4929, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2923. + +Outcome: retain Gaussian RMS intervals. Centered empirical intervals lose at all three cutoffs. MAD loses on the main and first earlier cutoff, with only a negligible second-earlier gain. Median MASE is exactly unchanged for every setting as intended. No transfer or package change. + +## E35 matched 12000 comparison: recency_features, screen +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.589985609054565 seconds. +- Overall skill 0.357241; relative MASE 0.765658; relative WQL 0.539588. +- term skill: long=0.3912, medium=0.4026, short=0.3252. +- domain skill: Econ/Fin=0.1133, Energy=0.1855, Healthcare=0.3939, Nature=0.4171, Sales=0.3483, Transport=0.4566, Web/CloudOps=0.5065. +- frequency skill: A=0.3781, D=0.3343, H=0.3817, M=0.0906, Q=0.1961, S=0.4411, T=0.4020, W=0.1998. +- variates skill: multivariate=0.3920, univariate=0.3281. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, screen +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.890631914138794 seconds. +- Overall skill 0.357547; relative MASE 0.765787; relative WQL 0.538983. +- term skill: long=0.3905, medium=0.4007, short=0.3268. +- domain skill: Econ/Fin=0.1107, Energy=0.1852, Healthcare=0.4068, Nature=0.4159, Sales=0.3502, Transport=0.4572, Web/CloudOps=0.5058. +- frequency skill: A=0.3786, D=0.3384, H=0.3803, M=0.0973, Q=0.2012, S=0.4413, T=0.4010, W=0.2023. +- variates skill: multivariate=0.3916, univariate=0.3291. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: recency_features, backcast +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.742298364639282 seconds. +- Overall skill 0.328112; relative MASE 0.807765; relative WQL 0.558868. +- term skill: long=0.3899, medium=0.3548, short=0.2920. +- domain skill: Econ/Fin=0.1488, Energy=0.2248, Healthcare=0.4036, Nature=0.3514, Sales=0.3955, Transport=0.3613, Web/CloudOps=0.4413. +- frequency skill: A=0.3134, D=0.3558, H=0.3562, M=0.1567, Q=0.2256, S=0.3420, T=0.3267, W=0.2651. +- variates skill: multivariate=0.3435, univariate=0.3156. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, backcast +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.06494641304016 seconds. +- Overall skill 0.327724; relative MASE 0.808759; relative WQL 0.558826. +- term skill: long=0.3886, medium=0.3555, short=0.2916. +- domain skill: Econ/Fin=0.1436, Energy=0.2247, Healthcare=0.3984, Nature=0.3522, Sales=0.3952, Transport=0.3621, Web/CloudOps=0.4411. +- frequency skill: A=0.3149, D=0.3546, H=0.3559, M=0.1602, Q=0.2281, S=0.3419, T=0.3284, W=0.2545. +- variates skill: multivariate=0.3441, univariate=0.3144. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: recency_features, backcast2 +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.009191036224365 seconds. +- Overall skill 0.353202; relative MASE 0.774939; relative WQL 0.539846. +- term skill: long=0.3671, medium=0.3766, short=0.3388. +- domain skill: Econ/Fin=0.0874, Energy=0.2254, Healthcare=0.3808, Nature=0.4621, Sales=0.5594, Transport=0.4116, Web/CloudOps=0.4293. +- frequency skill: A=0.3385, D=0.4312, H=0.3856, M=0.1786, Q=0.1474, S=0.2819, T=0.3451, W=0.2459. +- variates skill: multivariate=0.3594, univariate=0.3481. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, backcast2 +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.192188262939453 seconds. +- Overall skill 0.353075; relative MASE 0.775525; relative WQL 0.539650. +- term skill: long=0.3664, medium=0.3761, short=0.3391. +- domain skill: Econ/Fin=0.0837, Energy=0.2262, Healthcare=0.3801, Nature=0.4640, Sales=0.5598, Transport=0.4112, Web/CloudOps=0.4272. +- frequency skill: A=0.3402, D=0.4277, H=0.3854, M=0.1847, Q=0.1490, S=0.2774, T=0.3477, W=0.2433. +- variates skill: multivariate=0.3593, univariate=0.3480. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E50: paired-sign loss for a frozen-backbone output head +Hypothesis: training against the averaged positive/negative forecasts used at inference can improve calibration over separately scoring the two orientations. Both arms initialize from our selected E25-24000 checkpoint with fixed128 trend features and freeze every parameter except the existing 147744-parameter output head. Both forward the same context and its sign reflection, consuming identical seed97 data windows. Control scores each orientation independently; candidate averages the two normalized forecasts before the original weighted quantile/median loss. This isolates the loss rather than data augmentation or forward compute. Same packed_sample, original local generator and independent sign augmentation, batch64, LR5e-5, 6000-step cosine schedule, save1000. No new data, no validation training, no parameter additions. + +A maximum-shape random fixture (paired batch128, context4096, horizon1024) verified finite gradients and measured peak Torch allocation697 MiB for the individual-loss control and729 MiB for the paired-loss candidate, with822 MiB reserved in each. No optimizer update or checkpoint was made from the fixture. Start the control after the rejected E35 trainer exits; start the paired arm after E47 finishes, keeping to one H100. The same fixed runtime evaluates both. + +E50 head_control training started at 2026-10-22T04:52:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E50 head_paired training started at 2026-10-22T04:53:18Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E35 stopped cleanly at step 13309, with 4327.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `be7cce34037750ef56be8a183b68af46dc2deec184ad228cd4c60ab91b51eb48`. The last validation was the paired 12000-step comparison above; the stop checkpoint was saved for provenance, not selected. + +## E31 amplitude 18000 with selected fixed rules, screen +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.18380904197693 seconds. +- Overall skill 0.375271; relative MASE 0.747344; relative WQL 0.522231. +- term skill: long=0.4000, medium=0.4069, short=0.3529. +- domain skill: Econ/Fin=0.1337, Energy=0.2361, Healthcare=0.4224, Nature=0.4258, Sales=0.3419, Transport=0.4649, Web/CloudOps=0.5043. +- frequency skill: A=0.3721, D=0.3448, H=0.3951, M=0.0876, Q=0.2019, S=0.4223, T=0.4386, W=0.2158. +- variates skill: multivariate=0.3950, univariate=0.3591. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E31 amplitude 18000 with selected fixed rules, backcast +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.348726511001587 seconds. +- Overall skill 0.333200; relative MASE 0.800924; relative WQL 0.555137. +- term skill: long=0.3941, medium=0.3576, short=0.2985. +- domain skill: Econ/Fin=0.1568, Energy=0.2260, Healthcare=0.4100, Nature=0.3583, Sales=0.3987, Transport=0.3697, Web/CloudOps=0.4467. +- frequency skill: A=0.3095, D=0.3534, H=0.3637, M=0.1993, Q=0.2273, S=0.3378, T=0.3326, W=0.2601. +- variates skill: multivariate=0.3488, univariate=0.3205. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E31 amplitude 18000 with selected fixed rules, backcast2 +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.135295629501343 seconds. +- Overall skill 0.356896; relative MASE 0.774845; relative WQL 0.533762. +- term skill: long=0.3678, medium=0.3811, short=0.3433. +- domain skill: Econ/Fin=0.1063, Energy=0.2350, Healthcare=0.3543, Nature=0.4630, Sales=0.5538, Transport=0.4181, Web/CloudOps=0.4317. +- frequency skill: A=0.3487, D=0.4308, H=0.3887, M=0.1298, Q=0.1454, S=0.2825, T=0.3581, W=0.2487. +- variates skill: multivariate=0.3617, univariate=0.3530. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E51: last optimizer weights versus EMA weights +The late E25 EMA checkpoints continue to improve, and averaging older EMA checkpoints regressed in E45. Check whether the final optimizer iterate is ahead of its lagging EMA or instead suffers from update noise. No training or inference-rule change: evaluate step024000 against the selected ema024000 with the identical fixed128/aligned/zero0.4 runtime. Only transfer to earlier cutoffs and full validation if the main screen improves. Both candidates have the same seed59 training lineage. + +## E47 confidence projection 1000-step screen +- Checkpoint SHA-256: `b2df8695413e53c7d62ec8f265affc31a43ca26e7b99b50e0a75f47782b95bfe`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.31796908378601 seconds. +- Overall skill 0.375491; relative MASE 0.746025; relative WQL 0.522786. +- term skill: long=0.3994, medium=0.4067, short=0.3536. +- domain skill: Econ/Fin=0.1396, Energy=0.2349, Healthcare=0.4370, Nature=0.4288, Sales=0.3397, Transport=0.4653, Web/CloudOps=0.5002. +- frequency skill: A=0.3765, D=0.3531, H=0.3948, M=0.0934, Q=0.1985, S=0.4235, T=0.4361, W=0.2100. +- variates skill: multivariate=0.3936, univariate=0.3607. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +## E47 confidence projection 3000-step screen +- Checkpoint SHA-256: `653081261875b023a5d8dea02c999762fa8a2a4601ce7b6ad3b55559172290ab`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.364450693130493 seconds. +- Overall skill 0.375482; relative MASE 0.745987; relative WQL 0.522828. +- term skill: long=0.3995, medium=0.4066, short=0.3536. +- domain skill: Econ/Fin=0.1394, Energy=0.2348, Healthcare=0.4379, Nature=0.4283, Sales=0.3403, Transport=0.4653, Web/CloudOps=0.5004. +- frequency skill: A=0.3762, D=0.3534, H=0.3949, M=0.0912, Q=0.1983, S=0.4238, T=0.4362, W=0.2092. +- variates skill: multivariate=0.3937, univariate=0.3606. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +## E47 confidence projection 6000-step screen +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.593000650405884 seconds. +- Overall skill 0.375793; relative MASE 0.745649; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4406, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0954, Q=0.1982, S=0.4239, T=0.4362, W=0.2090. +- variates skill: multivariate=0.3937, univariate=0.3611. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +E47 completed 6000 steps in 818.8 elapsed training-loop seconds on the shared H100. Every original model tensor is bitwise equal to the frozen E25-24000 parent; only the 3072 confidence-projection parameters changed. + +E48 phase_synth training started at 2026-10-22T04:54:48Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E51 final optimizer iterate, screen +- Checkpoint SHA-256: `32b70d0e88532fb98746ea032c10be587383d80ed7b0951b41f778a39c9dc68b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.315549850463867 seconds. +- Overall skill 0.374536; relative MASE 0.746570; relative WQL 0.524003. +- term skill: long=0.3980, medium=0.4073, short=0.3522. +- domain skill: Econ/Fin=0.1389, Energy=0.2328, Healthcare=0.4348, Nature=0.4279, Sales=0.3409, Transport=0.4652, Web/CloudOps=0.4998. +- frequency skill: A=0.3701, D=0.3497, H=0.3936, M=0.0914, Q=0.1977, S=0.4222, T=0.4369, W=0.2087. +- variates skill: multivariate=0.3931, univariate=0.3594. +- Outcome: Skill 0.374536 is below the selected EMA24000 skill 0.375502. Retain EMA weights; no earlier-window or full evaluation is needed. + +## E39 bounded quantiles 6000-step screen +- Checkpoint SHA-256: `4af38aa561df4d38c1f6df090f8a5dc364c38786eb2ab38933646d827cbe7669`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.320833683013916 seconds. +- Overall skill 0.357854; relative MASE 0.764623; relative WQL 0.539287. +- term skill: long=0.3907, medium=0.4019, short=0.3268. +- domain skill: Econ/Fin=0.1103, Energy=0.1849, Healthcare=0.4072, Nature=0.4203, Sales=0.3470, Transport=0.4571, Web/CloudOps=0.5050. +- frequency skill: A=0.3756, D=0.3402, H=0.3810, M=0.0920, Q=0.1957, S=0.4423, T=0.4023, W=0.1961. +- variates skill: multivariate=0.3917, univariate=0.3295. +- Outcome: Skill 0.357854 is below matched control 0.358628, following a smaller 3000-step regression. Stop this branch; retain the current inference-only positivity projection. + +## E52: varied requested horizons during partial-target training +E42's correct per-row horizon conditioning improves all three cutoffs at 6000 steps. Hypothesis: exposing the decoder to intermediate requested horizons will also reduce mismatch between four fixed training horizon lengths and arbitrary inference lengths. Match E42's parent E25-12000, seed79, packed_sample, source probabilities, batch256, LR5e-5 and 12000-step schedule. Keep half the sampled target windows unchanged; for the other half, independently choose a prefix length uniformly from one-quarter to the full batch horizon, rounded upward to a 16-step patch boundary. Mask only later training labels. The existing E42 loss masks unused future tokens and sets each row's horizon metadata. Corpus contexts and periods, original generator and sampler random draws remain unchanged. Independent horizon RNG seed300082. + +A data-only check at all four horizon sizes verified identical context/period arrays and exact preservation of every retained target value (0.66 CPU seconds). No validation labels enter training. No new model parameters or inference behavior; this is a training-window augmentation. Start after rejected E39 exits and compare against cached E42 at 3000/6000/12000. + +E52 horizon_jitter training started at 2026-10-22T04:56:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E47 confidence projection 6000, backcast +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.725136041641235 seconds. +- Overall skill 0.334126; relative MASE 0.799732; relative WQL 0.554420. +- term skill: long=0.3968, medium=0.3571, short=0.2992. +- domain skill: Econ/Fin=0.1592, Energy=0.2275, Healthcare=0.4065, Nature=0.3605, Sales=0.3971, Transport=0.3716, Web/CloudOps=0.4467. +- frequency skill: A=0.3079, D=0.3510, H=0.3635, M=0.1810, Q=0.2346, S=0.3430, T=0.3344, W=0.2764. +- variates skill: multivariate=0.3510, univariate=0.3204. +- Outcome: Main screen gains 0.000291; first earlier cutoff loses only 0.000054; second earlier cutoff gains 0.000224. Proceed to full validation before deciding whether to replace the package. + +## E47 confidence projection 6000, backcast2 +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.6521155834198 seconds. +- Overall skill 0.358499; relative MASE 0.770987; relative WQL 0.533762. +- term skill: long=0.3652, medium=0.3856, short=0.3452. +- domain skill: Econ/Fin=0.1095, Energy=0.2361, Healthcare=0.3507, Nature=0.4706, Sales=0.5514, Transport=0.4202, Web/CloudOps=0.4300. +- frequency skill: A=0.3495, D=0.4316, H=0.3891, M=0.1571, Q=0.1507, S=0.2825, T=0.3576, W=0.2564. +- variates skill: multivariate=0.3624, univariate=0.3553. +- Outcome: Main screen gains 0.000291; first earlier cutoff loses only 0.000054; second earlier cutoff gains 0.000224. Proceed to full validation before deciding whether to replace the package. + +E39 stopped cleanly at step 6298, with 2199.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `d1018a12abdb14c369ba55a561c3091bbc7dc4b25337345a0af68aa15e9afec2`. This stop checkpoint was retained for provenance and was not selected. + +## E53: within-cycle variance for seasonal confidence +Hypothesis: total variance over up to eight cycles can be dominated by a long trend, artificially lowering the seasonal-difference/variance ratio and assigning high seasonal confidence even to a nonseasonal ramp. Change only the gate denominator to pooled within-cycle variance, subtracting each cycle's finite-observation mean before pooling squared deviations. Compare the existing global variance and this within-cycle variance, with the selected aligned template, Gaussian RMS intervals, continuity and zero0.4 unchanged. Use cached E25-18000 forecasts across three cutoffs; no training, optimization or new source data. A selected formula must transfer to the current checkpoint and fixed128 runtime before publication. + +## E47 confidence projection 6000, exact full package validation +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371766; relative MASE 0.748576; relative WQL 0.527239. +- term skill: long=0.3937, medium=0.4056, short=0.3496. +- domain skill: Econ/Fin=0.1167, Energy=0.2278, Healthcare=0.4464, Nature=0.4283, Sales=0.3521, Transport=0.4660, Web/CloudOps=0.4929. +- frequency skill: A=0.2915, D=0.3581, H=0.3903, M=0.1171, Q=0.1834, S=0.4239, T=0.4292, W=0.2017. +- variates skill: multivariate=0.3895, univariate=0.3573. +- Outcome: Selected for publication: skill 0.371766 versus 0.371479 for the previous package; relative MASE 0.748576 and WQL 0.527239. All 97 configurations and 151170 instances passed, with no quantile crossings. Actual package inference took 140.57 seconds on the one H100 while five heavy training runs and two head-only runs shared it. Relocation/determinism checks precede the atomic replacement. + +## E53 complete seasonal variance comparison +No training; inference seed 0. E25-18000 checkpoint SHA-256 f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd. + +screen: 8.50 CPU diagnostic seconds. +- global: skill 0.374500; term: short=0.3517, medium=0.4069, long=0.3994; domain: Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- within_cycle: skill 0.374386; term: short=0.3515, medium=0.4068, long=0.3994; domain: Econ/Fin=0.1320, Energy=0.2346, Healthcare=0.4305, Nature=0.4254, Sales=0.3450, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2024, M=0.1005, W-SUN=0.0487, D=0.3444, H=0.3951, 15T=0.2124, W-FRI=-0.0050, 10T=0.6139, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. + +backcast: 8.12 CPU diagnostic seconds. +- global: skill 0.332400; term: short=0.2953, medium=0.3574, long=0.3980; domain: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- within_cycle: skill 0.332143; term: short=0.2948, medium=0.3575, long=0.3979; domain: Econ/Fin=0.1529, Energy=0.2266, Healthcare=0.3952, Nature=0.3561, Sales=0.3986, Transport=0.3704, Web/CloudOps=0.4471; freq: A-DEC=0.2996, Q-DEC=0.2353, M=0.1665, W-SUN=-0.0082, D=0.3519, H=0.3640, 15T=0.2255, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3396. + +backcast2: 7.99 CPU diagnostic seconds. +- global: skill 0.356697; term: short=0.3411, medium=0.3874, long=0.3657; domain: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq: A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- within_cycle: skill 0.356794; term: short=0.3414, medium=0.3873, long=0.3654; domain: Econ/Fin=0.1040, Energy=0.2329, Healthcare=0.3653, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4301; freq: A-DEC=0.3474, Q-DEC=0.1544, M=0.1677, W-SUN=0.0298, D=0.4273, H=0.3891, 15T=0.1064, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4647, 10S=0.2791. + +Outcome: retain total history variance. Within-cycle variance loses on the main and first earlier cutoff, with only a small second-earlier gain. The trend-related failure mode does not justify changing the global formula. + +E47 relocation and determinism passed: the candidate and a separately copied package in a fresh /tmp directory produced bitwise identical, finite, monotone quantiles for univariate daily, univariate hourly and multivariate medium-horizon examples. Both ran with /tmp as the working directory. Publish the complete candidate atomically after these checks. + +## E54: train the full model with longer raw context +E21's untrained extension and E29's frozen, coarsened history memory did not provide consistent gains. Hypothesis: adapting all existing parameters to raw 8192-point histories can use older cycles without the mismatch of an untrained extension or lossy extra memory. Two matched arms initialize from our E25-24000 EMA, with identical model size, original loss, seed101, packed_sample, source probabilities, batch128, LR3e-5 and 12000-step schedule. The sampler draws context sizes512/1024/2048/8192 with probabilities0.1/0.15/0.35/0.4 in both arms. The control then keeps only the last4096 points; the candidate keeps8192. Future labels and sampler RNG are matched exactly, including synthetic draws and aggregation. Both train every model parameter. This comparison changes only the retained raw history. + +At inference, positivity and the fixed seasonal rule continue to inspect only the recent4096 observations; continuity and zero projection retain their existing lookbacks. The candidate's neural encoder and normalization use up to8192. No external weights or new source data are introduced; the parameter count is unchanged. New generator/sign-augmentation seed101 must be declared if selected. Maximum-shape batch128/context8192/horizon1024 memory check, including allocated placeholders for Adam moments and EMA, measured9960 MiB peak allocated and10530 MiB reserved, with finite gradients in4.37 seconds. No optimizer update or checkpoint came from this random fixture. Queue the control after E50 head_control completes; queue the longer-context arm after E38 expanded corpus completes, preserving the one-H100 allocation. + +E54 data check passed in3.26 CPU seconds: all four sampled context sizes produced identical future labels, period metadata, overlapping recent history and sampler RNG states between the two arms. + +E54 long_context_control training started at 2026-10-22T05:04:35Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E55: transfer the matched partial-target training difference +E42's 6000-step checkpoint improves all three cutoffs over its exact seed/data/initialization-matched E38 control, but both restarted trajectories began from an older E25 checkpoint. Hypothesis: the parameter difference between these matched runs isolates a useful training correction that can transfer to the selected later model. Form one fixed model with weights = current E47 confidence6000 + E42 partial6000 - E38 control6000 for their common backbone tensors, leaving the confidence projection unchanged. Use coefficient1 with no grid search. This is a deterministic composition of our own trained weights, with all three parent hashes recorded. No new training or data, and one model forecasts every instance. Evaluate the main screen first; if promising, require earlier-cutoff and exact full-package checks. + +## E50 head_control 1000-step screen +- Checkpoint SHA-256: `a88f59494b256bf95addea9f00fa7b631cd67dc762228f523d95eec8047a05d8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.136118412017822 seconds. +- Overall skill 0.375630; relative MASE 0.745780; relative WQL 0.522726. +- term skill: long=0.3996, medium=0.4068, short=0.3537. +- domain skill: Econ/Fin=0.1403, Energy=0.2347, Healthcare=0.4405, Nature=0.4291, Sales=0.3396, Transport=0.4656, Web/CloudOps=0.4997. +- frequency skill: A=0.3779, D=0.3539, H=0.3951, M=0.0943, Q=0.1980, S=0.4231, T=0.4359, W=0.2102. +- variates skill: multivariate=0.3935, univariate=0.3610. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_control 3000-step screen +- Checkpoint SHA-256: `75b9f4860e4c4345f2cedb6eb2f9ffe5c9e65aede03a314c72b20b1e8a1f7aaf`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.069400310516357 seconds. +- Overall skill 0.375411; relative MASE 0.746024; relative WQL 0.522921. +- term skill: long=0.3996, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1387, Energy=0.2345, Healthcare=0.4401, Nature=0.4293, Sales=0.3399, Transport=0.4650, Web/CloudOps=0.4996. +- frequency skill: A=0.3759, D=0.3533, H=0.3949, M=0.0963, Q=0.1980, S=0.4231, T=0.4355, W=0.2102. +- variates skill: multivariate=0.3933, univariate=0.3608. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_control 6000-step screen +- Checkpoint SHA-256: `dd8fc459f097a0bc0c7cb133473130aa32e1dc520fd7f03ff50dc26366d1122e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.82920217514038 seconds. +- Overall skill 0.375304; relative MASE 0.746102; relative WQL 0.523045. +- term skill: long=0.3996, medium=0.4065, short=0.3532. +- domain skill: Econ/Fin=0.1404, Energy=0.2343, Healthcare=0.4375, Nature=0.4291, Sales=0.3402, Transport=0.4652, Web/CloudOps=0.4997. +- frequency skill: A=0.3770, D=0.3531, H=0.3950, M=0.0965, Q=0.1987, S=0.4230, T=0.4355, W=0.2086. +- variates skill: multivariate=0.3931, univariate=0.3607. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +E50 head_control completed6000 steps in 685.6 elapsed training-loop seconds. Every non-head tensor remains bitwise equal to the E25-24000 parent. + +## E50 head_paired 1000-step screen +- Checkpoint SHA-256: `337e19aac481543a8ba78bd837f00c8a714315313e665b1b5a038d009a905a2a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.40800166130066 seconds. +- Overall skill 0.375721; relative MASE 0.745631; relative WQL 0.522677. +- term skill: long=0.3997, medium=0.4067, short=0.3539. +- domain skill: Econ/Fin=0.1403, Energy=0.2344, Healthcare=0.4425, Nature=0.4292, Sales=0.3396, Transport=0.4658, Web/CloudOps=0.4998. +- frequency skill: A=0.3786, D=0.3544, H=0.3951, M=0.0952, Q=0.1978, S=0.4234, T=0.4358, W=0.2099. +- variates skill: multivariate=0.3935, univariate=0.3612. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_paired 3000-step screen +- Checkpoint SHA-256: `1043bbd666890cb730f2931875860ed661f54bae5236a7c93bbbe03764487222`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.516828536987305 seconds. +- Overall skill 0.375342; relative MASE 0.746117; relative WQL 0.522970. +- term skill: long=0.3997, medium=0.4065, short=0.3533. +- domain skill: Econ/Fin=0.1387, Energy=0.2340, Healthcare=0.4415, Nature=0.4295, Sales=0.3399, Transport=0.4651, Web/CloudOps=0.4994. +- frequency skill: A=0.3750, D=0.3534, H=0.3947, M=0.0981, Q=0.1978, S=0.4235, T=0.4353, W=0.2097. +- variates skill: multivariate=0.3930, univariate=0.3609. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_paired 6000-step screen +- Checkpoint SHA-256: `8aacc5fadfa1a9d214aeba0cd1f39bde9aaf038b9ee2a487dafa57b9e904479e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.942206621170044 seconds. +- Overall skill 0.375234; relative MASE 0.746235; relative WQL 0.523068. +- term skill: long=0.3997, medium=0.4064, short=0.3531. +- domain skill: Econ/Fin=0.1405, Energy=0.2337, Healthcare=0.4385, Nature=0.4294, Sales=0.3403, Transport=0.4654, Web/CloudOps=0.4995. +- frequency skill: A=0.3760, D=0.3533, H=0.3947, M=0.0981, Q=0.1988, S=0.4234, T=0.4354, W=0.2077. +- variates skill: multivariate=0.3928, univariate=0.3609. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +E50 head_paired completed6000 steps in 687.3 elapsed training-loop seconds. Every non-head tensor remains bitwise equal to the E25-24000 parent. + +## E38 original corpus control12000, matched screening +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.037413597106934 seconds. +- Overall skill 0.360533; relative MASE 0.761352; relative WQL 0.537094. +- term skill: long=0.3910, medium=0.4047, short=0.3305. +- domain skill: Econ/Fin=0.1118, Energy=0.1871, Healthcare=0.4084, Nature=0.4251, Sales=0.3445, Transport=0.4588, Web/CloudOps=0.5084. +- frequency skill: A=0.3744, D=0.3432, H=0.3820, M=0.0997, Q=0.1999, S=0.4419, T=0.4062, W=0.2010. +- variates skill: multivariate=0.3952, univariate=0.3315. +- Outcome: The restarted control improves over its12000-step parent but remains below uninterrupted E25-24000. Retain as the paired reference for corpus expansion and partial-target training. + +## E38 original corpus control12000, selected fixed inference rules +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.83461022377014 seconds. +- Overall skill 0.373819; relative MASE 0.747477; relative WQL 0.524569. +- term skill: long=0.3971, medium=0.4072, short=0.3512. +- domain skill: Econ/Fin=0.1366, Energy=0.2343, Healthcare=0.4105, Nature=0.4297, Sales=0.3412, Transport=0.4642, Web/CloudOps=0.5006. +- frequency skill: A=0.3777, D=0.3471, H=0.3939, M=0.0915, Q=0.2002, S=0.4231, T=0.4362, W=0.2036. +- variates skill: multivariate=0.3936, univariate=0.3576. +- Outcome: The restarted control improves over its12000-step parent but remains below uninterrupted E25-24000. Retain as the paired reference for corpus expansion and partial-target training. + +E38 original-corpus control completed12000 steps in 3967.3 elapsed training-loop seconds. E48 phase_synth replaced it on the same H100 after completion. + +## E55 matched partial-target weight difference, screen +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.02963423728943 seconds. +- Overall skill 0.375848; relative MASE 0.745876; relative WQL 0.522292. +- term skill: long=0.3998, medium=0.4069, short=0.3540. +- domain skill: Econ/Fin=0.1449, Energy=0.2367, Healthcare=0.4308, Nature=0.4298, Sales=0.3356, Transport=0.4655, Web/CloudOps=0.5000. +- frequency skill: A=0.3786, D=0.3503, H=0.3960, M=0.1012, Q=0.2008, S=0.4236, T=0.4351, W=0.2163. +- variates skill: multivariate=0.3939, univariate=0.3611. +- Outcome: Skill 0.375848 is only 0.000056 above the selected E47 model. Check both earlier cutoffs before a full-package evaluation; no replacement yet. + +## E56: bounded influence of difficult training windows +Hypothesis: a linear average of normalized window losses gives unusually difficult or abruptly changing futures too much influence, while the benchmark aggregates relative configuration errors geometrically. Keep the original per-window weighted quantile/median loss and context-only seasonal weights, but replace each window loss L by 0.25*log1p(L/0.25) before averaging. The derivative is bounded by1 and declines for difficult windows; this is a robust surrogate, not a claim to exactly optimize benchmark skill. The scale0.25 is fixed in advance, with no sweep. + +Match E38 original-corpus control exactly: parent E25-12000, seed79, packed_sample, source weights, batch256, LR5e-5, 12000-step schedule and save3000. No new source data, architecture or inference rule. Queue after E42 completes12000, then compare against cached control checkpoints and earlier cutoffs. The loss scale is saved in training arguments. + +## E55 transferred partial-target update, backcast +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.927225589752197 seconds. +- Overall skill 0.335000; relative MASE 0.798832; relative WQL 0.553589. +- term skill: long=0.3978, medium=0.3567, short=0.3005. +- domain skill: Econ/Fin=0.1675, Energy=0.2279, Healthcare=0.4021, Nature=0.3600, Sales=0.3983, Transport=0.3718, Web/CloudOps=0.4491. +- frequency skill: A=0.3286, D=0.3484, H=0.3640, M=0.1855, Q=0.2333, S=0.3447, T=0.3347, W=0.2831. +- variates skill: multivariate=0.3522, univariate=0.3210. +- Outcome: Mixed transfer: main +0.000056, first earlier +0.000874, second earlier -0.000595 versus E47. Keep the published package. Revisit the same coefficient with the final12000-step matched checkpoints; no full-package test of this6000-step composition. + +## E55 transferred partial-target update, backcast2 +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.91679048538208 seconds. +- Overall skill 0.357904; relative MASE 0.771656; relative WQL 0.534289. +- term skill: long=0.3649, medium=0.3860, short=0.3441. +- domain skill: Econ/Fin=0.1130, Energy=0.2354, Healthcare=0.3520, Nature=0.4680, Sales=0.5482, Transport=0.4200, Web/CloudOps=0.4303. +- frequency skill: A=0.3535, D=0.4265, H=0.3897, M=0.1535, Q=0.1485, S=0.2805, T=0.3574, W=0.2617. +- variates skill: multivariate=0.3618, univariate=0.3547. +- Outcome: Mixed transfer: main +0.000056, first earlier +0.000874, second earlier -0.000595 versus E47. Keep the published package. Revisit the same coefficient with the final12000-step matched checkpoints; no full-package test of this6000-step composition. + +E54 long_context_8192 training started at 2026-10-22T05:11:31Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E38 expanded corpus final12000, matched screen +- Checkpoint SHA-256: `8aa07643add22cc1f8e45c069d19ff54bda8c0853c8e7076eb5923467942327b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.707714796066284 seconds. +- Overall skill 0.359331; relative MASE 0.763140; relative WQL 0.537852. +- term skill: long=0.3931, medium=0.4039, short=0.3277. +- domain skill: Econ/Fin=0.1164, Energy=0.1854, Healthcare=0.3936, Nature=0.4242, Sales=0.3431, Transport=0.4578, Web/CloudOps=0.5093. +- frequency skill: A=0.3748, D=0.3312, H=0.3834, M=0.1029, Q=0.2013, S=0.4405, T=0.4056, W=0.2056. +- variates skill: multivariate=0.3951, univariate=0.3293. +- Outcome: Skill 0.359331 versus matched original-corpus control0.360533. The early near tie becomes a final regression. Do not select the expanded corpus for the current model; retain all packed data and receipts for future experiments. + +E38 expanded-corpus arm completed12000 steps in 4098.4 elapsed training-loop seconds. E54 long_context_8192 started after its process exited on the same H100. + +## E48 synthetic phase diffusion3000, matched screen +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.34250235557556 seconds. +- Overall skill 0.353459; relative MASE 0.767933; relative WQL 0.544338. +- term skill: long=0.3849, medium=0.3994, short=0.3222. +- domain skill: Econ/Fin=0.1025, Energy=0.1767, Healthcare=0.4158, Nature=0.4111, Sales=0.3476, Transport=0.4532, Web/CloudOps=0.5044. +- frequency skill: A=0.3736, D=0.3385, H=0.3748, M=0.0857, Q=0.1907, S=0.4365, T=0.3973, W=0.1999. +- variates skill: multivariate=0.3856, univariate=0.3267. +- Outcome: Skill0.353459 versus amplitude-only E31 score0.352625 at the same step/seed/data stream. Earlier-cutoff checks are pending; continue the trial. + +E56 log_window_loss training started at 2026-10-22T05:14:05Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E57: period-relative phase projections with a frozen backbone +Hypothesis: encoder and future-query attention can use seasonal history more efficiently when supplied explicit relative phase for each frequency-derived period, rather than having to reconstruct it from generic position embeddings and scalar period metadata. Add zero-initialized linear projections of per-point sine/cosine phase for the two periods to context patches and future-query patches. Positions are relative to the forecast origin; periods below2 yield zero features, and missing context positions are masked. There are65536 new parameters, with no calendar dates or dataset identifiers. + +Initialize from the selected E47 confidence6000 package; freeze every existing parameter, including the confidence projection. Train only the two phase projections on packed_sample and the unchanged local synthetic/sign generator, seed107, paired-sign weighted quantile/median loss, batch64, LR2e-4, 6000-step cosine schedule, save1000. Confirm zero-initialization equivalence and maximum-shape memory before starting alongside the six existing trainers on the one H100. No new source data. + +E57 checks passed: the zero-initialized model is bitwise equal to the parent on mixed-frequency, partially missing CPU contexts. Maximum-shape paired batch128/context4096/horizon1024 used3647 MiB peak allocated and3920 MiB reserved, including EMA and optimizer-state placeholders, with finite gradients in1.20 seconds. No optimizer update or checkpoint came from these fixtures. Start batch64 as planned; train only65536 projection parameters. + +## E52 varied requested horizons3000, matched screen +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.744144678115845 seconds. +- Overall skill 0.359510; relative MASE 0.763513; relative WQL 0.537290. +- term skill: long=0.3912, medium=0.4026, short=0.3294. +- domain skill: Econ/Fin=0.1112, Energy=0.1841, Healthcare=0.4177, Nature=0.4232, Sales=0.3464, Transport=0.4589, Web/CloudOps=0.5065. +- frequency skill: A=0.3765, D=0.3429, H=0.3831, M=0.1035, Q=0.1995, S=0.4418, T=0.4003, W=0.2081. +- variates skill: multivariate=0.3922, univariate=0.3323. +- Outcome: Skill0.359510 versus E42 partial-target control0.358812. The gain is promising; matched earlier-cutoff evaluations are queued. + +## E48 matched3000 comparison: amplitude_synth, backcast +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.832332372665405 seconds. +- Overall skill 0.322014; relative MASE 0.811414; relative WQL 0.566499. +- term skill: long=0.3860, medium=0.3513, short=0.2839. +- domain skill: Econ/Fin=0.1393, Energy=0.2195, Healthcare=0.3717, Nature=0.3475, Sales=0.3988, Transport=0.3598, Web/CloudOps=0.4348. +- frequency skill: A=0.3171, D=0.3485, H=0.3526, M=0.1707, Q=0.2099, S=0.3414, T=0.3170, W=0.2493. +- variates skill: multivariate=0.3360, univariate=0.3107. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: phase_synth, backcast +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.44191288948059 seconds. +- Overall skill 0.322626; relative MASE 0.811284; relative WQL 0.565567. +- term skill: long=0.3871, medium=0.3526, short=0.2840. +- domain skill: Econ/Fin=0.1401, Energy=0.2216, Healthcare=0.3676, Nature=0.3459, Sales=0.3983, Transport=0.3597, Web/CloudOps=0.4368. +- frequency skill: A=0.3175, D=0.3449, H=0.3527, M=0.1680, Q=0.2099, S=0.3428, T=0.3207, W=0.2496. +- variates skill: multivariate=0.3385, univariate=0.3097. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: amplitude_synth, backcast2 +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.063983917236328 seconds. +- Overall skill 0.346071; relative MASE 0.781652; relative WQL 0.547076. +- term skill: long=0.3649, medium=0.3705, short=0.3294. +- domain skill: Econ/Fin=0.0773, Energy=0.2205, Healthcare=0.3375, Nature=0.4551, Sales=0.5561, Transport=0.4102, Web/CloudOps=0.4240. +- frequency skill: A=0.3378, D=0.4197, H=0.3812, M=0.1601, Q=0.1370, S=0.2856, T=0.3361, W=0.2413. +- variates skill: multivariate=0.3528, univariate=0.3406. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: phase_synth, backcast2 +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.462491750717163 seconds. +- Overall skill 0.346572; relative MASE 0.781891; relative WQL 0.546071. +- term skill: long=0.3645, medium=0.3710, short=0.3303. +- domain skill: Econ/Fin=0.0768, Energy=0.2203, Healthcare=0.3341, Nature=0.4562, Sales=0.5562, Transport=0.4104, Web/CloudOps=0.4261. +- frequency skill: A=0.3370, D=0.4191, H=0.3813, M=0.1474, Q=0.1380, S=0.2827, T=0.3397, W=0.2426. +- variates skill: multivariate=0.3544, univariate=0.3402. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E42 final12000, matched mean-template screen +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.56895399093628 seconds. +- Overall skill 0.361108; relative MASE 0.761463; relative WQL 0.536050. +- term skill: long=0.3906, medium=0.4043, short=0.3319. +- domain skill: Econ/Fin=0.1096, Energy=0.1895, Healthcare=0.4193, Nature=0.4256, Sales=0.3404, Transport=0.4593, Web/CloudOps=0.5063. +- frequency skill: A=0.3721, D=0.3420, H=0.3825, M=0.1108, Q=0.1995, S=0.4420, T=0.4045, W=0.2122. +- variates skill: multivariate=0.3937, univariate=0.3339. +- Outcome: The partial-target change still improves over its matched original-corpus control. The direct model remains below the published later E25/E47 lineage. Earlier-cutoff checks and the prespecified final-checkpoint weight-difference transfer are pending. + +## E42 final12000, selected fixed inference rules +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.01974844932556 seconds. +- Overall skill 0.374349; relative MASE 0.747467; relative WQL 0.523688. +- term skill: long=0.3969, medium=0.4067, short=0.3525. +- domain skill: Econ/Fin=0.1345, Energy=0.2359, Healthcare=0.4230, Nature=0.4302, Sales=0.3371, Transport=0.4647, Web/CloudOps=0.4986. +- frequency skill: A=0.3753, D=0.3458, H=0.3943, M=0.1064, Q=0.1999, S=0.4233, T=0.4344, W=0.2143. +- variates skill: multivariate=0.3921, univariate=0.3599. +- Outcome: The partial-target change still improves over its matched original-corpus control. The direct model remains below the published later E25/E47 lineage. Earlier-cutoff checks and the prespecified final-checkpoint weight-difference transfer are pending. + +E42 completed12000 steps in 4034.2 elapsed training-loop seconds. E56 replaced it on the same H100. + +## E52 matched3000 comparison: partial_targets, backcast +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.31913948059082 seconds. +- Overall skill 0.329377; relative MASE 0.806571; relative WQL 0.557590. +- term skill: long=0.3896, medium=0.3560, short=0.2940. +- domain skill: Econ/Fin=0.1487, Energy=0.2246, Healthcare=0.4210, Nature=0.3485, Sales=0.3987, Transport=0.3621, Web/CloudOps=0.4433. +- frequency skill: A=0.3183, D=0.3586, H=0.3563, M=0.1681, Q=0.2258, S=0.3434, T=0.3271, W=0.2657. +- variates skill: multivariate=0.3451, univariate=0.3166. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: horizon_jitter, backcast +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.87836766242981 seconds. +- Overall skill 0.329077; relative MASE 0.807099; relative WQL 0.557723. +- term skill: long=0.3896, medium=0.3557, short=0.2936. +- domain skill: Econ/Fin=0.1451, Energy=0.2244, Healthcare=0.4181, Nature=0.3490, Sales=0.3989, Transport=0.3628, Web/CloudOps=0.4429. +- frequency skill: A=0.3192, D=0.3567, H=0.3569, M=0.1660, Q=0.2272, S=0.3431, T=0.3263, W=0.2674. +- variates skill: multivariate=0.3446, univariate=0.3165. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: partial_targets, backcast2 +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.110735416412354 seconds. +- Overall skill 0.352022; relative MASE 0.776423; relative WQL 0.540782. +- term skill: long=0.3678, medium=0.3760, short=0.3367. +- domain skill: Econ/Fin=0.0867, Energy=0.2248, Healthcare=0.3701, Nature=0.4601, Sales=0.5593, Transport=0.4130, Web/CloudOps=0.4281. +- frequency skill: A=0.3418, D=0.4285, H=0.3860, M=0.1767, Q=0.1499, S=0.2821, T=0.3437, W=0.2407. +- variates skill: multivariate=0.3578, univariate=0.3473. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: horizon_jitter, backcast2 +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.243326425552368 seconds. +- Overall skill 0.352445; relative MASE 0.776496; relative WQL 0.540026. +- term skill: long=0.3678, medium=0.3759, short=0.3375. +- domain skill: Econ/Fin=0.0824, Energy=0.2247, Healthcare=0.3724, Nature=0.4606, Sales=0.5600, Transport=0.4138, Web/CloudOps=0.4293. +- frequency skill: A=0.3405, D=0.4280, H=0.3865, M=0.1811, Q=0.1490, S=0.2826, T=0.3439, W=0.2424. +- variates skill: multivariate=0.3585, univariate=0.3475. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E57 period-relative phase projection, initial screen +- Checkpoint SHA-256: `275e6d68dda364b71999bf311a8ce7acf09ae4fb4642b8e07c404dd1bd9849ca`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.636561393737793 seconds. +- Overall skill 0.375793; relative MASE 0.745649; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4406, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0954, Q=0.1982, S=0.4239, T=0.4362, W=0.2090. +- variates skill: multivariate=0.3937, univariate=0.3611. +- Outcome: Exactly equal to the E47 parent score0.3757929301726527, validating the zero-initialized runtime before training. + +## E55 final12000 matched training difference, screen +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.509355783462524 seconds. +- Overall skill 0.375956; relative MASE 0.746201; relative WQL 0.521885. +- term skill: long=0.3991, medium=0.4059, short=0.3549. +- domain skill: Econ/Fin=0.1387, Energy=0.2371, Healthcare=0.4442, Nature=0.4287, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3506, H=0.3961, M=0.1054, Q=0.1984, S=0.4235, T=0.4345, W=0.2191. +- variates skill: multivariate=0.3928, univariate=0.3622. +- Outcome: Skill0.375956 versus selected E47 score0.375793. This is a larger screen gain than the6000-step difference; evaluate both earlier cutoffs before selecting. + +## E57 period-relative phase projections1000, screen +- Checkpoint SHA-256: `2deeff17c98c6993f9da1713c973fe0f803358a717c021e81438cdf203ae5f51`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.055758476257324 seconds. +- Overall skill 0.375590; relative MASE 0.745958; relative WQL 0.522667. +- term skill: long=0.3989, medium=0.4062, short=0.3542. +- domain skill: Econ/Fin=0.1398, Energy=0.2354, Healthcare=0.4399, Nature=0.4278, Sales=0.3393, Transport=0.4661, Web/CloudOps=0.4996. +- frequency skill: A=0.3762, D=0.3549, H=0.3950, M=0.0942, Q=0.1970, S=0.4219, T=0.4359, W=0.2092. +- variates skill: multivariate=0.3933, univariate=0.3612. +- Outcome: Skill0.375590 is slightly below the parent0.375793. Continue to3000/6000 to assess whether training recovers, as the previous confidence projection did late in its schedule. + +## E42 final12000 matched comparison: large_corpus_control, backcast +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.9762020111084 seconds. +- Overall skill 0.330213; relative MASE 0.806120; relative WQL 0.556510. +- term skill: long=0.3888, medium=0.3557, short=0.2960. +- domain skill: Econ/Fin=0.1456, Energy=0.2279, Healthcare=0.4182, Nature=0.3493, Sales=0.3975, Transport=0.3647, Web/CloudOps=0.4422. +- frequency skill: A=0.2987, D=0.3583, H=0.3572, M=0.1590, Q=0.2332, S=0.3409, T=0.3303, W=0.2690. +- variates skill: multivariate=0.3460, univariate=0.3174. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E42 final12000 matched comparison: partial_targets, backcast +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.47197651863098 seconds. +- Overall skill 0.331074; relative MASE 0.805060; relative WQL 0.555811. +- term skill: long=0.3901, medium=0.3561, short=0.2969. +- domain skill: Econ/Fin=0.1467, Energy=0.2289, Healthcare=0.4192, Nature=0.3505, Sales=0.3984, Transport=0.3646, Web/CloudOps=0.4431. +- frequency skill: A=0.3115, D=0.3560, H=0.3581, M=0.1677, Q=0.2337, S=0.3423, T=0.3297, W=0.2763. +- variates skill: multivariate=0.3468, univariate=0.3183. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E55 final12000 transferred difference, backcast +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.976391792297363 seconds. +- Overall skill 0.335609; relative MASE 0.797954; relative WQL 0.553184. +- term skill: long=0.3979, medium=0.3572, short=0.3014. +- domain skill: Econ/Fin=0.1631, Energy=0.2288, Healthcare=0.4091, Nature=0.3616, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4491. +- frequency skill: A=0.3254, D=0.3493, H=0.3647, M=0.1918, Q=0.2328, S=0.3430, T=0.3345, W=0.2857. +- variates skill: multivariate=0.3525, univariate=0.3218. +- Outcome: Transfer gains main+0.000163 and earlier1+0.001483, but loses earlier2 by0.001028. Average gain across the three cutoffs is positive; run exact full validation before deciding whether to publish this tradeoff. + +## E42 final12000 matched comparison: large_corpus_control, backcast2 +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.495740175247192 seconds. +- Overall skill 0.353454; relative MASE 0.776299; relative WQL 0.538480. +- term skill: long=0.3687, medium=0.3751, short=0.3393. +- domain skill: Econ/Fin=0.0914, Energy=0.2288, Healthcare=0.3664, Nature=0.4591, Sales=0.5548, Transport=0.4142, Web/CloudOps=0.4303. +- frequency skill: A=0.3473, D=0.4293, H=0.3865, M=0.1743, Q=0.1540, S=0.2821, T=0.3466, W=0.2433. +- variates skill: multivariate=0.3605, univariate=0.3477. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E42 final12000 matched comparison: partial_targets, backcast2 +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.049270629882812 seconds. +- Overall skill 0.353096; relative MASE 0.776739; relative WQL 0.538771. +- term skill: long=0.3692, medium=0.3760, short=0.3381. +- domain skill: Econ/Fin=0.0920, Energy=0.2294, Healthcare=0.3671, Nature=0.4574, Sales=0.5540, Transport=0.4141, Web/CloudOps=0.4294. +- frequency skill: A=0.3519, D=0.4253, H=0.3874, M=0.1772, Q=0.1555, S=0.2805, T=0.3464, W=0.2443. +- variates skill: multivariate=0.3599, univariate=0.3476. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E55 final12000 transferred difference, backcast2 +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.92556405067444 seconds. +- Overall skill 0.357472; relative MASE 0.772231; relative WQL 0.534610. +- term skill: long=0.3642, medium=0.3858, short=0.3437. +- domain skill: Econ/Fin=0.1127, Energy=0.2350, Healthcare=0.3474, Nature=0.4678, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4300. +- frequency skill: A=0.3556, D=0.4262, H=0.3901, M=0.1532, Q=0.1527, S=0.2796, T=0.3567, W=0.2577. +- variates skill: multivariate=0.3616, univariate=0.3541. +- Outcome: Transfer gains main+0.000163 and earlier1+0.001483, but loses earlier2 by0.001028. Average gain across the three cutoffs is positive; run exact full validation before deciding whether to publish this tradeoff. + +E31 amplitude-varying synthetic run completed24000 steps in7471.1 elapsed training-loop seconds on the shared H100. Final checkpoint is being checked with the selected fixed inference rules at all three cutoffs. + +## E58: increase width from our own trained model (preparing) +Repeated continuations of the36.8M model show diminishing gains. Hypothesis: more capacity can improve learning from the allowed corpus after a function-preserving initialization, given a sufficiently long matched schedule. Widen the selected E47 model from d512/heads8 to d1024/heads16, retaining enc6/dec4 and patch16. Duplicate hidden representations; duplicate input columns with weights divided by2; duplicate output rows. Preserve attention K/V grouping, repeat layernorm vectors, and repeat the original512-dimensional positional vector. Verify the unperturbed conversion on fixed synthetic fixtures. Then add independently seeded1%-of-tensor-standard-deviation noise to matrix weights to break duplicated-neuron symmetry, measuring the resulting prediction change. This is an initialization derived only from our own trained weights. + +A matched original-width control will use the same parent, data windows, seed113 and original sign-augmented loss. Proposed batch128, LR3e-5 and24000-step schedule are subject to a maximum-shape memory check after E31 releases its training slot. For widened matrices with duplicated input columns, use half the base learning rate and twice the weight decay to retain comparable initial functional update/decay scales; other parameters use the original rate. These settings and any necessary memory-driven batch adjustment will be recorded before training. No external weights or data. + +## E55 final12000 transferred update, exact full package validation +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372143; relative MASE 0.748865; relative WQL 0.526402. +- term skill: long=0.3930, medium=0.4049, short=0.3509. +- domain skill: Econ/Fin=0.1163, Energy=0.2302, Healthcare=0.4510, Nature=0.4286, Sales=0.3487, Transport=0.4659, Web/CloudOps=0.4912. +- frequency skill: A=0.2931, D=0.3551, H=0.3913, M=0.1284, Q=0.1851, S=0.4235, T=0.4275, W=0.2120. +- variates skill: multivariate=0.3885, univariate=0.3588. +- Outcome: Select for publication after relocation and determinism checks. Full skill0.372143 improves on E47 score0.371766. All97 configurations and151170 instances passed, with no quantile crossings; actual inference123.68 seconds. Earlier temporal diagnostics retain a tradeoff: first earlier cutoff+0.001483, second earlier cutoff-0.001028. The mean gain across the main and two earlier screens is positive; this is validation selection, not a held-out reward claim. + +E58 conversion produced 146477344 parameters. Maximum normalized-quantile difference before noise was 0.000001669; after the fixed1% matrix noise it was 0.018048. Conversion took 2.38 CPU seconds. Parent hash and noise seed113 are recorded in wide_capacity_initial.pt.json. + +Maximum-shape memory checks, including optimizer moments and EMA placeholders, used13326 MiB reserved at batch128 and10708 MiB at batch96; both had finite gradients. Choose batch96 for both arms to preserve evaluation headroom. Increase the planned schedule from24000 to32000 steps so the planned number of windows remains3072000 per arm. Save/evaluate4000,8000,16000,24000,32000. Base LR3e-5, seed113, unchanged context/horizon mixture and packed_sample. Wider-matrix LR multiplier0.5 and decay multiplier2 remain as declared. Start the wide arm now that E31 has exited; queue the original-width control after E57 completes. Research and package inference use batch64 for both widths to keep memory comparable. + +E55 relocation/determinism checks passed: the candidate and a separate fresh /tmp copy, both launched from /tmp, produced bitwise identical finite monotone quantiles for daily, hourly and multivariate medium-horizon examples. Publish the complete model/report/manifest/provenance/log bundle atomically. + +## E59: equal-weight ensemble of complementary training variants +The final E31 amplitude-varying model improves both earlier cutoffs over its recency24000 control, while its main fixed-rule screen is lower. The selected E55 transfer has the opposite second-earlier tradeoff. Hypothesis: an equal-weight average can reduce these differences. Reuse cached quantiles for E55 partial_delta12k and E31 amplitude24000, with both members forecasting every instance. Test only the fixed50/50 average, with and without applying the selected zero0.4 projection once more after averaging; averaging two zero-projected forecasts can otherwise introduce small positive values. No weight sweep or training. If promising, build and validate the actual two-member runtime before publication. + +## E31 final24000 with selected fixed rules, screen +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.934752464294434 seconds. +- Overall skill 0.375166; relative MASE 0.746944; relative WQL 0.522686. +- term skill: long=0.3998, medium=0.4070, short=0.3527. +- domain skill: Econ/Fin=0.1414, Energy=0.2355, Healthcare=0.4087, Nature=0.4266, Sales=0.3412, Transport=0.4655, Web/CloudOps=0.5053. +- frequency skill: A=0.3762, D=0.3445, H=0.3950, M=0.0900, Q=0.2023, S=0.4234, T=0.4389, W=0.2104. +- variates skill: multivariate=0.3958, univariate=0.3582. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E31 final24000 with selected fixed rules, backcast +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.675416946411133 seconds. +- Overall skill 0.334745; relative MASE 0.799254; relative WQL 0.553722. +- term skill: long=0.3965, medium=0.3574, short=0.3003. +- domain skill: Econ/Fin=0.1603, Energy=0.2277, Healthcare=0.4000, Nature=0.3619, Sales=0.3979, Transport=0.3709, Web/CloudOps=0.4497. +- frequency skill: A=0.3115, D=0.3485, H=0.3643, M=0.1990, Q=0.2289, S=0.3403, T=0.3365, W=0.2702. +- variates skill: multivariate=0.3522, univariate=0.3205. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E31 final24000 with selected fixed rules, backcast2 +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.473368406295776 seconds. +- Overall skill 0.358910; relative MASE 0.771616; relative WQL 0.532644. +- term skill: long=0.3672, medium=0.3833, short=0.3462. +- domain skill: Econ/Fin=0.1126, Energy=0.2349, Healthcare=0.3493, Nature=0.4705, Sales=0.5536, Transport=0.4202, Web/CloudOps=0.4327. +- frequency skill: A=0.3556, D=0.4300, H=0.3901, M=0.1370, Q=0.1497, S=0.2870, T=0.3573, W=0.2669. +- variates skill: multivariate=0.3623, univariate=0.3562. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E59 cached equal-weight comparison +No training; fixed inference seed0 and ensemble weight0.5 for each member. Member weights: selected E55 partial_delta12k SHA-256 721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802; amplitude24000 hash is recorded in its matched reports. + +screen: 2.65 CPU diagnostic seconds. +- average: skill 0.376116; term: short=0.3545, medium=0.4069, long=0.3997; domain: Econ/Fin=0.1408, Energy=0.2367, Healthcare=0.4304, Nature=0.4279, Sales=0.3385, Transport=0.4658, Web/CloudOps=0.5025; freq: A-DEC=0.3755, Q-DEC=0.2008, M=0.0994, W-SUN=0.0865, D=0.3491, H=0.3958, 15T=0.2143, W-FRI=-0.0164, 10T=0.6125, W-TUE=0.5565, W-THU=0.2049, W-WED=0.3155, 5T=0.5141, 10S=0.4235. +- average_then_zero: skill 0.376000; term: short=0.3545, medium=0.4068, long=0.3994; domain: Econ/Fin=0.1408, Energy=0.2367, Healthcare=0.4304, Nature=0.4277, Sales=0.3386, Transport=0.4658, Web/CloudOps=0.5021; freq: A-DEC=0.3755, Q-DEC=0.2008, M=0.0999, W-SUN=0.0865, D=0.3489, H=0.3957, 15T=0.2143, W-FRI=-0.0164, 10T=0.6124, W-TUE=0.5565, W-THU=0.2049, W-WED=0.3154, 5T=0.5138, 10S=0.4235. + +backcast: 2.59 CPU diagnostic seconds. +- average: skill 0.335702; term: short=0.3015, medium=0.3577, long=0.3976; domain: Econ/Fin=0.1625, Energy=0.2286, Healthcare=0.4066, Nature=0.3622, Sales=0.3978, Transport=0.3714, Web/CloudOps=0.4500; freq: A-DEC=0.3193, Q-DEC=0.2313, M=0.1979, W-SUN=0.0360, D=0.3493, H=0.3648, 15T=0.2260, W-FRI=0.2606, 10T=0.3193, W-TUE=0.5296, W-THU=0.2330, W-WED=0.3440, 5T=0.4376, 10S=0.3419. +- average_then_zero: skill 0.335612; term: short=0.3014, medium=0.3575, long=0.3976; domain: Econ/Fin=0.1625, Energy=0.2286, Healthcare=0.4066, Nature=0.3619, Sales=0.3980, Transport=0.3714, Web/CloudOps=0.4498; freq: A-DEC=0.3193, Q-DEC=0.2313, M=0.1983, W-SUN=0.0360, D=0.3491, H=0.3648, 15T=0.2260, W-FRI=0.2606, 10T=0.3188, W-TUE=0.5296, W-THU=0.2330, W-WED=0.3440, 5T=0.4372, 10S=0.3419. + +backcast2: 2.43 CPU diagnostic seconds. +- average: skill 0.358667; term: short=0.3455, medium=0.3850, long=0.3661; domain: Econ/Fin=0.1134, Energy=0.2353, Healthcare=0.3493, Nature=0.4696, Sales=0.5519, Transport=0.4203, Web/CloudOps=0.4320; freq: A-DEC=0.3562, Q-DEC=0.1515, M=0.1452, W-SUN=0.0558, D=0.4288, H=0.3904, 15T=0.1044, W-FRI=0.1452, 10T=0.4937, W-TUE=0.1018, W-THU=0.3276, W-WED=0.5366, 5T=0.4664, 10S=0.2839. +- average_then_zero: skill 0.358497; term: short=0.3453, medium=0.3849, long=0.3659; domain: Econ/Fin=0.1134, Energy=0.2352, Healthcare=0.3493, Nature=0.4693, Sales=0.5513, Transport=0.4203, Web/CloudOps=0.4318; freq: A-DEC=0.3562, Q-DEC=0.1515, M=0.1452, W-SUN=0.0558, D=0.4286, H=0.3904, 15T=0.1044, W-FRI=0.1452, 10T=0.4927, W-TUE=0.1018, W-THU=0.3276, W-WED=0.5364, 5T=0.4661, 10S=0.2839. + +Outcome: plain averaging wins all three cutoffs over the selected single model. Reapplying the zero projection after averaging is worse at every cutoff. Build the actual two-member package and verify cached/runtime agreement, full validation and relocation before publication. + +E58 wide_capacity_control training started at 2026-10-22T05:35:38Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E59 actual two-member runtime produced bitwise identical quantiles to the cached plain50/50 average for every point in all97 main-screen configurations. Its screening skill is0.37611643951533646, matching the probe exactly. Proceed to actual full-package inference and scoring. + +## E57 period-relative phase projections3000, screen +- Checkpoint SHA-256: `740fed81313fbb2dc2060173ae11ed120d6cca9600620cd1c9d9331ccac699e5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.340542793273926 seconds. +- Overall skill 0.375400; relative MASE 0.745694; relative WQL 0.523171. +- term skill: long=0.3995, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1392, Energy=0.2355, Healthcare=0.4394, Nature=0.4265, Sales=0.3394, Transport=0.4660, Web/CloudOps=0.4999. +- frequency skill: A=0.3762, D=0.3544, H=0.3946, M=0.0943, Q=0.1976, S=0.4227, T=0.4359, W=0.2085. +- variates skill: multivariate=0.3928, univariate=0.3611. +- Outcome: The6000-step score0.375840 is only0.000047 above its E47 parent, after earlier regressions. Existing model tensors remain bitwise unchanged. Check earlier cutoffs before selecting any use of these projections. + +## E57 period-relative phase projections6000, screen +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.05087399482727 seconds. +- Overall skill 0.375840; relative MASE 0.745321; relative WQL 0.522695. +- term skill: long=0.3997, medium=0.4065, short=0.3542. +- domain skill: Econ/Fin=0.1396, Energy=0.2356, Healthcare=0.4472, Nature=0.4272, Sales=0.3377, Transport=0.4655, Web/CloudOps=0.4998. +- frequency skill: A=0.3762, D=0.3562, H=0.3947, M=0.0979, Q=0.1989, S=0.4232, T=0.4357, W=0.2089. +- variates skill: multivariate=0.3935, univariate=0.3614. +- Outcome: The6000-step score0.375840 is only0.000047 above its E47 parent, after earlier regressions. Existing model tensors remain bitwise unchanged. Check earlier cutoffs before selecting any use of these projections. + +E57 completed6000 steps in1147.4 elapsed training-loop seconds. Every pre-existing tensor is bitwise equal to the E47 parent; only the65536 phase-projection parameters changed. E58 original-width control started after this process exited. + +## E58 widened initialization, main screen at batch64 +- Checkpoint SHA-256: `495eed9e1a09379b3cbcdadbee447d2c519a2cff8239c0756cf94f49f8a1b55e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 43.54188299179077 seconds. +- Overall skill 0.375710; relative MASE 0.745704; relative WQL 0.522645. +- term skill: long=0.3998, medium=0.4067, short=0.3538. +- domain skill: Econ/Fin=0.1394, Energy=0.2348, Healthcare=0.4397, Nature=0.4283, Sales=0.3400, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3540, H=0.3951, M=0.0946, Q=0.1984, S=0.4240, T=0.4362, W=0.2087. +- variates skill: multivariate=0.3937, univariate=0.3610. +- Outcome: Initial score0.375710 remains close to the original model before any larger-model training. The matched original-width initialization at the same inference batch size is being checked. + +## E56 log window loss3000, matched screen +- Checkpoint SHA-256: `14dd06fb6dff3c336f5aa26b8525d7ccb921a80b3e7be4d22b285584c14ff3bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.476420640945435 seconds. +- Overall skill 0.357135; relative MASE 0.765561; relative WQL 0.539835. +- term skill: long=0.3893, medium=0.3998, short=0.3270. +- domain skill: Econ/Fin=0.1142, Energy=0.1808, Healthcare=0.3930, Nature=0.4235, Sales=0.3538, Transport=0.4615, Web/CloudOps=0.5024. +- frequency skill: A=0.3804, D=0.3293, H=0.3825, M=0.1125, Q=0.2032, S=0.4413, T=0.3984, W=0.2094. +- variates skill: multivariate=0.3893, univariate=0.3303. +- Outcome: Score0.357135 regresses versus original-loss control0.358802. Continue to6000 before deciding whether to stop this objective. + +## E48 phase diffusion6000, matched screen +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.55935049057007 seconds. +- Overall skill 0.356225; relative MASE 0.765189; relative WQL 0.541626. +- term skill: long=0.3862, medium=0.3999, short=0.3266. +- domain skill: Econ/Fin=0.1072, Energy=0.1811, Healthcare=0.4144, Nature=0.4178, Sales=0.3484, Transport=0.4543, Web/CloudOps=0.5048. +- frequency skill: A=0.3702, D=0.3423, H=0.3775, M=0.0903, Q=0.1971, S=0.4361, T=0.4007, W=0.2000. +- variates skill: multivariate=0.3887, univariate=0.3292. +- Outcome: Score0.356225 versus amplitude-only0.355543: the main gain persists at6000. Earlier cutoffs are being evaluated. + +## E52 varied requested horizons6000, matched screen +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.603736400604248 seconds. +- Overall skill 0.359683; relative MASE 0.762743; relative WQL 0.537542. +- term skill: long=0.3900, medium=0.4024, short=0.3303. +- domain skill: Econ/Fin=0.1129, Energy=0.1876, Healthcare=0.4160, Nature=0.4253, Sales=0.3425, Transport=0.4576, Web/CloudOps=0.5040. +- frequency skill: A=0.3774, D=0.3429, H=0.3812, M=0.1107, Q=0.1984, S=0.4413, T=0.4021, W=0.2071. +- variates skill: multivariate=0.3915, univariate=0.3332. +- Outcome: Score0.359683 versus E42 partial-target control0.359222: a smaller main gain persists. Check both earlier cutoffs. + +## E54 original-context control6000, screen +- Checkpoint SHA-256: `14d964cb2b828f8e81c8b656b33da583b2f5fb48a3f003d043ba7c0b88cd3137`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.69702458381653 seconds. +- Overall skill 0.374515; relative MASE 0.746663; relative WQL 0.523973. +- term skill: long=0.3995, medium=0.4071, short=0.3516. +- domain skill: Econ/Fin=0.1381, Energy=0.2362, Healthcare=0.4110, Nature=0.4291, Sales=0.3380, Transport=0.4658, Web/CloudOps=0.5007. +- frequency skill: A=0.3757, D=0.3496, H=0.3960, M=0.0674, Q=0.2005, S=0.4225, T=0.4371, W=0.2070. +- variates skill: multivariate=0.3945, univariate=0.3581. +- Outcome: Fresh continuation is below the E25 parent. Keep as the matched source-window/seed reference for the8192-context arm. + +## E48 matched6000 comparison: amplitude_synth, backcast +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.44511580467224 seconds. +- Overall skill 0.324002; relative MASE 0.810229; relative WQL 0.564005. +- term skill: long=0.3880, medium=0.3521, short=0.2864. +- domain skill: Econ/Fin=0.1415, Energy=0.2210, Healthcare=0.3855, Nature=0.3485, Sales=0.3980, Transport=0.3607, Web/CloudOps=0.4366. +- frequency skill: A=0.3171, D=0.3509, H=0.3541, M=0.1703, Q=0.2160, S=0.3413, T=0.3204, W=0.2494. +- variates skill: multivariate=0.3381, univariate=0.3126. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: phase_synth, backcast +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.959611415863037 seconds. +- Overall skill 0.322903; relative MASE 0.811500; relative WQL 0.564954. +- term skill: long=0.3870, medium=0.3532, short=0.2843. +- domain skill: Econ/Fin=0.1406, Energy=0.2220, Healthcare=0.3697, Nature=0.3497, Sales=0.3989, Transport=0.3583, Web/CloudOps=0.4353. +- frequency skill: A=0.3141, D=0.3444, H=0.3533, M=0.1676, Q=0.2139, S=0.3417, T=0.3204, W=0.2546. +- variates skill: multivariate=0.3382, univariate=0.3105. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: amplitude_synth, backcast2 +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.365211486816406 seconds. +- Overall skill 0.349572; relative MASE 0.778615; relative WQL 0.543345. +- term skill: long=0.3660, medium=0.3724, short=0.3345. +- domain skill: Econ/Fin=0.0821, Energy=0.2234, Healthcare=0.3611, Nature=0.4581, Sales=0.5590, Transport=0.4121, Web/CloudOps=0.4247. +- frequency skill: A=0.3403, D=0.4277, H=0.3841, M=0.1545, Q=0.1409, S=0.2820, T=0.3394, W=0.2470. +- variates skill: multivariate=0.3548, univariate=0.3453. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: phase_synth, backcast2 +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.906906366348267 seconds. +- Overall skill 0.348439; relative MASE 0.780846; relative WQL 0.543682. +- term skill: long=0.3636, medium=0.3707, short=0.3341. +- domain skill: Econ/Fin=0.0817, Energy=0.2219, Healthcare=0.3552, Nature=0.4580, Sales=0.5591, Transport=0.4110, Web/CloudOps=0.4239. +- frequency skill: A=0.3402, D=0.4247, H=0.3827, M=0.1524, Q=0.1420, S=0.2780, T=0.3407, W=0.2441. +- variates skill: multivariate=0.3541, univariate=0.3439. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E59 equal-weight two-member ensemble, exact full package validation +- Checkpoint SHA-256: `a5f575ec44defbc0ca0c4aeb29618bbcc0e09f726985851eee4027ea698cfadd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372254; relative MASE 0.748754; relative WQL 0.526294. +- term skill: long=0.3937, medium=0.4059, short=0.3504. +- domain skill: Econ/Fin=0.1179, Energy=0.2297, Healthcare=0.4376, Nature=0.4278, Sales=0.3512, Transport=0.4661, Web/CloudOps=0.4950. +- frequency skill: A=0.2917, D=0.3537, H=0.3910, M=0.1216, Q=0.1860, S=0.4235, T=0.4302, W=0.2080. +- variates skill: multivariate=0.3905, univariate=0.3573. +- Outcome: Select after relocation/determinism checks: full skill0.372254 versus single-model0.372143; relative MASE0.748754 and WQL0.526294. All97 configurations and151170 instances passed with no quantile crossings. Actual package inference234.68 seconds while training shared the one H100. Main screening and both earlier cutoffs improve; every member forecasts every instance with fixed equal weights. + +E48 stopped cleanly at step7631, after 2736.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `702c419a404c2aad31011fb824ace504576f5e74244fc4228229fdfb2d970a9a`. The stop checkpoint is retained for provenance and is not selected. + +E59 relocation/determinism passed: the two-member candidate and a separate /tmp copy, both launched from /tmp, produced bitwise identical finite monotone forecasts on daily, hourly and multivariate medium-horizon examples. The complete two-member package is ready for atomic publication. + +## E57 phase projections final6000, backcast +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.856826066970825 seconds. +- Overall skill 0.333418; relative MASE 0.800235; relative WQL 0.555251. +- term skill: long=0.3968, medium=0.3558, short=0.2984. +- domain skill: Econ/Fin=0.1603, Energy=0.2271, Healthcare=0.4058, Nature=0.3594, Sales=0.3943, Transport=0.3716, Web/CloudOps=0.4455. +- frequency skill: A=0.3079, D=0.3513, H=0.3638, M=0.1776, Q=0.2354, S=0.3427, T=0.3327, W=0.2745. +- variates skill: multivariate=0.3498, univariate=0.3201. +- Outcome: Reject this feature addition: main gain0.000047 is offset by earlier1 loss0.000708 and earlier2 loss0.000030 versus the frozen E47 parent. No package change from this branch. + +## E52 varied requested horizons6000, backcast +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.876362562179565 seconds. +- Overall skill 0.330107; relative MASE 0.806559; relative WQL 0.556384. +- term skill: long=0.3900, medium=0.3554, short=0.2954. +- domain skill: Econ/Fin=0.1459, Energy=0.2294, Healthcare=0.4132, Nature=0.3489, Sales=0.3970, Transport=0.3634, Web/CloudOps=0.4423. +- frequency skill: A=0.3187, D=0.3539, H=0.3583, M=0.1613, Q=0.2281, S=0.3442, T=0.3292, W=0.2708. +- variates skill: multivariate=0.3469, univariate=0.3164. +- Outcome: Relative to E42 partial-target control6000: main+0.000461, earlier1-0.000193, earlier2+0.000278. Continue to the final12000 checkpoint; a small positive average effect persists. + +## E57 phase projections final6000, backcast2 +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.712015867233276 seconds. +- Overall skill 0.358470; relative MASE 0.770691; relative WQL 0.534015. +- term skill: long=0.3646, medium=0.3858, short=0.3453. +- domain skill: Econ/Fin=0.1102, Energy=0.2363, Healthcare=0.3561, Nature=0.4700, Sales=0.5508, Transport=0.4205, Web/CloudOps=0.4287. +- frequency skill: A=0.3495, D=0.4331, H=0.3891, M=0.1593, Q=0.1505, S=0.2824, T=0.3568, W=0.2548. +- variates skill: multivariate=0.3620, univariate=0.3556. +- Outcome: Reject this feature addition: main gain0.000047 is offset by earlier1 loss0.000708 and earlier2 loss0.000030 versus the frozen E47 parent. No package change from this branch. + +## E52 varied requested horizons6000, backcast2 +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.18545150756836 seconds. +- Overall skill 0.353179; relative MASE 0.775830; relative WQL 0.539265. +- term skill: long=0.3689, medium=0.3764, short=0.3382. +- domain skill: Econ/Fin=0.0847, Energy=0.2293, Healthcare=0.3759, Nature=0.4588, Sales=0.5595, Transport=0.4134, Web/CloudOps=0.4274. +- frequency skill: A=0.3432, D=0.4263, H=0.3869, M=0.1771, Q=0.1489, S=0.2829, T=0.3454, W=0.2495. +- variates skill: multivariate=0.3591, univariate=0.3484. +- Outcome: Relative to E42 partial-target control6000: main+0.000461, earlier1-0.000193, earlier2+0.000278. Continue to the final12000 checkpoint; a small positive average effect persists. + +## E60 filtered shared drivers for a frozen cross-channel adapter +Hypothesis: earlier joint adapters saw lagged shared latent drivers but no channel-specific response filtering. A synthetic fast driver and a smoothed response may better represent thermal and energy relationships. Compare original joint generation against causal exponential filtering of half the channels in half the synthetic groups. Filtering time constant is log-uniform from1 to316 steps, applied before observation noise with256 warmup points and stationary initial level. Real windows, latent drivers, coefficients, noise, signs and scales use matched main RNG draws. +- Parent: own E55 partial_delta12k checkpoint, SHA-256721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802. All original weights frozen. Add the previously tested zero-output cross-channel attention adapter (1051136 parameters). Every instance is forecast; one-channel inputs have the identity adapter. +- Data: the26 allow-listed sources in packed_joint plus the original locally generated multivariate latent-driver generator. Synthetic fraction0.30. Candidate adds the declared filtered-response generator. No validation input or labels enter training. +- Matched seed137; independent filter seed400140. Groups16, channels2/3/4/8 with probabilities0.4/0.2/0.2/0.2; contexts512/1024/2048/4096 and horizons32/128/512/1024 follow the original joint sampler. Paired-sign loss in both arms, AdamW LR0.0002,6000 steps, save1000/3000/6000 for diagnostics. One shared H100; training elapsed time will be recorded separately for each arm. +- Selection: compare all97 configurations and both earlier cutoffs against the frozen parent and matched control. First verify sampler matching, identity initialization and maximum-shape memory without optimizer updates. No outcome yet. + +## E56 logarithmic window loss3000 +- Checkpoint SHA-256: `14dd06fb6dff3c336f5aa26b8525d7ccb921a80b3e7be4d22b285584c14ff3bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.476420640945435 seconds. +- Overall skill 0.357135; relative MASE 0.765561; relative WQL 0.539835. +- term skill: long=0.3893, medium=0.3998, short=0.3270. +- domain skill: Econ/Fin=0.1142, Energy=0.1808, Healthcare=0.3930, Nature=0.4235, Sales=0.3538, Transport=0.4615, Web/CloudOps=0.5024. +- frequency skill: A=0.3804, D=0.3293, H=0.3825, M=0.1125, Q=0.2032, S=0.4413, T=0.3984, W=0.2094. +- variates skill: multivariate=0.3893, univariate=0.3303. +- Outcome: Below matched control; the loss transformation is not selected. + +## E56 logarithmic window loss6000 +- Checkpoint SHA-256: `3346c86c6ce73e739fdd2a286b7cd4c1dab7430f6ee1ea8056b8db4943c48d66`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.688469886779785 seconds. +- Overall skill 0.357689; relative MASE 0.764496; relative WQL 0.539655. +- term skill: long=0.3904, medium=0.4011, short=0.3270. +- domain skill: Econ/Fin=0.1167, Energy=0.1822, Healthcare=0.3871, Nature=0.4260, Sales=0.3525, Transport=0.4624, Web/CloudOps=0.5018. +- frequency skill: A=0.3766, D=0.3301, H=0.3834, M=0.1073, Q=0.2061, S=0.4406, T=0.3995, W=0.2098. +- variates skill: multivariate=0.3901, univariate=0.3306. +- Outcome: Skill0.357689 versus matched control0.358628; second regression. Stop and retain existing linear window loss. + +## E54 recent4096 matched control final12000 +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.02079463005066 seconds. +- Overall skill 0.375764; relative MASE 0.744880; relative WQL 0.523131. +- term skill: long=0.4000, medium=0.4083, short=0.3532. +- domain skill: Econ/Fin=0.1410, Energy=0.2368, Healthcare=0.4240, Nature=0.4300, Sales=0.3368, Transport=0.4653, Web/CloudOps=0.5016. +- frequency skill: A=0.3753, D=0.3535, H=0.3960, M=0.0712, Q=0.2025, S=0.4230, T=0.4374, W=0.2130. +- variates skill: multivariate=0.3961, univariate=0.3591. +- Outcome: Finished12000 steps in2491.2 training-loop seconds. Small gain over frozen parent; await the8192 arm before interpretation. + +## E58 widened146M first4000 +- Checkpoint SHA-256: `a8e3dbf8f591804fb3ac6c72ac632dd9e18038e4da7f195208e56f85f41ecd29`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.12893605232239 seconds. +- Overall skill 0.374121; relative MASE 0.747837; relative WQL 0.523810. +- term skill: long=0.3989, medium=0.4070, short=0.3512. +- domain skill: Econ/Fin=0.1400, Energy=0.2366, Healthcare=0.4144, Nature=0.4278, Sales=0.3414, Transport=0.4641, Web/CloudOps=0.4992. +- frequency skill: A=0.3730, D=0.3465, H=0.3947, M=0.0955, Q=0.1987, S=0.4198, T=0.4367, W=0.2046. +- variates skill: multivariate=0.3940, univariate=0.3578. +- Outcome: Ahead of matched37M control by0.000510, but below initial checkpoint. Continue the prespecified longer capacity comparison. + +## E58 matched37M first4000 +- Checkpoint SHA-256: `65969ac2e314e6103c326ab0fe1c550d53a285833d9f983e1c1cdff0d7fb66b3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.00419569015503 seconds. +- Overall skill 0.373612; relative MASE 0.748644; relative WQL 0.524097. +- term skill: long=0.3990, medium=0.4070, short=0.3502. +- domain skill: Econ/Fin=0.1392, Energy=0.2363, Healthcare=0.4121, Nature=0.4272, Sales=0.3410, Transport=0.4638, Web/CloudOps=0.4989. +- frequency skill: A=0.3725, D=0.3451, H=0.3948, M=0.0947, Q=0.1985, S=0.4190, T=0.4363, W=0.2034. +- variates skill: multivariate=0.3937, univariate=0.3572. +- Outcome: Below starting checkpoint; matched capacity comparison continues. + +E56 stop receipt: {"stopped_utc": "2026-10-22T05:53:09.078048+00:00", "reason": "Main screen below matched E38 control at both3000 and6000; prune negative branch.", "final_checkpoint": "/workspace/research/runs/log_window_loss/ema006767.pt", "final_checkpoint_sha256": "ec25440f0d11ac776874679e366255ce9cf54138f2e6802efba22bc88157d06c", "final_step": 6767, "elapsed_training_process_seconds": null} + +E56 measured training-process elapsed time was2298.259 seconds (the previous receipt field was null because the reader used the wrong key; corrected in log_window_loss_stop_receipt.json). + +E60 checks passed: { + "cpu_check_seconds": 1.9617000540019944, + "changed_synthetic_context_values": 21054, + "identity_matches_parent_bitwise": true, + "main_and_filter_rng_matched": true, + "real_windows_unchanged": true, + "optimizer_updates": 0, + "gpu_fixture_seconds": 1.0786702629411593, + "allocated_mib": 2625.63525390625, + "reserved_mib": 3872.0, + "parameters": 37851936, + "trainable_parameters": 1051136, + "loss": 0.3574138879776001 +} +Both arms now start on the shared H100. No optimizer updates occurred during fixtures. + +## E61 log-uniform autoregressive memory in synthetic windows +Hypothesis: the original AR coefficient uniform0.2..0.995 overwhelmingly supplies rapidly decorrelating noise. Energy and short-horizon electricity remain weak across cutoffs; slow stochastic level variation may be missing. Change only the AR coefficient draw to phi=exp(-1/tau), log10(tau) uniform0..4. Keep the existing zero initial state and sqrt(1-phi^2) innovation normalization. All Fourier seasons, trends, changepoints, intermittency, observation-noise draws, synthetic fraction and real-window draws remain matched. +- Matched reference is the already completed E42 partial_targets run; do not retrain it. Same own E25 recency12000 initialization, seed79, packed_sample95-source corpus, B256, AdamW LR0.00005,12000 steps, saves3000/6000/12000. The E42 handling of partially observed targets is unchanged. +- Source declaration if selected: original local generator plus the modified log-uniform AR-time-constant generator, seed79. No new external data or pretrained assets. +- Scheduled after E52 releases its H100 allocation. Validate main screening and both earlier cutoffs against E42 at matched steps, then consider a matched parameter-difference transfer only if the learned effect is useful. No outcome yet. + +E61 sampler checks passed: {"cpu_seconds": 4.961035819957033, "main_rng_matched": true, "real_windows_unchanged": true, "periods_and_missing_masks_unchanged": true, "changed_synthetic_context_values": 31554, "optimizer_updates": 0} + +## E60 joint_filtered_control_ema0 +- Checkpoint SHA-256: `3a7e46a74247ccf366c4e2b950fe1e1cc3625c52f7db1f6fdebab261d1d66ae8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.121415376663208 seconds. +- Overall skill 0.375956; relative MASE 0.746201; relative WQL 0.521885. +- term skill: long=0.3991, medium=0.4059, short=0.3549. +- domain skill: Econ/Fin=0.1387, Energy=0.2371, Healthcare=0.4442, Nature=0.4287, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3506, H=0.3961, M=0.1054, Q=0.1984, S=0.4235, T=0.4345, W=0.2191. +- variates skill: multivariate=0.3928, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E60 joint_filtered_control_ema1000 +- Checkpoint SHA-256: `8f3493cddbf6579a69ed813b056f8a16110f6309d7589016703b68022bef205c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.04537320137024 seconds. +- Overall skill 0.376238; relative MASE 0.745929; relative WQL 0.521603. +- term skill: long=0.4000, medium=0.4050, short=0.3554. +- domain skill: Econ/Fin=0.1387, Energy=0.2375, Healthcare=0.4442, Nature=0.4301, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4986. +- frequency skill: A=0.3739, D=0.3521, H=0.3962, M=0.1054, Q=0.1984, S=0.4213, T=0.4350, W=0.2191. +- variates skill: multivariate=0.3934, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E60 joint_filtered_candidate_ema1000 +- Checkpoint SHA-256: `444ffa52005a89ef409a284a2a952d82da7f760e17f1ea865f118b1bb878fec5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.930442571640015 seconds. +- Overall skill 0.376281; relative MASE 0.745845; relative WQL 0.521590. +- term skill: long=0.4002, medium=0.4050, short=0.3554. +- domain skill: Econ/Fin=0.1387, Energy=0.2376, Healthcare=0.4442, Nature=0.4299, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4988. +- frequency skill: A=0.3739, D=0.3524, H=0.3961, M=0.1054, Q=0.1984, S=0.4208, T=0.4351, W=0.2191. +- variates skill: multivariate=0.3935, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E58 matched37M at8000 +- Checkpoint SHA-256: `2e8a53df1226d34548c14d2f6aa29531e9562825e077658040ad03cf1584e407`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.826340913772583 seconds. +- Overall skill 0.374665; relative MASE 0.746940; relative WQL 0.523529. +- term skill: long=0.3997, medium=0.4070, short=0.3518. +- domain skill: Econ/Fin=0.1410, Energy=0.2366, Healthcare=0.4123, Nature=0.4301, Sales=0.3395, Transport=0.4651, Web/CloudOps=0.4997. +- frequency skill: A=0.3794, D=0.3492, H=0.3961, M=0.0913, Q=0.2022, S=0.4225, T=0.4363, W=0.2001. +- variates skill: multivariate=0.3935, univariate=0.3592. +- Outcome: Recovered from the4000-step dip but remains below its parent. Await the matched146M checkpoint. + +## E31 amplitude synthesis final24000 with original mean-template runtime +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.28603458404541 seconds. +- Overall skill 0.361862; relative MASE 0.761019; relative WQL 0.535099. +- term skill: long=0.3937, medium=0.4047, short=0.3318. +- domain skill: Econ/Fin=0.1167, Energy=0.1881, Healthcare=0.4079, Nature=0.4215, Sales=0.3445, Transport=0.4600, Web/CloudOps=0.5131. +- frequency skill: A=0.3736, D=0.3413, H=0.3832, M=0.0977, Q=0.2001, S=0.4426, T=0.4085, W=0.2080. +- variates skill: multivariate=0.3973, univariate=0.3321. +- Outcome: Finished24000 steps in7471.1 training-loop seconds. Original-rule screening score slightly exceeds matched E25; current-rule and ensemble comparisons are recorded separately. This checkpoint is member1 of E59. + +## E60 joint_filtered_control_ema3000 +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.558463096618652 seconds. +- Overall skill 0.376364; relative MASE 0.746340; relative WQL 0.521106. +- term skill: long=0.4004, medium=0.4033, short=0.3562. +- domain skill: Econ/Fin=0.1387, Energy=0.2353, Healthcare=0.4442, Nature=0.4338, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3535, H=0.3966, M=0.1054, Q=0.1984, S=0.4217, T=0.4342, W=0.2193. +- variates skill: multivariate=0.3937, univariate=0.3622. +- Outcome: Both remain ahead of the frozen parent on the main screen. Unfiltered control now leads by 0.000084; earlier-cutoff evaluations are running. Continue both to 6000 as specified. + +## E60 joint_filtered_candidate_ema3000 +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.436699151992798 seconds. +- Overall skill 0.376280; relative MASE 0.746320; relative WQL 0.521261. +- term skill: long=0.4005, medium=0.4035, short=0.3559. +- domain skill: Econ/Fin=0.1387, Energy=0.2352, Healthcare=0.4442, Nature=0.4324, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4997. +- frequency skill: A=0.3739, D=0.3528, H=0.3961, M=0.1054, Q=0.1984, S=0.4201, T=0.4351, W=0.2193. +- variates skill: multivariate=0.3935, univariate=0.3622. +- Outcome: Both remain ahead of the frozen parent on the main screen. Unfiltered control now leads by 0.000084; earlier-cutoff evaluations are running. Continue both to 6000 as specified. + +## E62 matched horizon-training correction transferred to the selected backbone +Hypothesis: E52's varied requested horizons may add to E42's partial-target correction when transferred to the later E47 backbone. Repeat the successful E55 matched-difference method with the E52 final checkpoint: E47 confidence6000 + E52 horizon_jitter12000 - E38 control12000. Coefficient is fixed at 1.0, with no sweep. This is equivalently the E55 backbone plus the E52-minus-E42 horizon-training difference, apart from floating-point order. Confidence projection remains unchanged. All three parents originate from our own random initialization and permitted sources. +- No new training or data. CPU merge records parent hashes and elapsed time; the candidate will use the current fixed inference rules. +- Compare the main screen and both earlier cutoffs against E55 and the current E59 package before any full validation or publication. A single main-screen gain is insufficient. No outcome yet. + +E61 long_memory_synth training started at 2026-10-22T06:01:39Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E60 joint_filtered_control at3000, backcast_evals +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.748270750045776 seconds. +- Overall skill 0.334618; relative MASE 0.799261; relative WQL 0.553928. +- term skill: long=0.3961, medium=0.3571, short=0.3004. +- domain skill: Econ/Fin=0.1631, Energy=0.2278, Healthcare=0.4091, Nature=0.3620, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4461. +- frequency skill: A=0.3254, D=0.3492, H=0.3639, M=0.1918, Q=0.2328, S=0.3399, T=0.3325, W=0.2872. +- variates skill: multivariate=0.3503, univariate=0.3218. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_control at3000, backcast2_evals +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.68830132484436 seconds. +- Overall skill 0.355826; relative MASE 0.774983; relative WQL 0.535445. +- term skill: long=0.3630, medium=0.3845, short=0.3417. +- domain skill: Econ/Fin=0.1127, Energy=0.2316, Healthcare=0.3474, Nature=0.4679, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4270. +- frequency skill: A=0.3556, D=0.4260, H=0.3879, M=0.1532, Q=0.1527, S=0.2768, T=0.3543, W=0.2578. +- variates skill: multivariate=0.3579, univariate=0.3541. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_candidate at3000, backcast_evals +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.67229199409485 seconds. +- Overall skill 0.334545; relative MASE 0.799017; relative WQL 0.554218. +- term skill: long=0.3960, medium=0.3575, short=0.3001. +- domain skill: Econ/Fin=0.1631, Energy=0.2272, Healthcare=0.4091, Nature=0.3627, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4460. +- frequency skill: A=0.3254, D=0.3486, H=0.3640, M=0.1918, Q=0.2328, S=0.3383, T=0.3328, W=0.2870. +- variates skill: multivariate=0.3502, univariate=0.3218. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_candidate at3000, backcast2_evals +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.532593488693237 seconds. +- Overall skill 0.356065; relative MASE 0.774672; relative WQL 0.535261. +- term skill: long=0.3639, medium=0.3845, short=0.3418. +- domain skill: Econ/Fin=0.1127, Energy=0.2321, Healthcare=0.3474, Nature=0.4679, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4274. +- frequency skill: A=0.3556, D=0.4256, H=0.3883, M=0.1532, Q=0.1527, S=0.2764, T=0.3550, W=0.2576. +- variates skill: multivariate=0.3584, univariate=0.3541. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E63 corpus expansion at 146M capacity +Hypothesis: E38's larger packed corpus did not improve the 37M model over 12,000 continuation steps, but a larger model with a longer schedule may benefit from the additional diversity. Add one matched data arm to E58: the same 146M initialization and optimization, using packed_expanded instead of packed_sample. The already-running E58 146M arm is the control; it is not retrained. +- Both packs contain the same 95 allow-listed directories. Source probabilities are read from packed_sample in both arms, so this changes within-source diversity rather than source balance. The expanded pack contains 5,653,290,832 points versus 958,745,103 in the control. No new generator or external source. +- Same own wide_capacity_initial checkpoint, seed 113, B96, 32,000 steps, base LR 0.00003, matched width-dependent AdamW groups, independently sign-augmented loss and EMA. Same runtime and batch64 for validation. All parameters train. +- First verify that the new loader reproduces the control's sampler exactly when given the control pack, and that expanded source probabilities match. The model and maximum tensor shapes are unchanged from the measured E58 memory fixture. +- Start after E60 adapter jobs stop. Compare checkpoints at 4000/8000/16000/24000/32000; evaluate earlier cutoffs before selection. This explicitly tests the interaction of corpus diversity and capacity, rather than repeating the small-model data comparison. No outcome yet. + +E63 checks passed: {"cpu_seconds": 6.780377898016013, "control_sampler_bitwise_equal": true, "source_probabilities_identical": true, "optimizer_updates": 0, "initial_checkpoint_sha256": "c3d41b52987eb033dcc60b4cd59e13e8adb75e319fe5f5bc043296faaac04849"} + +E60 joint_filtered_control stopped: {"final_step": 4691, "final_checkpoint": "/workspace/research/runs/joint_filtered_control/ema004691.pt", "checkpoint_sha256": "8d48a377b49cfd980a973aa9505565a537ed69c27c621ccf39b19d5787fb720b", "last_logged_training_seconds": 592.3, "last_logged_step": 4650, "all_original_tensors_bitwise_unchanged": true, "reason": "Both earlier cutoffs regress at3000 by more than the main gain; negative branch pruned."} + +E60 joint_filtered_candidate stopped: {"final_step": 4648, "final_checkpoint": "/workspace/research/runs/joint_filtered_candidate/ema004648.pt", "checkpoint_sha256": "1574e71b8877b5620a5929a55df22347c9475184194dec37ccb38c0eb71ed9c8", "last_logged_training_seconds": 590.2, "last_logged_step": 4600, "all_original_tensors_bitwise_unchanged": true, "reason": "Both earlier cutoffs regress at3000 by more than the main gain; negative branch pruned."} + +## E52 varied requested horizons final12000 +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.63369631767273 seconds. +- Overall skill 0.362379; relative MASE 0.760035; relative WQL 0.534923. +- term skill: long=0.3913, medium=0.4055, short=0.3334. +- domain skill: Econ/Fin=0.1099, Energy=0.1916, Healthcare=0.4150, Nature=0.4272, Sales=0.3410, Transport=0.4599, Web/CloudOps=0.5083. +- frequency skill: A=0.3715, D=0.3433, H=0.3828, M=0.1086, Q=0.1994, S=0.4416, T=0.4075, W=0.2138. +- variates skill: multivariate=0.3960, univariate=0.3343. +- Outcome: Completed in3887.5 training-loop seconds (3897.218 process seconds). Main improves versus matched E42; inspect both earlier cutoffs and E62 transfer. + +## E52 final12000 first earlier cutoff +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 19.096883296966553 seconds. +- Overall skill 0.331566; relative MASE 0.804478; relative WQL 0.555396. +- term skill: long=0.3906, medium=0.3563, short=0.2975. +- domain skill: Econ/Fin=0.1463, Energy=0.2302, Healthcare=0.4120, Nature=0.3520, Sales=0.3984, Transport=0.3650, Web/CloudOps=0.4442. +- frequency skill: A=0.3138, D=0.3562, H=0.3588, M=0.1622, Q=0.2341, S=0.3415, T=0.3316, W=0.2747. +- variates skill: multivariate=0.3480, univariate=0.3182. +- Outcome: Improves over E42 by0.000492. + +## E52 final12000 second earlier cutoff +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 18.59932589530945 seconds. +- Overall skill 0.353232; relative MASE 0.776549; relative WQL 0.538676. +- term skill: long=0.3692, medium=0.3768, short=0.3380. +- domain skill: Econ/Fin=0.0898, Energy=0.2297, Healthcare=0.3632, Nature=0.4567, Sales=0.5538, Transport=0.4144, Web/CloudOps=0.4314. +- frequency skill: A=0.3506, D=0.4238, H=0.3876, M=0.1727, Q=0.1527, S=0.2824, T=0.3479, W=0.2436. +- variates skill: multivariate=0.3614, univariate=0.3466. +- Outcome: Improves over E42 by0.000136. The final horizon variation treatment improves all three matched screening windows. + +## E62 transferred horizon correction main screen +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.18038821220398 seconds. +- Overall skill 0.377343; relative MASE 0.744367; relative WQL 0.520847. +- term skill: long=0.3993, medium=0.4068, short=0.3570. +- domain skill: Econ/Fin=0.1398, Energy=0.2376, Healthcare=0.4513, Nature=0.4321, Sales=0.3339, Transport=0.4661, Web/CloudOps=0.4995. +- frequency skill: A=0.3721, D=0.3559, H=0.3958, M=0.1049, Q=0.1994, S=0.4226, T=0.4360, W=0.2230. +- variates skill: multivariate=0.3942, univariate=0.3636. +- Outcome: Main gain0.001387 over E55. CPU composition1.266 seconds; await both earlier-cutoff checks before full validation. + +## E62 transferred horizon correction first earlier cutoff +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.59067988395691 seconds. +- Overall skill 0.336227; relative MASE 0.797258; relative WQL 0.552638. +- term skill: long=0.3980, medium=0.3585, short=0.3020. +- domain skill: Econ/Fin=0.1632, Energy=0.2299, Healthcare=0.4035, Nature=0.3641, Sales=0.3973, Transport=0.3720, Web/CloudOps=0.4497. +- frequency skill: A=0.3264, D=0.3494, H=0.3653, M=0.1894, Q=0.2332, S=0.3419, T=0.3364, W=0.2851. +- variates skill: multivariate=0.3539, univariate=0.3218. +- Outcome: Improves over E55 by0.000618 and current E59 ensemble by0.000525; second earlier cutoff pending. + +## E64 replace the horizon-corrected member in the fixed equal-weight ensemble +Hypothesis: E62 improves all three windows against E55, but the current E59 ensemble remains stronger at the second earlier cutoff. Replace only member0 of E59 with E62 and retain the amplitude-trained member1, applying the same equal quantile average after each member's fixed rules. No new weights, training, blend coefficient or postprocessing is introduced. Every member still forecasts every instance. +- Use cached forecasts first on the main screen and both earlier cutoffs. Compare the candidate ensemble with E62 alone and E59. Validate the actual package if the composition offers a useful improvement. + +## E62 transferred horizon correction second earlier cutoff +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.85834312438965 seconds. +- Overall skill 0.357693; relative MASE 0.772232; relative WQL 0.534241. +- term skill: long=0.3647, medium=0.3858, short=0.3439. +- domain skill: Econ/Fin=0.1095, Energy=0.2360, Healthcare=0.3457, Nature=0.4673, Sales=0.5494, Transport=0.4200, Web/CloudOps=0.4312. +- frequency skill: A=0.3533, D=0.4246, H=0.3905, M=0.1533, Q=0.1508, S=0.2809, T=0.3574, W=0.2594. +- variates skill: multivariate=0.3632, univariate=0.3532. +- Outcome: Improves over E55 by0.000222. All three screening windows improve against the single-model parent; E59 still leads at this cutoff. Proceed to full validation and the fixed E64 ensemble comparison. + +E64 member checkpoint hashes: 22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb. + +E64 cached screen: skill 0.376788946; relative MASE 0.745126449; relative WQL 0.521243098; CPU elapsed 4.12 seconds. Group skill: {"term": {"short": 0.3554964007817075, "medium": 0.4073693459600539, "long": 0.3998307241854733}, "domain": {"Econ/Fin": 0.14130300023652653, "Energy": 0.2369496172656066, "Healthcare": 0.4331271903068751, "Nature": 0.4295973732895463, "Sales": 0.3381125790990753, "Transport": 0.4660477929672022, "Web/CloudOps": 0.5028903628931379}, "freq": {"A-DEC": 0.37465521703273497, "Q-DEC": 0.20133386157730448, "M": 0.09799796329514798, "W-SUN": 0.09310304137899561, "D": 0.35177652554445227, "H": 0.39569724381500315, "15T": 0.21510285937582785, "W-FRI": -0.01717810068114023, "10T": 0.6134978939570246, "W-TUE": 0.5590219029222432, "W-THU": 0.20713023925638596, "W-WED": 0.3147893218102069, "5T": 0.5146554293758923, "10S": 0.42304338912946016}}. + +E64 cached backcast: skill 0.336038010; relative MASE 0.797789283; relative WQL 0.552583914; CPU elapsed 3.90 seconds. Group skill: {"term": {"short": 0.3017705847743448, "medium": 0.3583628431586988, "long": 0.3977762964359516}, "domain": {"Econ/Fin": 0.16247452271830498, "Energy": 0.22924210402608347, "Healthcare": 0.4037429866174578, "Nature": 0.3634291235876055, "Sales": 0.3979195783227222, "Transport": 0.3717322673047254, "Web/CloudOps": 0.45027750430374125}, "freq": {"A-DEC": 0.31962125220900417, "Q-DEC": 0.23151630865404227, "M": 0.19676862244049742, "W-SUN": 0.04104954385433246, "D": 0.3494141749986718, "H": 0.36512969667883677, "15T": 0.22647340624655954, "W-FRI": 0.26044659511767176, "10T": 0.3206375756185784, "W-TUE": 0.5251272756681418, "W-THU": 0.23336875275806457, "W-WED": 0.34380336710053805, "5T": 0.4388723441407405, "10S": 0.34124569112919356}}. + +E64 cached backcast2: skill 0.358773194; relative MASE 0.771487726; relative WQL 0.532959635; CPU elapsed 3.84 seconds. Group skill: {"term": {"short": 0.3455453575305818, "medium": 0.3850562697420571, "long": 0.3662794409758179}, "domain": {"Econ/Fin": 0.11178929070509958, "Energy": 0.2358139051710867, "Healthcare": 0.3485087569088834, "Nature": 0.46931745466541086, "Sales": 0.5520970513032182, "Transport": 0.4203697870790297, "Web/CloudOps": 0.4324624263189104}, "freq": {"A-DEC": 0.3552674881858966, "Q-DEC": 0.15052699940899794, "M": 0.14543941174604302, "W-SUN": 0.05780563284435891, "D": 0.4280091613762501, "H": 0.39053406736994467, "15T": 0.10558086695082369, "W-FRI": 0.14677601366514947, "10T": 0.4931102944101511, "W-TUE": 0.10259191794259981, "W-THU": 0.32777977287160787, "W-WED": 0.5368109233756173, "5T": 0.46691593361082795, "10S": 0.2842010268357835}}. + +E64 improves over current E59 on all three cutoffs. Versus E62 alone, it trails on the main screen and first earlier cutoff but gains at the second. Both complete packages will receive full validation; the current root remains E59 until that comparison and determinism checks finish. + +E64 actual package matches the cached equal-weight composition bitwise for every quantile in all 97 screening configurations. Proceed to exact full-package validation. + +## E65 recent normalization with an 8192-point encoder context +Hypothesis: adding older history changes the normalization reference as well as supplying extra observations. E54's final8192 model scores0.375118 versus its matched4096 control0.375764. Test whether retaining the recent4096 mean and standard deviation makes older context easier to use. The encoder still receives all8192 points; every point and future target uses the recent reference frame. If the recent segment has no finite observations, fall back to the full available context. +- Change only normalization. Same E54 initialization from own recency24000, seed101, matched packed_sample windows, B128, LR0.00003,12000 steps, maximum context8192 and sample context8192. Contexts of at most4096 retain the original formula. Fixed inference corrections still see only4096 observations. The existing E54 long-context run is the control. No new sources or generators. +- Training-data diagnostic: 256 real allowed-corpus windows, seed151;101 had sufficient older and recent history. Full/recent standard-deviation ratio p10/p50/p90 was0.932/1.003/1.255; absolute mean shift in recent standard deviations was0.0068/0.0512/0.4089. This motivates testing the frame, without establishing it as the cause of the regression. Diagnostic CPU time1.90 seconds; no validation data used. +- Verify exact equivalence for contexts at most4096 and finite fallback behavior before launch. Check main screens at3000/6000/12000 and earlier cutoffs before selection. No outcome yet. + +E65 checks passed: {"cpu_seconds": 0.7186618210980669, "short_context_normalization_bitwise_equal": true, "short_context_forecast_bitwise_equal": true, "recent_reference_and_empty_recent_fallback_verified": true, "all_missing_finite": true, "optimizer_updates": 0} + +## E62 exact full-package validation +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.373420; relative MASE 0.747096; relative WQL 0.525505. +- term skill: long=0.3931, medium=0.4057, short=0.3528. +- domain skill: Econ/Fin=0.1173, Energy=0.2305, Healthcare=0.4574, Nature=0.4321, Sales=0.3479, Transport=0.4663, Web/CloudOps=0.4919. +- frequency skill: A=0.2918, D=0.3600, H=0.3910, M=0.1281, Q=0.1853, S=0.4226, T=0.4289, W=0.2156. +- variates skill: multivariate=0.3899, univariate=0.3600. +- Outcome: Full skill0.373420 versus E59 published0.372254. All97 configurations and151170 instances pass; no quantile crossings. Actual inference116.659 seconds. Await E64 full comparison and relocation/determinism before choosing the next publication. + +## E54 context8192 final12000 +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.50181746482849 seconds. +- Overall skill 0.375118; relative MASE 0.744591; relative WQL 0.524419. +- term skill: long=0.4042, medium=0.4057, short=0.3513. +- domain skill: Econ/Fin=0.1426, Energy=0.2337, Healthcare=0.4381, Nature=0.4222, Sales=0.3378, Transport=0.4707, Web/CloudOps=0.5001. +- frequency skill: A=0.3749, D=0.3573, H=0.3955, M=0.0779, Q=0.2010, S=0.4259, T=0.4332, W=0.2127. +- variates skill: multivariate=0.3910, univariate=0.3622. +- Outcome: Finished in3285.3 training-loop seconds (3296.255 process seconds). Main skill0.375118 remains below matched4096 control0.375764. Do not select this checkpoint; E65 isolates the normalization-frame hypothesis. + +## E58 widened146M at8000 +- Checkpoint SHA-256: `822fdf9f16fb741ab5e23728ad13cac2838a70ad4cfa23a191c9373294a6b4d5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.286028146743774 seconds. +- Overall skill 0.374330; relative MASE 0.747410; relative WQL 0.523759. +- term skill: long=0.3993, medium=0.4074, short=0.3512. +- domain skill: Econ/Fin=0.1416, Energy=0.2364, Healthcare=0.4073, Nature=0.4301, Sales=0.3397, Transport=0.4652, Web/CloudOps=0.4995. +- frequency skill: A=0.3799, D=0.3459, H=0.3958, M=0.0911, Q=0.2002, S=0.4225, T=0.4364, W=0.2039. +- variates skill: multivariate=0.3933, univariate=0.3588. +- Outcome: Main skill0.374330 versus matched37M0.374665, reversing the small4000-step advantage. Both remain below initialization. Continue the prespecified32000-step capacity comparison; no capacity conclusion or package change yet. + +## E64 exact full-package validation after operator recovery +- Checkpoint SHA-256: `35306ec57b81c42e8fbdfab14adc96293400eee0dbd808fadbb3c973f9ff427e`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372871; relative MASE 0.747913; relative WQL 0.525850. +- term skill: long=0.3938, medium=0.4063, short=0.3513. +- domain skill: Econ/Fin=0.1184, Energy=0.2299, Healthcare=0.4400, Nature=0.4295, Sales=0.3508, Transport=0.4663, Web/CloudOps=0.4954. +- frequency skill: A=0.2911, D=0.3562, H=0.3909, M=0.1203, Q=0.1862, S=0.4230, T=0.4309, W=0.2097. +- variates skill: multivariate=0.3912, univariate=0.3579. +- Outcome: Full skill0.372871 beats E59 but trails E62 single0.373420. Both pass relocation/determinism. Select E62 single, retaining E64 as a replayable alternative. E64 full inference79.236 seconds on an otherwise idle H100; do not compare that timing directly with concurrent-training measurements. + +## Operator interruption and recovery, 2026-10-22 +All previous container processes were confirmed ended; the H100 was idle. No credentials were inspected. Completed reports and atomic checkpoints were retained. E64 full validation was rerun because no completed report survived. Both E62 and E64 passed asset hashes and independent relocation: [ + { + "package": "/run-state/workspace/research/candidate-horizon-delta12k", + "checkpoint_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "configurations": 3, + "bitwise_equal_after_relocation": true, + "finite_and_monotone": true, + "seconds": 6.016964558046311 + }, + { + "package": "/run-state/workspace/research/candidate-horizon-ensemble", + "checkpoint_sha256": "35306ec57b81c42e8fbdfab14adc96293400eee0dbd808fadbb3c973f9ff427e", + "configurations": 3, + "bitwise_equal_after_relocation": true, + "finite_and_monotone": true, + "seconds": 6.803807514021173 + } +] + + +Publication decision: E62 single has the highest exact full-validation skill among replayed candidates (0.373419858), improves all three screening cutoffs versus E55, and wins the main screen and first earlier cutoff against E64. E64 retains a second-earlier-cutoff advantage but is lower on full validation. Publish E62 with complete runtime, all own-checkpoint lineage, generator code, pinned requirements, this experiment log and the full report. Scores remain on the validation scale, not the held-out reward scale. + +## E66 matched recovery of interrupted research runs +The operator interruption ended all trainers. E58 146M had step/EMA8000, while its37M control also had12000; neither had Adam or sampler state. Both arms restart from their own step8000 and EMA8000, preserving a common comparison point. Fresh AdamW and a shared new sampler seed179 begin at global step8001, with400-step rewarmup and the original cosine schedule through32000. This is a documented matched continuation, not an exact resumption of the old optimizer trajectory. Existing control12000 is retained but is not the recovered comparison control. +- E63 expanded146M had only initialization saved, so it restarts from its own initial checkpoint with original seed113. It will receive the identical optimizer/stream reset at global8000 to match E58 recovery. E61 slow-memory and E65 recent normalization had no completed checkpoints, so they restart from their declared parent, original seeds and settings. No baseline or completed scientific comparison is retrained. +- New driver saves weights, EMA, optimizer, CPU/CUDA RNG, sampler and batch RNG states, and the prefetched next batch atomically every1000 steps. Independent interrupted/continuous fixture: {"seed": 191, "steps": 4, "batch": 2, "fixture_parameters": 164384, "purpose": "recovery fixture only; never selected", "maximum_model_difference": 1.2101430968414206e-14, "maximum_ema_difference": 2.4147350785597155e-15, "maximum_optimizer_difference": 7.095019016745141e-16, "rng_and_prefetched_batch_bitwise_equal": true, "note": "Complete state restored; GPU training replay differs by floating-point roundoff, so training replay is not claimed bitwise identical. Package inference checks are separately bitwise."}. Four optimizer updates per fixture path used only permitted data; fixture weights are never candidates. +- Work lost after the last usable checkpoints: E58 large at least800 steps, control at least1550 beyond its latest12000 (the matched restart also intentionally returns to8000); E63 at least1700; E61 at least2150; E65 at least300. Last logged elapsed times before interruption:2432.6,2101.5,388.0,542.2,71.8 seconds respectively. These are concurrent process times, not summed exclusive GPU time. + +## E67 end-to-end paired-sign training on the selected horizon-corrected model +Hypothesis: E50 updated only the output head and did not sustain a paired-loss gain. The full encoder/decoder may be able to learn complementary sign-orientation forecasts when optimized through the exact neural average used in inference. Compare two full-model continuations from own E62: both forward x and -x, but the control scores each orientation separately while the candidate scores their ordered-quantile average. This changes the loss, not the sampled windows, number of forward passes, architecture or inference. +- Both arms retain E52 random requested-horizon prefixes and E42 partial-target future-key masking, now integrated with the selected confidence features. At inference the requested horizon is fully available and the forward pass must remain bitwise identical at initialization to E62. +- Own parent horizon_delta12k.pt (SHA-25622c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c); seed197, independent horizon seed300200, packed_sample95 allowed sources and the same local generator, B64 distinct windows /128 signed rows, LR0.00002,12000 steps, all parameters train. Same warmup400 and cosine schedule. Every runtime member forecasts every instance; no validation data are used for gradients. +- Check initialization identity, paired-loss sign symmetry and the independence of unused future tokens. Measure maximum-shape memory before launch. Compare main and both earlier cutoffs; a main-only gain is insufficient. Complete recovery state includes both sampler RNGs. No outcome yet. + +E67 checks passed: { + "cpu_seconds": 3.4358641319558956, + "initial_forecast_bitwise_parent": true, + "unused_future_tokens_do_not_change_requested_prefix": true, + "paired_loss_sign_symmetric": true, + "matched_sampler_main_and_horizon_rng": true, + "gpu_fixture_seconds": 3.137407455011271, + "allocated_mib": 5783.81689453125, + "reserved_mib": 6266.0, + "optimizer_updates": 0 +}. Current allocated/reserved process footprint fits both additional paired arms within the single80GB H100. Each new arm uses about6.3GiB reserved at maximum shape. + +## E68 fixed upward quantile-level shift +Hypothesis: E62 coverage diagnostics show upper-tail underprediction in several groups, while lower-tail excess inclusive coverage is largely due to ties at exact zero. Test one globally fixed quantile-function shift from level p to p+0.025, linearly interpolating between adjacent predicted deciles and extrapolating the uppermost interval. This is equivalent to75% of q(p)+25% of q(p+0.1), with upper-end linear extrapolation. It shifts the median as well as intervals. No dataset-specific parameters, context optimization, new training or weight fitting. +- Apply after the existing fixed rules. Monotonicity and nonnegative quantiles for nonnegative histories are preserved by upward interpolation/extrapolation. Compare only unchanged and the predeclared+0.025 setting on the main screen and both earlier cutoffs. No coefficient sweep. +- Descriptive coverage files horizon_delta_calibration_bounds.json and calibration_diagnostic.py retain strict/inclusive tie bounds. Parent weights SHA-25622c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c. No outcome yet. + +E68 screen, CPU elapsed2.34 seconds: +- unchanged: skill0.377343216, relative MASE0.744366865, relative WQL0.520847298; group skill {"term": {"short": 0.35695456496017197, "medium": 0.4068421174843613, "long": 0.3992704749750494}, "domain": {"Econ/Fin": 0.1398359119561744, "Energy": 0.23759505750828103, "Healthcare": 0.4512562626750727, "Nature": 0.4321373180939323, "Sales": 0.33393397659338675, "Transport": 0.46608088355848554, "Web/CloudOps": 0.49950488336015364}, "freq": {"A-DEC": 0.37212708500173697, "Q-DEC": 0.19935115627243538, "M": 0.10494660003314427, "W-SUN": 0.09001322152715163, "D": 0.355915177294738, "H": 0.39579077444245214, "15T": 0.214120657226064, "W-FRI": -0.015604695485733178, "10T": 0.6146535484250835, "W-TUE": 0.5792731324380282, "W-THU": 0.21095087378926547, "W-WED": 0.3154347093297968, "5T": 0.5103163560669302, "10S": 0.42256110774455713}}. +- shift_up_0025: skill0.376908525, relative MASE0.742757759, relative WQL0.522704720; group skill {"term": {"short": 0.3566597008609087, "medium": 0.404403536500499, "long": 0.4005186267241073}, "domain": {"Econ/Fin": 0.14287974364263867, "Energy": 0.23414603173384185, "Healthcare": 0.43949354133666974, "Nature": 0.4298630701436009, "Sales": 0.32658918319903174, "Transport": 0.470151191104459, "Web/CloudOps": 0.5032582354135502}, "freq": {"A-DEC": 0.380333567897149, "Q-DEC": 0.20181706747540706, "M": 0.08925268144424381, "W-SUN": 0.07477217948655135, "D": 0.35474663372376547, "H": 0.3940149463382252, "15T": 0.21958831724211048, "W-FRI": -0.0580596428780249, "10T": 0.6129399194069542, "W-TUE": 0.5699015681127257, "W-THU": 0.21136203731846115, "W-WED": 0.3102694893262884, "5T": 0.5147323912192434, "10S": 0.4303777414462714}}. + +E68 backcast, CPU elapsed2.34 seconds: +- unchanged: skill0.336227035, relative MASE0.797257690, relative WQL0.552637565; group skill {"term": {"short": 0.3019534316321959, "medium": 0.35847999416902554, "long": 0.3980452217736976}, "domain": {"Econ/Fin": 0.16321936365108436, "Energy": 0.22989895953120598, "Healthcare": 0.4035339334978575, "Nature": 0.3640809439324144, "Sales": 0.39727796653561065, "Transport": 0.37202575172526886, "Web/CloudOps": 0.4496899590670599}, "freq": {"A-DEC": 0.32642568966436736, "Q-DEC": 0.23316387018660967, "M": 0.18942546327646903, "W-SUN": 0.03722616253430944, "D": 0.3493567465552936, "H": 0.3653486861566616, "15T": 0.22544143675041628, "W-FRI": 0.2612228517292393, "10T": 0.32002639781339237, "W-TUE": 0.5369423215086733, "W-THU": 0.24695593621438172, "W-WED": 0.34366857690318564, "5T": 0.43841920169431536, "10S": 0.34189056734107803}}. +- shift_up_0025: skill0.333181127, relative MASE0.800191338, relative WQL0.555676359; group skill {"term": {"short": 0.30012284957976143, "medium": 0.3563718754867885, "long": 0.3913827408796766}, "domain": {"Econ/Fin": 0.16216091726465265, "Energy": 0.22830088335034404, "Healthcare": 0.4226177811841181, "Nature": 0.3541417493195709, "Sales": 0.38842247511482564, "Transport": 0.3660239875770892, "Web/CloudOps": 0.4469561601104274}, "freq": {"A-DEC": 0.3265608246880194, "Q-DEC": 0.22474554051269913, "M": 0.18267190809841738, "W-SUN": 0.03302751086137623, "D": 0.35103471245845674, "H": 0.36176195029219793, "15T": 0.21821690985575604, "W-FRI": 0.25908813449545354, "10T": 0.3119130318041733, "W-TUE": 0.5410511096762922, "W-THU": 0.24171213296902283, "W-WED": 0.34305917574568634, "5T": 0.43719448871859334, "10S": 0.33922568556395327}}. + +E68 backcast2, CPU elapsed2.31 seconds: +- unchanged: skill0.357693384, relative MASE0.772231694, relative WQL0.534240944; group skill {"term": {"short": 0.34387576099815587, "medium": 0.38579809375160923, "long": 0.36474587566145333}, "domain": {"Econ/Fin": 0.10948663145426041, "Energy": 0.23595983020029976, "Healthcare": 0.3456833197210143, "Nature": 0.4672524394882832, "Sales": 0.5493882044206345, "Transport": 0.4200285125423293, "Web/CloudOps": 0.4311910731987415}, "freq": {"A-DEC": 0.3532937085689807, "Q-DEC": 0.15079546315571057, "M": 0.15334987951579737, "W-SUN": 0.053222430353438654, "D": 0.42461678912892176, "H": 0.39045164404809307, "15T": 0.1063009642103484, "W-FRI": 0.14702837959358672, "10T": 0.4925745835795794, "W-TUE": 0.10051793538767262, "W-THU": 0.31968494040001116, "W-WED": 0.5361596335033245, "5T": 0.4655530740312157, "10S": 0.280869499353007}}. +- shift_up_0025: skill0.352929872, relative MASE0.775985000, relative WQL0.539571964; group skill {"term": {"short": 0.3397486152051552, "medium": 0.38072074318949967, "long": 0.3585956199908913}, "domain": {"Econ/Fin": 0.10581887733310036, "Energy": 0.23338234809030112, "Healthcare": 0.3418028155977272, "Nature": 0.4611553878945821, "Sales": 0.543948848409417, "Transport": 0.4138948091247504, "Web/CloudOps": 0.42581951888726777}, "freq": {"A-DEC": 0.3525707634011239, "Q-DEC": 0.14006676676474916, "M": 0.14537682622646142, "W-SUN": 0.05718515322639861, "D": 0.42470757896302946, "H": 0.38580382383546696, "15T": 0.0967294266428953, "W-FRI": 0.16016050379952163, "10T": 0.4943536981461871, "W-TUE": 0.05512451342569891, "W-THU": 0.29480125149705005, "W-WED": 0.5302395339818361, "5T": 0.4614399225720033, "10S": 0.2693556274034984}}. + +E68 rejected: the fixed upward quantile shift loses on all three windows, including -0.00305 and -0.00476 at the earlier cutoffs. Main median MASE improves slightly but WQL worsens. Descriptive coverage imbalance does not justify a global quantile shift. Retain E62 quantiles unchanged; no further coefficient sweep. + +## E69 persistent stochastic volatility in synthetic training windows — prepared, not launched +Hypothesis: the local generator changes seasonal amplitude in E31 but its observation-noise scale stays constant throughout a window. Teach conditional uncertainty under persistent volatility by multiplying the Gaussian/AR noise component by an independent positive log-OU curve in half of synthetic windows. Leave signal, AR coefficient, observation-noise draws, real windows and the main RNG unchanged. +- Proposed matched reference: completed E42 partial-target training. Same own recency12000 parent, seed79, packed_sample, B256, LR0.00005,12000 steps and original schedule. Only the noise envelope differs; no architecture or inference change. +- Independent generator seed500082; log time constant uniform1.5..3.5 (about32..3162 steps), log standard deviation uniform0.1..0.8, stationary Gaussian initial log state, exp(logcurve-0.5*sd^2), log envelope clipped[-2.5,2.5]. Synthetic fraction remains0.2, so roughly10% of all windows receive the new envelope. +- Verify real-window and main-RNG equality before launch. Queue only when a GPU allocation is released; no training has started. Final selection requires main and both earlier-cutoff evidence. + +E69 preparation checks: {"cpu_seconds": 4.379837638000026, "main_rng_matched": true, "real_windows_unchanged": true, "periods_and_missing_masks_unchanged": true, "changed_synthetic_context_values": 52057, "optimizer_updates": 0} + +## E67 full_paired_control at1000 +- Checkpoint SHA-256: `0aa7ece151109e13af73e7ca2d6b75baa95e67898a6273a081ed38e92cfc63cd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.88213801383972 seconds. +- Overall skill 0.376434; relative MASE 0.745243; relative WQL 0.521755. +- term skill: long=0.3984, medium=0.4065, short=0.3558. +- domain skill: Econ/Fin=0.1332, Energy=0.2361, Healthcare=0.4573, Nature=0.4305, Sales=0.3351, Transport=0.4660, Web/CloudOps=0.4983. +- frequency skill: A=0.3675, D=0.3539, H=0.3948, M=0.1051, Q=0.1982, S=0.4219, T=0.4350, W=0.2252. +- variates skill: multivariate=0.3925, univariate=0.3634. +- Outcome: Paired objective leads the matched individual-orientation control by0.000426, but both trail the frozen E62 parent0.377343. Continue to3000 before interpreting the early optimization drop. + +## E67 full_paired_candidate at1000 +- Checkpoint SHA-256: `256329643ba1d7074386d227f4dafd6bdbf0faca5bf2280a60be51ddf2ad90ee`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.336730480194092 seconds. +- Overall skill 0.376860; relative MASE 0.744723; relative WQL 0.521407. +- term skill: long=0.3991, medium=0.4063, short=0.3564. +- domain skill: Econ/Fin=0.1316, Energy=0.2364, Healthcare=0.4620, Nature=0.4301, Sales=0.3350, Transport=0.4669, Web/CloudOps=0.4985. +- frequency skill: A=0.3655, D=0.3560, H=0.3951, M=0.1058, Q=0.1980, S=0.4230, T=0.4348, W=0.2256. +- variates skill: multivariate=0.3926, univariate=0.3640. +- Outcome: Paired objective leads the matched individual-orientation control by0.000426, but both trail the frozen E62 parent0.377343. Continue to3000 before interpreting the early optimization drop. + +Additional historical diagnostic: valid_backcast3 contains93 configurations and8812 instances, derived only from existing validation histories. This cutoff was not used in earlier selection. Compare E62 and its E55 predecessor, plus the fixed amplitude ensemble option; all outputs are selection/diagnostics only. Scales use capped prefixes and its own Seasonal Naive baseline. + +## Previously unused third earlier cutoff: horizon_delta12k +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.37537980079651 seconds. +- Overall skill 0.387789; relative MASE 0.738165; relative WQL 0.507749. +- term skill: long=0.3944, medium=0.3602, short=0.3954. +- domain skill: Econ/Fin=0.1725, Energy=0.3191, Healthcare=0.2442, Nature=0.5053, Sales=0.3990, Transport=0.5060, Web/CloudOps=0.3880. +- frequency skill: A=0.3565, D=0.4418, H=0.4032, M=0.1118, Q=0.2628, S=0.2833, T=0.4297, W=0.2606. +- variates skill: multivariate=0.3722, univariate=0.3998. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +## Previously unused third earlier cutoff: partial_delta12k +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.088595867156982 seconds. +- Overall skill 0.387664; relative MASE 0.738315; relative WQL 0.507852. +- term skill: long=0.3943, medium=0.3601, short=0.3953. +- domain skill: Econ/Fin=0.1728, Energy=0.3188, Healthcare=0.2482, Nature=0.5065, Sales=0.3984, Transport=0.5041, Web/CloudOps=0.3876. +- frequency skill: A=0.3519, D=0.4408, H=0.4034, M=0.1157, Q=0.2629, S=0.2853, T=0.4287, W=0.2628. +- variates skill: multivariate=0.3721, univariate=0.3997. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +## Previously unused third earlier cutoff: amplitude_fixed_ema24000 +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 24.98914361000061 seconds. +- Overall skill 0.386555; relative MASE 0.740761; relative WQL 0.508011. +- term skill: long=0.3906, medium=0.3617, short=0.3941. +- domain skill: Econ/Fin=0.1763, Energy=0.3186, Healthcare=0.2144, Nature=0.5055, Sales=0.3950, Transport=0.5054, Web/CloudOps=0.3892. +- frequency skill: A=0.3670, D=0.4397, H=0.4032, M=0.1018, Q=0.2609, S=0.2818, T=0.4298, W=0.2517. +- variates skill: multivariate=0.3715, univariate=0.3982. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +Third earlier cutoff, fixed horizon+amplitude ensemble: skill0.387712467, relative MASE0.738747107, relative WQL0.507475454; CPU1.61 seconds; group skill {"term": {"short": 0.3954701763614715, "medium": 0.36122355126648487, "long": 0.39279890497296066}, "domain": {"Econ/Fin": 0.1751736307959596, "Energy": 0.31921698125326037, "Healthcare": 0.23298033105692906, "Nature": 0.5060089627880903, "Sales": 0.3975145877969797, "Transport": 0.5058849307923443, "Web/CloudOps": 0.3889682376441502}, "freq": {"A-DEC": 0.3624040337196054, "Q-DEC": 0.2624518143609271, "M": 0.10707417310085743, "W-SUN": 0.1583361093273692, "D": 0.4418985852875217, "H": 0.403440739007801, "15T": 0.2601635557329961, "W-FRI": 0.014090974305712378, "10T": 0.6023775368816131, "W-TUE": 0.24266767576389037, "W-THU": 0.3814500446358562, "W-WED": 0.36993536616236844, "5T": 0.4629495965892555, "10S": 0.28289459770032044}}. + +Third earlier cutoff, fixed partial+amplitude ensemble: skill0.387583102, relative MASE0.738907219, relative WQL0.507579906; CPU1.63 seconds; group skill {"term": {"short": 0.39530402146176624, "medium": 0.36114921433277336, "long": 0.39271964935249504}, "domain": {"Econ/Fin": 0.17527256907786126, "Energy": 0.31900374729462777, "Healthcare": 0.23531552352603602, "Nature": 0.5063494545833882, "Sales": 0.3972024195554572, "Transport": 0.5049447049689553, "Web/CloudOps": 0.3887045854899489}, "freq": {"A-DEC": 0.36012619804016577, "Q-DEC": 0.2622822707122595, "M": 0.10906468169471106, "W-SUN": 0.15682778156902044, "D": 0.44126848409451547, "H": 0.4035052878161369, "15T": 0.26032721770481526, "W-FRI": 0.011894162492874005, "10T": 0.6016201297891219, "W-TUE": 0.2491326450741952, "W-THU": 0.38350286292612645, "W-WED": 0.3695417432322957, "5T": 0.4619676858363392, "10S": 0.2838781358710065}}. + +The new historical check does not overturn the publication: E62 beats E55 individually at this fourth available window, while the fixed ensemble comparison remains a documented alternative. Full validation and main screening still favor the published single model. + +## E70 training-only compiler throughput diagnostic +Hypothesis: operator/kernel overhead limits the many small transformer operations on one H100. Benchmark torch.compile on the existing own E62 model and unpaired training loss, using64 permitted pretraining windows of context2048/horizon512, seed223. No optimizer updates; no validation examples; no compiler change to the published runtime. Compare eager and compiled loss, gradient direction and absolute differences, then alternate20-step forward/backward timing blocks three times under the existing shared-GPU load. Compilation uses two CPU workers. Any numerical or performance difference is recorded before considering a separate training experiment. No outcome yet. + +## E58/E66 recovered37M control at global12000 +- Checkpoint SHA-256: `5341c5600f5fd3f82a33a9a756ce30ee980973e90c0163455ea2ce545601b051`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.337642669677734 seconds. +- Overall skill 0.374083; relative MASE 0.747749; relative WQL 0.523935. +- term skill: long=0.3989, medium=0.4070, short=0.3511. +- domain skill: Econ/Fin=0.1395, Energy=0.2360, Healthcare=0.4006, Nature=0.4331, Sales=0.3401, Transport=0.4656, Web/CloudOps=0.4984. +- frequency skill: A=0.3744, D=0.3455, H=0.3952, M=0.0891, Q=0.1999, S=0.4216, T=0.4369, W=0.2041. +- variates skill: multivariate=0.3932, univariate=0.3585. +- Outcome: Skill0.374083, below its own8000 EMA0.374665 and initial parent0.375793. First4000 updates after the documented optimizer reset; await the matched146M result. Training losses over shared steps9550..10500 are nearly equal: large0.345200, control0.345264. + +## E67 full_paired_control at3000 +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.129313945770264 seconds. +- Overall skill 0.378018; relative MASE 0.743740; relative WQL 0.520156. +- term skill: long=0.4008, medium=0.4068, short=0.3576. +- domain skill: Econ/Fin=0.1354, Energy=0.2381, Healthcare=0.4531, Nature=0.4314, Sales=0.3329, Transport=0.4660, Web/CloudOps=0.5026. +- frequency skill: A=0.3720, D=0.3538, H=0.3970, M=0.1035, Q=0.1971, S=0.4224, T=0.4379, W=0.2235. +- variates skill: multivariate=0.3959, univariate=0.3634. +- Outcome: Both exceed the E62 main screen0.377343. Paired0.378318 leads control0.378018; check both earlier cutoffs before selection. Training continues toward6000. + +## E67 full_paired_candidate at3000 +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.954200506210327 seconds. +- Overall skill 0.378318; relative MASE 0.743356; relative WQL 0.519924. +- term skill: long=0.4020, medium=0.4066, short=0.3577. +- domain skill: Econ/Fin=0.1339, Energy=0.2391, Healthcare=0.4511, Nature=0.4303, Sales=0.3325, Transport=0.4661, Web/CloudOps=0.5042. +- frequency skill: A=0.3674, D=0.3531, H=0.3978, M=0.1030, Q=0.1972, S=0.4232, T=0.4383, W=0.2236. +- variates skill: multivariate=0.3969, univariate=0.3631. +- Outcome: Both exceed the E62 main screen0.377343. Paired0.378318 leads control0.378018; check both earlier cutoffs before selection. Training continues toward6000. + +## E67 full_paired_control_ema3000 evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.129313945770264 seconds. +- Overall skill 0.378018; relative MASE 0.743740; relative WQL 0.520156. +- term skill: long=0.4008, medium=0.4068, short=0.3576. +- domain skill: Econ/Fin=0.1354, Energy=0.2381, Healthcare=0.4531, Nature=0.4314, Sales=0.3329, Transport=0.4660, Web/CloudOps=0.5026. +- frequency skill: A=0.3720, D=0.3538, H=0.3970, M=0.1035, Q=0.1971, S=0.4224, T=0.4379, W=0.2235. +- variates skill: multivariate=0.3959, univariate=0.3634. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_control_ema3000 backcast_evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.22196912765503 seconds. +- Overall skill 0.336172; relative MASE 0.797227; relative WQL 0.552750. +- term skill: long=0.3984, medium=0.3579, short=0.3019. +- domain skill: Econ/Fin=0.1591, Energy=0.2292, Healthcare=0.4105, Nature=0.3647, Sales=0.3944, Transport=0.3718, Web/CloudOps=0.4497. +- frequency skill: A=0.3173, D=0.3530, H=0.3656, M=0.1894, Q=0.2304, S=0.3411, T=0.3359, W=0.2800. +- variates skill: multivariate=0.3535, univariate=0.3220. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_control_ema3000 backcast2_evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.114278316497803 seconds. +- Overall skill 0.357963; relative MASE 0.772252; relative WQL 0.533779. +- term skill: long=0.3643, medium=0.3867, short=0.3442. +- domain skill: Econ/Fin=0.1073, Energy=0.2363, Healthcare=0.3529, Nature=0.4659, Sales=0.5494, Transport=0.4196, Web/CloudOps=0.4322. +- frequency skill: A=0.3515, D=0.4255, H=0.3911, M=0.1494, Q=0.1504, S=0.2817, T=0.3589, W=0.2528. +- variates skill: multivariate=0.3643, univariate=0.3528. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.954200506210327 seconds. +- Overall skill 0.378318; relative MASE 0.743356; relative WQL 0.519924. +- term skill: long=0.4020, medium=0.4066, short=0.3577. +- domain skill: Econ/Fin=0.1339, Energy=0.2391, Healthcare=0.4511, Nature=0.4303, Sales=0.3325, Transport=0.4661, Web/CloudOps=0.5042. +- frequency skill: A=0.3674, D=0.3531, H=0.3978, M=0.1030, Q=0.1972, S=0.4232, T=0.4383, W=0.2236. +- variates skill: multivariate=0.3969, univariate=0.3631. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 backcast_evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.824409246444702 seconds. +- Overall skill 0.335739; relative MASE 0.797824; relative WQL 0.553058. +- term skill: long=0.3982, medium=0.3579, short=0.3012. +- domain skill: Econ/Fin=0.1554, Energy=0.2283, Healthcare=0.4138, Nature=0.3640, Sales=0.3938, Transport=0.3730, Web/CloudOps=0.4488. +- frequency skill: A=0.3126, D=0.3515, H=0.3664, M=0.1838, Q=0.2305, S=0.3411, T=0.3345, W=0.2832. +- variates skill: multivariate=0.3522, univariate=0.3223. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 backcast2_evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.085822582244873 seconds. +- Overall skill 0.358235; relative MASE 0.771602; relative WQL 0.533775. +- term skill: long=0.3637, medium=0.3876, short=0.3445. +- domain skill: Econ/Fin=0.1066, Energy=0.2361, Healthcare=0.3468, Nature=0.4694, Sales=0.5483, Transport=0.4212, Web/CloudOps=0.4313. +- frequency skill: A=0.3537, D=0.4237, H=0.3911, M=0.1509, Q=0.1498, S=0.2809, T=0.3593, W=0.2593. +- variates skill: multivariate=0.3635, univariate=0.3540. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## long_memory_synth_recovery_ema3000 +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.661465406417847 seconds. +- Overall skill 0.360588; relative MASE 0.761649; relative WQL 0.536793. +- term skill: long=0.3910, medium=0.4017, short=0.3318. +- domain skill: Econ/Fin=0.1155, Energy=0.1829, Healthcare=0.4341, Nature=0.4242, Sales=0.3463, Transport=0.4592, Web/CloudOps=0.5066. +- frequency skill: A=0.3750, D=0.3500, H=0.3816, M=0.1111, Q=0.2000, S=0.4415, T=0.4013, W=0.2067. +- variates skill: multivariate=0.3919, univariate=0.3345. +- Outcome: E61 slower synthetic AR dynamics; seed79; improves main screen over matched E42 at3000 steps. Continue and check earlier cutoffs. + +## recent_normalization_recovery_ema3000 +- Checkpoint SHA-256: `a55a5681f52782a142f44595f69d5aef59579fa7f64124c72b9de918189d8ff9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.14950752258301 seconds. +- Overall skill 0.373434; relative MASE 0.747021; relative WQL 0.525533. +- term skill: long=0.3987, medium=0.4024, short=0.3519. +- domain skill: Econ/Fin=0.1428, Energy=0.2320, Healthcare=0.4255, Nature=0.4235, Sales=0.3398, Transport=0.4701, Web/CloudOps=0.4974. +- frequency skill: A=0.3847, D=0.3515, H=0.3961, M=0.0795, Q=0.2007, S=0.4234, T=0.4320, W=0.2036. +- variates skill: multivariate=0.3889, univariate=0.3609. +- Outcome: E65 recent4096 normalization with8192 context; seed101; improves matched E54 3000-step long-context result .372681. Continue. + +### E70 compiler cache infrastructure diagnostic +Both the default and /tmp Triton caches reject child-directory-to-parent os.replace with EXDEV. Same-parent replacement succeeds. A local SiblingFileCacheManager preserves Triton keys and group formats while writing unique same-parent temporary files. Byte, text, overwrite and group fixtures passed (initial fixture used an invalid nonhex key; corrected before accepting the fixture). No installed library files, model parameters, optimizer state or inference runtime were changed. Retrying the identical training-only compile benchmark; no optimizer updates. + +### E70 fixed-shape compiler benchmark outcome +Seed223, B64, C2048, H512, own E62 checkpoint 22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c; no optimizer updates and only allowed training windows. Compilation 51.065s; total benchmark 80.009s. Alternating three blocks: eager mean0.119890s versus compiled mean0.064745s, speedup1.852. Loss0.228576794 vs0.228607744; gradient cosine0.998925465, maximum absolute gradient difference0.000610351562. bf16 arithmetic differs slightly; this is not bitwise training equivalence. Other experiments shared the H100. Variable-shape compatibility is being checked before use in training; published inference is unchanged. + +## E71 finer eight-point patches — prepared, not launched +Hypothesis: E17 benefited from32→16-point patches, and the current model still has short-horizon energy errors. Test16→8-point patches while preserving physical position units and all attention/MLP/confidence parameters. Fold the two halves of context, query and recency input projections by summation and keep the first8 output rows, as in the earlier resolution experiment. This is an own-weight initialization, not an exact function-preserving conversion. Initialize from E62, use seed197/B64/LR2e-5/12000 steps with paired sign loss, and compare to the already-running E67 paired16-point arm. Keep the identical sampler and its16-point random-prefix rounding; only model patch resolution changes. CPU fixtures and initial evaluation precede training. No additional data or synthetic generator. Waiting for training memory to become available. + +E70 variable-shape follow-up: torch.compile(dynamic=True, fullgraph=True) failed in the installed PyTorch tensorification pass: TensorReferenceAnalysis lacks python_mod. No optimizer updates occurred. Test static shape specialization with a64-graph cache limit instead, preserving the existing16 context/horizon combinations. Dynamic failure log: compiler_variable_shapes.log. + +## E72 convex mixtures of training windows — prepared, not launched +Hypothesis: interpolating real dynamics can expand effective corpus diversity and regularize the forecast mapping beyond drawing additional series. On25% of sampled rows, choose a different row with the same two periods, normalize the donor using context-only mean/std into the primary context units, then combine context and future separately with a Beta(2,2) coefficient. Missing positions use mask intersection; require8 common observed context points and1 common future label. Both real and existing locally synthetic rows are eligible. Independent seed600200 preserves the main corpus/generator stream and requested-horizon stream. Planned own E62 initialization, seed197, paired loss, B64, LR2e-5,12000 steps, identical E67 paired control settings. No inference changes. Fixtures: {"cpu_seconds": 2.7141120220185257, "seed": 197, "mixture_seed": 600200, "rows": 192, "changed_context_rows": 43, "main_and_horizon_rng_matched": true, "changing_labels_does_not_change_contexts": true, "finite_masks_respected": true, "optimizer_updates": 0}. Await training allocation. + +### E58 symmetry diagnostic +Seed239, four allowed training windows, no optimizer updates, CPU5.262225491984282s. At global12000, duplicate-stream encoder5 activations differ by only0.001181 relative RMS, versus0.001124 at initialization. Sampled duplicate-row matrix cosines remain0.99987–0.99997. The nearly redundant streams weaken the interpretation that this experiment tested useful extra capacity. Full measurements: wide_capacity_symmetry_diagnostic.json. No current weights changed. + +## E73 independently initialized extra feature stream — prepared, not launched +Hypothesis: widening by near-identical copies keeps the extra neurons redundant. Build a146,477,344-parameter model with the original512 features and a separate randomly initialized512-feature stream. Inherited linear maps occupy their original blocks; new internal maps are independently random; cross-stream maps and new output-head columns start at zero. Layer normalization operates on each512-feature group separately so the parent function survives initialization. All maps, including cross-stream connections, will train. This changes initialization and normalization grouping relative to E58. Conversion seed241; own E47 parent. Same training seed113, B96, LR3e-5,32000-step schedule and optimizer/sampler reset at8000 with seed179 as the completed/recovered small control. Use unit LR multipliers because original columns are no longer duplicated or divided. No new data or generator. Conversion fixture: {"method": "independent random feature stream with block-diagonal inherited projections, zero cross-stream projections and zero new output columns; separate512-feature layer normalization", "parent_sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", "random_initialization_seed": 241, "fixture_max_abs_difference": 1.6689300537109375e-06, "new_stream_activation": {"relative_rms_difference": 1.4169212579727173}, "learning_rate_multipliers": "one for every parameter", "checkpoint_sha256": "d164d8b12223032b23948d0dcb17389d10f8e739a30a1ade5f677d2a948e965b", "parameters": 146477344, "cpu_seconds": 2.802320774004329, "optimizer_updates": 0}. Initial screen and gradient checks precede training. + +### E70 static shape specialization outcome +All four tested context/horizon shapes compiled and produced finite gradients; returning to2048/512 reused graph1, with four unique graphs total. Loss differences remained below0.00007. First calls took47.33,38.52,51.27,46.47 seconds; steady forward/backward speedups ranged1.60–1.94 under shared load. Complete result compiler_static_shapes_result.json, elapsed208.31172983598663s. Static specialization is usable, but16 training shapes incur compilation cost and bf16 arithmetic changes; existing active training runs remain eager. + +## E58/E66 recovered146M at global12000 +- Checkpoint SHA-256: `3d39cb54e80093bf97c2d95eda6bd30fefa65ec47b33ba70838dc881321e31ea`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.74531269073486 seconds. +- Overall skill 0.373963; relative MASE 0.747878; relative WQL 0.524045. +- term skill: long=0.3982, medium=0.4082, short=0.3507. +- domain skill: Econ/Fin=0.1409, Energy=0.2357, Healthcare=0.3980, Nature=0.4325, Sales=0.3406, Transport=0.4658, Web/CloudOps=0.4987. +- frequency skill: A=0.3756, D=0.3419, H=0.3949, M=0.0902, Q=0.1997, S=0.4220, T=0.4377, W=0.2068. +- variates skill: multivariate=0.3930, univariate=0.3584. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E63 expanded corpus at146M first4000 +- Checkpoint SHA-256: `c89939a906b619e3d119a26d2edf1b567ff902930ca78b3e58cdce5903ed3077`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.43943977355957 seconds. +- Overall skill 0.373186; relative MASE 0.749492; relative WQL 0.524216. +- term skill: long=0.3994, medium=0.4061, short=0.3496. +- domain skill: Econ/Fin=0.1406, Energy=0.2371, Healthcare=0.4020, Nature=0.4224, Sales=0.3395, Transport=0.4650, Web/CloudOps=0.5007. +- frequency skill: A=0.3699, D=0.3383, H=0.3939, M=0.1020, Q=0.2066, S=0.4209, T=0.4379, W=0.2018. +- variates skill: multivariate=0.3928, univariate=0.3571. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E61 slow AR3000 first earlier cutoff +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.004189491271973 seconds. +- Overall skill 0.329626; relative MASE 0.805342; relative WQL 0.558025. +- term skill: long=0.3886, medium=0.3565, short=0.2947. +- domain skill: Econ/Fin=0.1530, Energy=0.2229, Healthcare=0.4151, Nature=0.3515, Sales=0.3980, Transport=0.3624, Web/CloudOps=0.4448. +- frequency skill: A=0.3216, D=0.3548, H=0.3555, M=0.1730, Q=0.2272, S=0.3450, T=0.3293, W=0.2673. +- variates skill: multivariate=0.3459, univariate=0.3164. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E61 slow AR3000 second earlier cutoff +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.961536407470703 seconds. +- Overall skill 0.353271; relative MASE 0.774762; relative WQL 0.539854. +- term skill: long=0.3691, medium=0.3752, short=0.3388. +- domain skill: Econ/Fin=0.0921, Energy=0.2250, Healthcare=0.3726, Nature=0.4619, Sales=0.5589, Transport=0.4127, Web/CloudOps=0.4305. +- frequency skill: A=0.3401, D=0.4317, H=0.3862, M=0.1746, Q=0.1512, S=0.2822, T=0.3452, W=0.2437. +- variates skill: multivariate=0.3595, univariate=0.3482. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E67 paired3000 third earlier cutoff +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 26.884973287582397 seconds. +- Overall skill 0.389069; relative MASE 0.736752; relative WQL 0.506597. +- term skill: long=0.3965, medium=0.3605, short=0.3968. +- domain skill: Econ/Fin=0.1707, Energy=0.3208, Healthcare=0.2592, Nature=0.5054, Sales=0.3991, Transport=0.5053, Web/CloudOps=0.3895. +- frequency skill: A=0.3624, D=0.4436, H=0.4039, M=0.1198, Q=0.2578, S=0.2862, T=0.4305, W=0.2611. +- variates skill: multivariate=0.3741, univariate=0.4006. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E67 candidate3000 complete package validation +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374401; relative MASE 0.746075; relative WQL 0.524578. +- term skill: long=0.3961, medium=0.4055, short=0.3534. +- domain skill: Econ/Fin=0.1115, Energy=0.2320, Healthcare=0.4573, Nature=0.4303, Sales=0.3470, Transport=0.4663, Web/CloudOps=0.4964. +- frequency skill: A=0.2888, D=0.3569, H=0.3930, M=0.1278, Q=0.1823, S=0.4232, T=0.4312, W=0.2160. +- variates skill: multivariate=0.3926, univariate=0.3596. +- Outcome: Full public-package validation. Training seed197, B64 distinct windows with both signs, LR2e-5;3000-step checkpoint at687.5s of training-loop elapsed time on the shared single H100. Exact public inference 129.863s. Paired candidate wins full validation and main screen; it improves earlier cutoffs2/3 versus E62, but loses0.000488 on cutoff1. Control full skill0.374180 versus paired0.374401. Select paired3000 with this temporal tradeoff recorded; training continues. + +## E67 control3000 complete package validation +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374180; relative MASE 0.746358; relative WQL 0.524749. +- term skill: long=0.3948, medium=0.4057, short=0.3535. +- domain skill: Econ/Fin=0.1134, Energy=0.2311, Healthcare=0.4600, Nature=0.4313, Sales=0.3473, Transport=0.4663, Web/CloudOps=0.4949. +- frequency skill: A=0.2923, D=0.3579, H=0.3922, M=0.1281, Q=0.1825, S=0.4224, T=0.4308, W=0.2163. +- variates skill: multivariate=0.3915, univariate=0.3600. +- Outcome: Full public-package validation. Training seed197, B64 distinct windows with both signs, LR2e-5;3000-step checkpoint at687.5s of training-loop elapsed time on the shared single H100. Exact public inference 131.546s. Paired candidate wins full validation and main screen; it improves earlier cutoffs2/3 versus E62, but loses0.000488 on cutoff1. Control full skill0.374180 versus paired0.374401. Select paired3000 with this temporal tradeoff recorded; training continues. + +E67 publication decision: paired3000 checkpoint2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238, full0.3744010291; main0.3783180328; earlier cutoffs0.3357387876/0.3582353306/0.3890690875. Relative to published E62, full gain0.000981171, main gain0.000974817, earlier changes-0.000488248/+0.000541947/+0.001280498. All97 full configurations and151170 instances pass with no quantile crossings. Three example configurations are bitwise equal after independent relocation; runtime/weight hashes verified. The published inference remains eager. + +## E74 equal ensemble of E62 and its paired3000 continuation +Hypothesis: fixed forecast averaging can retain the parent's stronger first earlier cutoff while preserving gains from paired-sign training. Test exactly one equal-weight quantile mean after each model's existing fixed rules, without a weight sweep or additional zero projection. Both models would forecast every instance. Reuse cached predictions for screening; no training, new seed or source. Evaluate main and all three earlier cutoffs, then full validation only if promising; an actual packaged replay remains required before publication. Members: E62 hash22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, E67 hash2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238. + +## full_paired_control_ema6000 +- Checkpoint SHA-256: `4517cc18d0d7b022c728a208b53bb0088fcefe249246640d26e688ba800cf84c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.108938932418823 seconds. +- Overall skill 0.377544; relative MASE 0.744699; relative WQL 0.520279. +- term skill: long=0.3999, medium=0.4077, short=0.3567. +- domain skill: Econ/Fin=0.1294, Energy=0.2391, Healthcare=0.4588, Nature=0.4300, Sales=0.3396, Transport=0.4652, Web/CloudOps=0.4999. +- frequency skill: A=0.3728, D=0.3542, H=0.3955, M=0.1113, Q=0.1942, S=0.4228, T=0.4360, W=0.2279. +- variates skill: multivariate=0.3946, univariate=0.3636. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +## full_paired_candidate_ema6000 +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.94004225730896 seconds. +- Overall skill 0.378455; relative MASE 0.743557; relative WQL 0.519554. +- term skill: long=0.4019, medium=0.4071, short=0.3578. +- domain skill: Econ/Fin=0.1262, Energy=0.2397, Healthcare=0.4622, Nature=0.4291, Sales=0.3379, Transport=0.4657, Web/CloudOps=0.5030. +- frequency skill: A=0.3687, D=0.3544, H=0.3962, M=0.1031, Q=0.1932, S=0.4249, T=0.4385, W=0.2281. +- variates skill: multivariate=0.3972, univariate=0.3631. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +## wide_graft_initial +- Checkpoint SHA-256: `d164d8b12223032b23948d0dcb17389d10f8e739a30a1ade5f677d2a948e965b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 44.365342140197754 seconds. +- Overall skill 0.375793; relative MASE 0.745650; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4405, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0953, Q=0.1981, S=0.4239, T=0.4362, W=0.2089. +- variates skill: multivariate=0.3938, univariate=0.3611. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +E74 valid_screen: skill0.37807862274263027, relativeMASE0.7436448167242383, relativeWQL0.5201222287724669, CPU0.8619319740100764s; group skills {"term": {"short": 0.35759494914169054, "medium": 0.40699311016073325, "long": 0.40082709768107416}, "domain": {"Econ/Fin": 0.1373283443599086, "Energy": 0.23867787085456083, "Healthcare": 0.4514094815443358, "Nature": 0.4314394439880541, "Sales": 0.3334613777872122, "Transport": 0.46623492569656166, "Web/CloudOps": 0.5020547204722161}, "freq": {"A-DEC": 0.3700186215632586, "Q-DEC": 0.1986150873665018, "M": 0.10412662722790622, "W-SUN": 0.07901894069086524, "D": 0.35481222927845457, "H": 0.39699199743484126, "15T": 0.21413878856050306, "W-FRI": -0.0023901912492456656, "10T": 0.615926427622083, "W-TUE": 0.5812846025030445, "W-THU": 0.20706119312963223, "W-WED": 0.31744777723871154, "5T": 0.5126119145163621, "10S": 0.4229238092063159}}. + +E74 valid_backcast: skill0.3362925418425802, relativeMASE0.7972981372266922, relativeWQL0.552500463058947, CPU0.8971402349998243s; group skills {"term": {"short": 0.30190782919949666, "medium": 0.35857372233263296, "long": 0.3983345998796374}, "domain": {"Econ/Fin": 0.15970397473963605, "Energy": 0.22932627079926182, "Healthcare": 0.40921062898616656, "Nature": 0.3642338798926953, "Sales": 0.395796512384459, "Transport": 0.3726773780449273, "Web/CloudOps": 0.4497268240013762}, "freq": {"A-DEC": 0.31984516176318767, "Q-DEC": 0.23213469399614717, "M": 0.1867528733976035, "W-SUN": 0.027286458584816375, "D": 0.35084294376677716, "H": 0.36615049422003554, "15T": 0.22473053922570885, "W-FRI": 0.2587886969661052, "10T": 0.3198607928100037, "W-TUE": 0.5430562436146349, "W-THU": 0.24609593870252322, "W-WED": 0.3423884364810911, "5T": 0.4378462658914031, "10S": 0.34158786712809996}}. + +E74 valid_backcast2: skill0.3582180334801286, relativeMASE0.771690389912856, relativeWQL0.5337426744378997, CPU0.6840074959909543s; group skills {"term": {"short": 0.3444537095616398, "medium": 0.3869421164002306, "long": 0.36441392284164364}, "domain": {"Econ/Fin": 0.10841961881158191, "Energy": 0.2363021419988357, "Healthcare": 0.34644304914503876, "Nature": 0.4685938042819019, "Sales": 0.5492137665291525, "Transport": 0.4207857629370483, "Web/CloudOps": 0.4314575495135424}, "freq": {"A-DEC": 0.3538974701075839, "Q-DEC": 0.1504553008739551, "M": 0.15220470977886436, "W-SUN": 0.04613015348540839, "D": 0.42446352745465865, "H": 0.39096253798739566, "15T": 0.10670219795421398, "W-FRI": 0.14873972396574198, "10T": 0.4961638002828159, "W-TUE": 0.08195477095370607, "W-THU": 0.32491052813791066, "W-WED": 0.5372312006064026, "5T": 0.46600691242017644, "10S": 0.28101678592852175}}. + +E74 valid_backcast3: skill0.38866584889169165, relativeMASE0.7372042201081582, relativeWQL0.506955107034635, CPU0.6765452020335943s; group skills {"term": {"short": 0.39634584808261863, "medium": 0.36050403977747736, "long": 0.39564160116149116}, "domain": {"Econ/Fin": 0.17218827750208232, "Energy": 0.32018031275863146, "Healthcare": 0.251739940360198, "Nature": 0.505730039991936, "Sales": 0.3992528233665873, "Transport": 0.5057485203797758, "Web/CloudOps": 0.38900692766706535}, "freq": {"A-DEC": 0.35992280976221613, "Q-DEC": 0.2607290890980446, "M": 0.1158596568834448, "W-SUN": 0.14646809588021303, "D": 0.4430503070010823, "H": 0.40373923909167875, "15T": 0.26167249262649306, "W-FRI": 0.026229112650416053, "10T": 0.6033044583572338, "W-TUE": 0.2614261172432897, "W-THU": 0.3805020665242401, "W-WED": 0.37420834670061953, "5T": 0.4617999415682724, "10S": 0.28494980458180186}}. + +E74 fixed ensemble recovers cutoff1 but is below the paired member on main and cutoffs2/3. Check cached full validation before deciding; no mixture coefficient tuning. + +E73 gradient fixture: {"cpu_seconds": 3.0038612950011156, "seed": 251, "allowed_training_windows": 2, "loss": 0.6392828226089478, "initial_gradients": {"head_new_columns": 1.3039275407791138, "encoder0_new_to_old_attention": 0.16236796975135803, "decoder3_new_to_old_ff": 0.3286978602409363}, "all_gradients_finite": true, "optimizer_updates": 0}. All gradients finite, with nonzero gradient to new output columns and new-to-old attention/feedforward maps at initialization. + +## E67 paired6000 backcast_evals +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.112698793411255 seconds. +- Overall skill 0.335119; relative MASE 0.798971; relative WQL 0.553296. +- term skill: long=0.3996, medium=0.3567, short=0.2999. +- domain skill: Econ/Fin=0.1484, Energy=0.2276, Healthcare=0.4122, Nature=0.3651, Sales=0.3962, Transport=0.3724, Web/CloudOps=0.4480. +- frequency skill: A=0.3127, D=0.3525, H=0.3668, M=0.1712, Q=0.2359, S=0.3414, T=0.3328, W=0.2844. +- variates skill: multivariate=0.3517, univariate=0.3216. +- Outcome: Compared with paired3000, cutoff1 loses0.000620 and cutoff2 gains0.001211. Main gains0.000137. Complete package validation and third earlier cutoff follow; keep paired3000 published meanwhile. + +## E67 paired6000 backcast2_evals +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.65610408782959 seconds. +- Overall skill 0.359446; relative MASE 0.769629; relative WQL 0.533126. +- term skill: long=0.3637, medium=0.3914, short=0.3451. +- domain skill: Econ/Fin=0.0947, Energy=0.2369, Healthcare=0.3640, Nature=0.4722, Sales=0.5483, Transport=0.4203, Web/CloudOps=0.4322. +- frequency skill: A=0.3460, D=0.4239, H=0.3913, M=0.1623, Q=0.1478, S=0.2801, T=0.3609, W=0.2646. +- variates skill: multivariate=0.3635, univariate=0.3561. +- Outcome: Compared with paired3000, cutoff1 loses0.000620 and cutoff2 gains0.001211. Main gains0.000137. Complete package validation and third earlier cutoff follow; keep paired3000 published meanwhile. + +E74 cached full validation: skill0.37416157579966614, relativeMASE0.7463637996830615, relativeWQL0.5247758979895311, CPU1.7625104649923742s; group skills {"term": {"short": 0.35339006443372445, "medium": 0.4058776358425863, "long": 0.39478447597143573}, "domain": {"Econ/Fin": 0.1148260686606345, "Energy": 0.2315840307823489, "Healthcare": 0.45764579718017184, "Nature": 0.4314211475708052, "Sales": 0.3476654519885174, "Transport": 0.46645466438647154, "Web/CloudOps": 0.49435858431787905}, "freq": {"A-DEC": 0.2905258409636121, "Q-DEC": 0.18415390225031736, "M": 0.12808227393650784, "W-SUN": 0.042170378733840996, "D": 0.3587361531705563, "H": 0.39218267210684865, "15T": 0.20355479619501637, "W-FRI": -0.021429381368383904, "10T": 0.615926427622083, "W-TUE": 0.5812846025030445, "W-THU": 0.20706119312963223, "W-WED": 0.31744777723871154, "5T": 0.5037733014006005, "10S": 0.4229238092063159}}. Below paired3000 skill0.374401 by0.000239. Reject: the first earlier-cutoff benefit does not outweigh lower full/main/other-earlier scores. No ensemble package is published and no weight sweep follows. + +E71 initial8-point model main screen0.3622169411 versus E62 parent0.3773432163; conversion intentionally changes function. CPU fixture0.9008s verifies constant-input projection folding, unchanged inherited tensors, finite/ordered forecasts at6/18/720/900 steps. Training recovery must justify this initialization cost. + +E58/E63 resource decision fixed before the next results: at global16000, stop the near-duplicate width trial if it remains below both its E47 parent and the matched small control; preserve a complete recovery checkpoint. At8000, assess expanded-corpus146M against its same-width original-corpus8000. Prioritize the independent-stream E73 initialization when a large training slot is released. Existing runs retain eager arithmetic. + +## E67 paired6000 exact full package +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374279; relative MASE 0.746472; relative WQL 0.524502. +- term skill: long=0.3958, medium=0.4059, short=0.3532. +- domain skill: Econ/Fin=0.1029, Energy=0.2327, Healthcare=0.4651, Nature=0.4291, Sales=0.3514, Transport=0.4660, Web/CloudOps=0.4952. +- frequency skill: A=0.2886, D=0.3570, H=0.3913, M=0.1264, Q=0.1824, S=0.4249, T=0.4314, W=0.2203. +- variates skill: multivariate=0.3928, univariate=0.3591. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +## E67 paired6000 third earlier cutoff +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.89822793006897 seconds. +- Overall skill 0.389533; relative MASE 0.736193; relative WQL 0.506212. +- term skill: long=0.3966, medium=0.3607, short=0.3974. +- domain skill: Econ/Fin=0.1634, Energy=0.3178, Healthcare=0.2808, Nature=0.5081, Sales=0.3977, Transport=0.5055, Web/CloudOps=0.3908. +- frequency skill: A=0.3558, D=0.4451, H=0.4045, M=0.1415, Q=0.2554, S=0.2895, T=0.4276, W=0.2643. +- variates skill: multivariate=0.3722, univariate=0.4028. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +## E65 recent normalization6000 +- Checkpoint SHA-256: `1c5bc9b814879a43941f6e59b6d2024152ec9db43014e2b4431195e52366f1ea`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.534422874450684 seconds. +- Overall skill 0.374709; relative MASE 0.745557; relative WQL 0.524426. +- term skill: long=0.4014, medium=0.4044, short=0.3523. +- domain skill: Econ/Fin=0.1384, Energy=0.2354, Healthcare=0.4238, Nature=0.4264, Sales=0.3389, Transport=0.4711, Web/CloudOps=0.4974. +- frequency skill: A=0.3756, D=0.3531, H=0.3970, M=0.0716, Q=0.2013, S=0.4239, T=0.4343, W=0.2078. +- variates skill: multivariate=0.3915, univariate=0.3610. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +E67 paired6000 full public inference131.433437s on the shared single H100; all97 configurations and151170 instances passed. The original3k publication remains selected by full validation, with the temporal tradeoff documented. + +## E75 training loss after fixed inference transformations — prepared, not launched +Hypothesis: paired training aligns sign averaging but still scores raw neural forecasts, whereas inference changes them with seasonal and continuity priors and exact-zero projection. Compute the same fixed context statistics without model gradients, then apply the transforms differentiably to forecasts before the existing normalized median/quantile loss. Gradients include the continuity correction's dependence on the first forecast; zero/positivity thresholds remain fixed and piecewise differentiable. The target transform and seasonal loss weight stay unchanged. Planned E62 initialization, seed197, paired loss, B64, LR2e-5,12000 steps, identical data stream to E67 paired. No new data/generator and no inference changes. CPU implementation comparison: {"cpu_seconds": 0.11522011604392901, "seed": 263, "fixtures": [{"context": 8, "horizon": 6, "maximum_absolute_difference": 0.0, "finite_gradients": true}, {"context": 64, "horizon": 18, "maximum_absolute_difference": 2.384185791015625e-07, "finite_gradients": true}, {"context": 512, "horizon": 128, "maximum_absolute_difference": 1.1920928955078125e-06, "finite_gradients": true}, {"context": 4096, "horizon": 900, "maximum_absolute_difference": 7.152557373046875e-07, "finite_gradients": true}], "optimizer_updates": 0}. Fixture agreement is numerical, not bitwise, because training computes context statistics in float64. Await a training slot and one allowed-window end-to-end gradient check. + +## E61 slow AR6000 evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.034730434417725 seconds. +- Overall skill 0.361281; relative MASE 0.760333; relative WQL 0.536557. +- term skill: long=0.3915, medium=0.4029, short=0.3324. +- domain skill: Econ/Fin=0.1215, Energy=0.1845, Healthcare=0.4313, Nature=0.4272, Sales=0.3429, Transport=0.4577, Web/CloudOps=0.5068. +- frequency skill: A=0.3788, D=0.3481, H=0.3812, M=0.1116, Q=0.2006, S=0.4421, T=0.4034, W=0.2113. +- variates skill: multivariate=0.3930, univariate=0.3349. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +## E61 slow AR6000 backcast_evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.68802785873413 seconds. +- Overall skill 0.331040; relative MASE 0.803953; relative WQL 0.556635. +- term skill: long=0.3886, medium=0.3569, short=0.2972. +- domain skill: Econ/Fin=0.1588, Energy=0.2277, Healthcare=0.4061, Nature=0.3526, Sales=0.3967, Transport=0.3629, Web/CloudOps=0.4452. +- frequency skill: A=0.3244, D=0.3518, H=0.3577, M=0.1682, Q=0.2306, S=0.3442, T=0.3314, W=0.2762. +- variates skill: multivariate=0.3484, univariate=0.3169. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +## E61 slow AR6000 backcast2_evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.468894004821777 seconds. +- Overall skill 0.354097; relative MASE 0.774005; relative WQL 0.539002. +- term skill: long=0.3704, medium=0.3752, short=0.3398. +- domain skill: Econ/Fin=0.0990, Energy=0.2275, Healthcare=0.3686, Nature=0.4617, Sales=0.5571, Transport=0.4131, Web/CloudOps=0.4308. +- frequency skill: A=0.3441, D=0.4303, H=0.3862, M=0.1683, Q=0.1512, S=0.2846, T=0.3470, W=0.2514. +- variates skill: multivariate=0.3602, univariate=0.3491. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +E73 compiler fixture: {"seed": 271, "batch": 16, "context": 512, "horizon": 128, "eager_loss": 0.2625328004360199, "compiled_loss": 0.26252102851867676, "gradient_cosine": 0.9994836559992685, "maximum_gradient_difference": 0.003173828125, "compile_and_gradient_comparison_seconds": 65.4888255270198, "total_seconds": 66.77216628700262, "optimizer_updates": 0, "source": "allowed packed_sample and own generator"}. Static compilation is numerically close, not bitwise; use it for the32k-step independent-stream trial to amortize the16 shape compilations. This implementation difference from the existing eager small control is explicit. Loss formula, sampler, optimizer and schedule stay fixed. + +E75 allowed-window end-to-end fixture: {"cpu_seconds": 2.641128608956933, "seed": 269, "allowed_training_and_own_synthetic_windows": 8, "loss": 0.2808418869972229, "gradient_norm": 0.18120726943016052, "all_gradients_finite": true, "optimizer_updates": 0}. No optimizer updates. + +E69 is now queued after the slow-AR trainer PID980 exits with ema012000.pt, using its declared eager settings and the same allocation. Queue receipt volatility_synth_queue.json and watcher watch_volatility_synth.log identify the run. No E69 training has started yet. + +E71 maximum-shape GPU fixture: {"seed": 277, "batch": 64, "signed_rows": 128, "context": 4096, "horizon": 1024, "optimizer_updates": 0, "loss": 0.2055814117193222, "seconds": 10.965134899015538, "peak_allocated_mib": 10373.298828125, "peak_reserved_mib": 10992.0}. Passed without optimizer updates. Queue after both E67 trainers finish12000, so its larger working set reuses their combined allocation. + +E75 queued after E65 recent-normalization finishes12000. Both new queues require the predecessor final EMA before starting, and use the declared eager settings. E72 mixup remains prepared only; E73 awaits the prespecified width checkpoint decision. + +## E76 transfer the matched slow-AR6000 correction +E61 improves the main and both earlier cutoffs at6000 versus E42. Hypothesis: this learned synthetic-dynamics correction also helps the selected paired3000 model. Form exactly base(E67 paired3000)+candidate(E61 slowAR6000)-control(E42 partial6000), coefficient1.0 on matching tensors; keep the base confidence projection unchanged. All three checkpoints were trained here on declared sources. No coefficient sweep, new training, data or inference changes. Compare the main and earlier screens before full replay. + +## E76 slow-AR correction evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.135655403137207 seconds. +- Overall skill 0.379721; relative MASE 0.741564; relative WQL 0.518831. +- term skill: long=0.4036, medium=0.4064, short=0.3597. +- domain skill: Econ/Fin=0.1442, Energy=0.2362, Healthcare=0.4597, Nature=0.4330, Sales=0.3350, Transport=0.4655, Web/CloudOps=0.5071. +- frequency skill: A=0.3715, D=0.3604, H=0.3974, M=0.0968, Q=0.1987, S=0.4260, T=0.4397, W=0.2230. +- variates skill: multivariate=0.3981, univariate=0.3647. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +## E76 slow-AR correction backcast_evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.913641452789307 seconds. +- Overall skill 0.336781; relative MASE 0.795517; relative WQL 0.552923. +- term skill: long=0.3965, medium=0.3587, short=0.3036. +- domain skill: Econ/Fin=0.1684, Energy=0.2257, Healthcare=0.4092, Nature=0.3689, Sales=0.3927, Transport=0.3721, Web/CloudOps=0.4520. +- frequency skill: A=0.3199, D=0.3498, H=0.3654, M=0.1876, Q=0.2323, S=0.3437, T=0.3374, W=0.2878. +- variates skill: multivariate=0.3539, univariate=0.3228. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +## E76 slow-AR correction backcast2_evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.258840799331665 seconds. +- Overall skill 0.360577; relative MASE 0.768980; relative WQL 0.531693. +- term skill: long=0.3677, medium=0.3876, short=0.3472. +- domain skill: Econ/Fin=0.1192, Energy=0.2354, Healthcare=0.3433, Nature=0.4736, Sales=0.5465, Transport=0.4203, Web/CloudOps=0.4380. +- frequency skill: A=0.3515, D=0.4289, H=0.3897, M=0.1383, Q=0.1499, S=0.2861, T=0.3643, W=0.2654. +- variates skill: multivariate=0.3674, univariate=0.3550. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +E76 CPU composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/full_paired_candidate/ema003000.pt": "2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238", "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb"}, "seconds": 1.1477709169848822}. + +## E77 slow-AR synthesis during full paired-sign training — prepared, not launched +E61's matched correction transfers favorably to the selected model on three screens. Hypothesis: training the confidence/horizon-aware model directly with the same slow-AR prior can improve on composing an older-backbone correction. Reuse E67's exact E62 initialization, seed197, B64, LR2e-5,12000-step schedule, paired-sign loss and independent horizon RNG300200. Change only synthetic AR phi fromU(.2,.995) toexp(-10**(-U(0,4))), preserving the main RNG calls and zero initial state. This yields time constants log-uniform1..10000 and keeps innovation variance normalized as before. Compare to the already-computed E67 paired control. No inference change, new corpus or validation training. Prioritize after a training allocation is released; E72 mixup remains an unlaunched alternative. + +## E76 slow-AR correction third earlier cutoff +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.890827178955078 seconds. +- Overall skill 0.389281; relative MASE 0.737064; relative WQL 0.506031. +- term skill: long=0.3949, medium=0.3619, short=0.3971. +- domain skill: Econ/Fin=0.1812, Energy=0.3198, Healthcare=0.2311, Nature=0.5053, Sales=0.3996, Transport=0.5073, Web/CloudOps=0.3940. +- frequency skill: A=0.3622, D=0.4457, H=0.4032, M=0.1047, Q=0.2602, S=0.2878, T=0.4313, W=0.2630. +- variates skill: multivariate=0.3743, univariate=0.4008. +- Outcome: Publish E76: full0.375612 improves paired3000 full0.374401; main0.379721 and earlier0.336781/0.360577/0.389281 all improve. All97 configurations and151170 instances pass; zero crossings. Fixed coefficient1.0 composition of own trained checkpoints; no additional training. + +## E76 slow-AR correction full package validation +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.375612; relative MASE 0.744415; relative WQL 0.523713. +- term skill: long=0.3976, medium=0.4054, short=0.3551. +- domain skill: Econ/Fin=0.1204, Energy=0.2291, Healthcare=0.4651, Nature=0.4330, Sales=0.3487, Transport=0.4658, Web/CloudOps=0.4992. +- frequency skill: A=0.2896, D=0.3638, H=0.3924, M=0.1218, Q=0.1820, S=0.4260, T=0.4325, W=0.2151. +- variates skill: multivariate=0.3936, univariate=0.3609. +- Outcome: Publish E76: full0.375612 improves paired3000 full0.374401; main0.379721 and earlier0.336781/0.360577/0.389281 all improve. All97 configurations and151170 instances pass; zero crossings. Fixed coefficient1.0 composition of own trained checkpoints; no additional training. + +E76 published checkpoint SHA2568562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105. Public full inference132.224730s on the shared H100. Relocation fixture15.725434s: three example configurations, bitwise identical, finite and monotone; all runtime/weight hashes verified. The checker initially ran before candidate assembly completed and was restarted after the package existed; the infrastructure error log is retained separately. No inference runtime change. + +E77 sampler fixture: {"seed": 197, "main_and_horizon_rng_matched": true, "real_windows_bitwise_equal": true, "changed_synthetic_context_values": 37211, "cpu_seconds": 4.491440053971019, "optimizer_updates": 0}. Prepared only; no optimizer updates or launch yet. + +## wide_capacity_146m_recovery_ema16000 +- Checkpoint SHA-256: `ad4960e948e64ecf25ec3be4cdc50bae6c7076d15cd7470b028f6ac703bb1081`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.720494747161865 seconds. +- Overall skill 0.375817; relative MASE 0.745785; relative WQL 0.522408. +- term skill: long=0.3987, medium=0.4075, short=0.3541. +- domain skill: Econ/Fin=0.1398, Energy=0.2372, Healthcare=0.4246, Nature=0.4298, Sales=0.3438, Transport=0.4655, Web/CloudOps=0.5003. +- frequency skill: A=0.3787, D=0.3494, H=0.3971, M=0.0940, Q=0.1979, S=0.4232, T=0.4362, W=0.2114. +- variates skill: multivariate=0.3941, univariate=0.3609. +- Outcome: Original-corpus146M at16000 reaches0.375817, above its E47 parent0.375793 and matched small control0.375510: retain the planned continuation. Expanded corpus at8000 scores0.374266 versus original-corpus8000 .374330, an essentially tied result after a worse4000 checkpoint. Stop the expanded branch, preserve full recovery state, and prioritize an initialization that actually diversifies features. This is inconclusive for data scaling, not proof that expanded data is harmful. + +## wide_corpus_expanded_recovery_ema8000 +- Checkpoint SHA-256: `fbab74444b04d805cc04ec612964fcad5e66766d55c3f566a8dc870328ca4493`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.68104600906372 seconds. +- Overall skill 0.374266; relative MASE 0.747150; relative WQL 0.524049. +- term skill: long=0.4008, medium=0.4075, short=0.3504. +- domain skill: Econ/Fin=0.1428, Energy=0.2366, Healthcare=0.4040, Nature=0.4268, Sales=0.3397, Transport=0.4655, Web/CloudOps=0.5014. +- frequency skill: A=0.3790, D=0.3421, H=0.3958, M=0.1065, Q=0.2072, S=0.4225, T=0.4375, W=0.1966. +- variates skill: multivariate=0.3942, univariate=0.3579. +- Outcome: Original-corpus146M at16000 reaches0.375817, above its E47 parent0.375793 and matched small control0.375510: retain the planned continuation. Expanded corpus at8000 scores0.374266 versus original-corpus8000 .374330, an essentially tied result after a worse4000 checkpoint. Stop the expanded branch, preserve full recovery state, and prioritize an initialization that actually diversifies features. This is inconclusive for data scaling, not proof that expanded data is harmful. + +E63 stop requested after8000 evaluation. No validation gain justifies continuing the nearly duplicated-width expanded-data arm while E73 is ready; the complete recovery state will allow later continuation. E73 takes that allocation with seed113/B96/LR3e-5/32000, reset at8000 toseed179, and static compiled loss. Its separate feature-group normalization and independent stream are the research changes; compiler numerical differences were measured explicitly. + +E75 maximum-shape bf16 GPU fixture: {"seed": 281, "batch": 64, "context": 4096, "horizon": 1024, "optimizer_updates": 0, "loss": 0.22305740416049957, "seconds": 10.91669597796863, "peak_allocated_mib": 5362.6640625, "peak_reserved_mib": 5694.0}. All model gradients finite; no optimizer updates. + +E73 independent feature stream with static compilation, seed113 training started at 2026-10-22T07:07:01Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E71 eight-point patches, seed197 training started at 2026-10-22T07:08:06Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E63 stop receipt: {"experiment": "E63 expanded146M stopped", "step": 8501, "training_loop_seconds": 2892.9847088330425, "checkpoint_sha256": "1d578f0a2278a3a4ad7011e24957797dde52c70b7e2c6f8b369aaf8227ac7133", "ema": "/workspace/research/runs/wide_corpus_expanded_recovery/ema008501.pt", "complete_recovery": "/workspace/research/runs/wide_corpus_expanded_recovery/recovery.pt", "selection_checkpoint_step": 8000, "selection_skill": 0.3742660744379728, "outcome": "Essentially tied with original-corpus same-width8000 .3743298586; prioritize independent stream. Data scaling remains inconclusive."}. + +## E67 full_paired_control final12000 +- Checkpoint SHA-256: `b79cfdeefa1b2b20af89c8484a447dc96bfdd31234f2b08346468c8d9ece62bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.30943751335144 seconds. +- Overall skill 0.377243; relative MASE 0.745277; relative WQL 0.520379. +- term skill: long=0.4013, medium=0.4067, short=0.3560. +- domain skill: Econ/Fin=0.1346, Energy=0.2365, Healthcare=0.4485, Nature=0.4306, Sales=0.3336, Transport=0.4666, Web/CloudOps=0.5025. +- frequency skill: A=0.3681, D=0.3525, H=0.3948, M=0.1073, Q=0.2012, S=0.4245, T=0.4384, W=0.2186. +- variates skill: multivariate=0.3950, univariate=0.3628. +- Outcome: Seed197/B64/LR2e-5; final12000 is worse than the selected paired3000 and its published slow-AR correction. No publication. Matched control and candidate complete; no baseline rerun. + +## E67 full_paired_candidate final12000 +- Checkpoint SHA-256: `26d529aeaaee4484b0b4375fdc379779b08b38ac5077f0147587421f4f5fc8b0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.91175127029419 seconds. +- Overall skill 0.377427; relative MASE 0.744720; relative WQL 0.520460. +- term skill: long=0.4032, medium=0.4055, short=0.3560. +- domain skill: Econ/Fin=0.1326, Energy=0.2359, Healthcare=0.4464, Nature=0.4299, Sales=0.3326, Transport=0.4667, Web/CloudOps=0.5051. +- frequency skill: A=0.3614, D=0.3505, H=0.3948, M=0.1036, Q=0.1986, S=0.4251, T=0.4404, W=0.2181. +- variates skill: multivariate=0.3963, univariate=0.3620. +- Outcome: Seed197/B64/LR2e-5; final12000 is worse than the selected paired3000 and its published slow-AR correction. No publication. Matched control and candidate complete; no baseline rerun. + +E67 complete measured training loop times on the shared H100: individual control2794.8358459s; paired candidate2794.8673859s. These are overlapping wall times, not additive exclusive GPU seconds. + +## Operator recovery2 — 2026-10-22 +The operator reports152594 research seconds remaining; all old processes ended. Published E76 verified SHA2568562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105 and full validation0.3756123475. Resume complete optimizer/EMA/RNG/prefetched-batch checkpoints: E58/E66 wide17000 and control23000, E61 slowAR8000, E65 recent normalization9000. Their prior last logged steps17200/23750/8450/9600 represent at least200/750/450/600 unsaved updates discarded. Original phase logs remain intact, latest elapsed3043.3/3041.0/3037.0/3034.3s respectively. E73 graft had no checkpoint or logged50-step interval; E71 patch8 reached200/63.0s with no checkpoint. Restart both from saved own initialization with unchanged seeds. Compiler caches were absent after recovery, so E73 recompiles static shapes. E63 remains stopped; E67 remains complete. Phase commands/PIDs/timing are recorded in recovery2_launch_receipt.json and *_recovery2.log; queued E69/E75/E77 retain predeclared settings. + +## E78 multiple persistent scales in synthetic residuals — prepared, not launched +Hypothesis: the slow-AR improvement reflects missing persistent residual dynamics, but a single decay rate per synthetic sequence cannot represent fast variation superimposed on slow level changes. Compare four independent OU components to E77's one component. Keep the original component and main RNG draws; add three components with log-uniform time constants1..10000 from an independent RNG seed700200, then divide their sum by2 to preserve asymptotic stationary variance. All components retain zero initial state, isolating multiple scales from initialization. Other synthetic structure,20% synthetic fraction, real windows, horizon augmentation, architecture and loss remain unchanged. ParentE62, seed197/B64/LR2e-5/12000, paired-sign loss, main/horizon RNG identical to E77. This generator uses no external data. Prepare and check on allowed training windows; launch only after a suitable allocation is released. + +E78 sampler fixture passed: { "seed": 197, "extra_seed": 700200, "real_windows_bitwise_equal": 211, "synthetic_windows": 45, "changed_context_values": 26747, "main_and_horizon_rng_matched": true, "finite_masks_and_periods_matched": true, "cpu_seconds": 4.07623768504709, "optimizer_updates": 0 }; prepared only, no optimizer updates. + +## E58/E66 recovered37M control24000 +- Checkpoint SHA-256: `0a77157c454bf7a913b41493f052666ed1cfce3d65206b6c969fb8d95e6314a7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.700880765914917 seconds. +- Overall skill 0.375681; relative MASE 0.745320; relative WQL 0.522962. +- term skill: long=0.4008, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1417, Energy=0.2348, Healthcare=0.4210, Nature=0.4300, Sales=0.3397, Transport=0.4677, Web/CloudOps=0.5018. +- frequency skill: A=0.3784, D=0.3533, H=0.3961, M=0.0763, Q=0.2029, S=0.4222, T=0.4370, W=0.2113. +- variates skill: multivariate=0.3953, univariate=0.3596. +- Outcome: Seed113, matched reset at8000 toseed179. Skill0.375681 remains slightly below E47parent0.375793; continue the predeclared schedule to32000. E58large24000 is pending. + +## E79 fresh pretraining at37M and146M — prepared, not launched +Hypothesis: duplicating a mature smaller representation and continuing at a small learning rate limits the useful benefit of capacity. Test distinct random initializations under one matched modern recipe. Both arms use the same direct encoder/decoder architecture (patch16,6encoder/4decoder blocks, recency/confidence inputs and partial-target masks); widths512/1024 with8/16heads are the only architectural difference. Every tensor is initialized here with seed307; no parent weights. Both use packed_sample,20% own synthetic windows, the proven slow-AR time-constant prior1..10000, independent horizon-prefix augmentation seed300310, paired-sign objective, seed307 sampling, batch48 distinct/96signed rows, AdamW LR2e-4,400-step warmup and96000-step cosine schedule, EMA. Both use the same static compiled loss after a numerical/memory fixture. Save every1000; screen4000/8000/16000/24000/48000/72000/96000, with earlier cutoffs for promising candidates. This is a matched width comparison within the new recipe; comparisons to the old published lineage are model-selection comparisons, not clean causal claims about width. Reuse no released or baseline weights. Launch only after existing allocations release. The extended schedule supplies4.608M distinct sampled windows per arm; stop a clearly unpromising branch when its checkpoints establish that result. + +## E71 patch8 first1000 +- Checkpoint SHA-256: `67648eaef1f0a4fe5a7c5526f25c2c8724735720463d99250e814632841f9ada`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.271108627319336 seconds. +- Overall skill 0.374708; relative MASE 0.748109; relative WQL 0.522638. +- term skill: long=0.3990, medium=0.3996, short=0.3553. +- domain skill: Econ/Fin=0.1322, Energy=0.2323, Healthcare=0.4676, Nature=0.4328, Sales=0.3481, Transport=0.4583, Web/CloudOps=0.4952. +- frequency skill: A=0.3712, D=0.3577, H=0.3912, M=0.0847, Q=0.1944, S=0.4235, T=0.4328, W=0.2289. +- variates skill: multivariate=0.3876, univariate=0.3643. +- Outcome: Seed197/B64/LR2e-5; recovers most of the conversion loss, from initial0.362217 to0.374708. Still below matched patch16 paired1000 at0.376860 and parentE62 at0.377343; continue to3000/6000 before a decision. + +E79 initial checkpoint receipts: [ { "path": "/workspace/research/random_capacity_512_initial.pt", "sha256": "19da01694123fcb13df815689ca66460d0da596bd31dfabfabb08dda6f7801e4", "parameters": 36800800, "seed": 307, "cpu_seconds": 0.5544250560924411, "optimizer_updates": 0 }, { "path": "/workspace/research/random_capacity_1024_initial.pt", "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", "parameters": 146477344, "seed": 307, "cpu_seconds": 2.0617611361667514, "optimizer_updates": 0 } ] + +E79 width512 fixture: { "width": 512, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": { "batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 4520.62451171875, "peak_reserved_mib": 4784.0 }, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999952735476323, "max_gradient_difference": 4.57763671875e-05, "compile_comparison_seconds": 53.98739787377417, "total_seconds": 63.50496790325269, "source": "allowed packed_sample and own synthetic generator only" } + +E79 width1024 fixture: { "width": 1024, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": { "batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 10162.86376953125, "peak_reserved_mib": 10694.0 }, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999932382274589, "max_gradient_difference": 6.103515625e-05, "compile_comparison_seconds": 62.02263342216611, "total_seconds": 72.94260076899081, "source": "allowed packed_sample and own synthetic generator only" } + +E79 both arms are queued after E58wide and E71patch8 release their allocations; their complete recovery files must exist. Queue receipts random_capacity_512_queue.json and random_capacity_1024_queue.json preserve exact commands. Both use B48/96000/seed307/static compilation. No training has started. Compiler caches are backed up under research/compiler_cache_backup and can be restored to the same /tmp paths after another recovery. + +postloss started 2026-10-22T07:27:21.677278+00:00 after recent_normalization_recovery completed. Original predeclared settings and seed retained. + +## Operator recovery3 — 2026-10-23 +Operator reports151596 research seconds remaining; all prior processes ended. Submission E76 hash verified unchanged. Resume complete state at wide20000/control28000/slowAR10000/patch8 2000. Last logged steps20100/28400/10850/2700 imply at least100/400/850/700 discarded unsaved updates; phase2 elapsed768.6/769.5/767.8/770.0s. Graft reached100 updates/722.7s without checkpoint; restart own seed113 initialization, restored compiler caches (13.8722s). Recent normalization completed12000 with final phase training loop708.0175s; do not retrain. Volatility/paired-slowAR and fresh-width queues restored with new dependencies. Postloss reached200/43.0s with nonfinite losses, no checkpoint; numerical diagnosis precedes restarting. Prior phase logs retained; no credential access. + +E75 numerical failure diagnosed on allowed-corpus step53, seed197, without optimizer updates: one row has context magnitude2.2842e18 and float32 variance accumulation overflow, yielding infinite normalization scale. The normalized neural output is finite, but conversion to raw units produces nonfinite values. Context postprocessing statistics themselves remain finite. Add a float64 fallback only on rows with nonfinite mean/scale; ordinary-row arithmetic remains bitwise unchanged. Restart this experiment from E62 after regression checks; no affected checkpoint will be selected. This correction is part of this comparison and will be retained in its inference runtime if selected. + +## E65 recent normalization final12000 +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 31.676968097686768 seconds. +- Overall skill 0.375806; relative MASE 0.744151; relative WQL 0.523574. +- term skill: long=0.4022, medium=0.4055, short=0.3535. +- domain skill: Econ/Fin=0.1427, Energy=0.2348, Healthcare=0.4380, Nature=0.4255, Sales=0.3383, Transport=0.4706, Web/CloudOps=0.4994. +- frequency skill: A=0.3754, D=0.3572, H=0.3959, M=0.0785, Q=0.2042, S=0.4248, T=0.4352, W=0.2109. +- variates skill: multivariate=0.3924, univariate=0.3622. +- Outcome: Seed101/B128/LR3e-5. Main0.375806 narrowly exceeds4096-control0.375764 and8192-full-normalization0.375118; evaluate earlier windows against both matched controls. Final resumed phase708.0175 training-loop seconds; prior interrupted phases are retained separately. + +E75 numerical regression passed: ordinary rows bitwise original; observed overflowing row now finite loss2.6841469 and all gradients finite,7.0381s,0optimizer updates. Fixed-parent replay of250original training batches found no nonfinite postprocessed forecasts in21.9482s. Restarted seed197/B64/LR2e-5/12000 from E62. Future validation uses postloss_inference with the same overflow fallback. The first earlier-control evaluation launch used the old trend summary runtime by mistake and was cancelled; corrected comparisons are named long_context_control_fixed128_ema12000. No selection uses the cancelled diagnostic. + +E76 descriptive paired full-validation comparison against E67paired3000: improvement0.0012113184,51/97configurations improve. Resampling dataset-directory clusters (28keys, seed317,5000draws) gives skill-delta percentiles[-0.0006681,0.0012221,0.0031907]. The range crosses zero and adaptive validation reuse prevents a held-out significance claim. Retain E76 based on measured full/earlier scores, while recognizing this is a small improvement. Largest gains include us_births daily and bizitobs_l2c short; ETT2 minute short worsens. Full per-configuration log-error differences retained in slow_ar_delta6k_comparison.json. + +## E80 matched control for the overflow correction — prepared +E75 needs a numerical fallback for rare overflowing training rows. To isolate its postprocessing-aware objective, prepare a control with exactly the same fallback but the original E67 paired-sign loss. ParentE62,seed197,B64,LR2e-5,12000steps, matching data/horizon RNG. No other inference or training change. This is a newly required numerical control, not a baseline rerun. + +## E81 equal ensemble of E76 and recent-normalization12000 +The longer-history candidate has a stronger second earlier cutoff but lower main/first-earlier performance than E76. Test whether averaging their postprocessed quantiles reduces complementary errors. Fixed equal weights; every member must forecast every instance if packaged. Compare cached main and both earlier predictions first. No coefficient sweep, new fitting, data or training. Reject unless the diagnostic tradeoff justifies full public-package replay. + +E80 overflow-only paired control queued alongside fresh-capacity arms after the old wide/patch8 allocations release. E78 multiscale-AR queued after postloss releases its allocation. Both use declared seed197/B64/LR2e-5/12000 settings; every command is retained in its queue receipt. Neither has started. + +## E65 matched comparison recent_normalization_recovery backcast_evals +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.444558143615723 seconds. +- Overall skill 0.335105; relative MASE 0.796743; relative WQL 0.554866. +- term skill: long=0.4010, medium=0.3564, short=0.2994. +- domain skill: Econ/Fin=0.1646, Energy=0.2213, Healthcare=0.4212, Nature=0.3540, Sales=0.3970, Transport=0.3770, Web/CloudOps=0.4538. +- frequency skill: A=0.3179, D=0.3541, H=0.3610, M=0.1841, Q=0.2288, S=0.3371, T=0.3395, W=0.2758. +- variates skill: multivariate=0.3510, univariate=0.3221. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison recent_normalization_recovery backcast2_evals +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.86247205734253 seconds. +- Overall skill 0.361614; relative MASE 0.766245; relative WQL 0.531861. +- term skill: long=0.3676, medium=0.3942, short=0.3463. +- domain skill: Econ/Fin=0.1074, Energy=0.2351, Healthcare=0.3566, Nature=0.4647, Sales=0.5547, Transport=0.4203, Web/CloudOps=0.4480. +- frequency skill: A=0.3496, D=0.4310, H=0.3890, M=0.1517, Q=0.1448, S=0.2876, T=0.3677, W=0.2567. +- variates skill: multivariate=0.3709, univariate=0.3540. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_control_fixed128 backcast_evals +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.399088382720947 seconds. +- Overall skill 0.335548; relative MASE 0.797825; relative WQL 0.553375. +- term skill: long=0.3998, medium=0.3578, short=0.3002. +- domain skill: Econ/Fin=0.1618, Energy=0.2279, Healthcare=0.4256, Nature=0.3575, Sales=0.3966, Transport=0.3721, Web/CloudOps=0.4487. +- frequency skill: A=0.3187, D=0.3539, H=0.3656, M=0.1845, Q=0.2285, S=0.3427, T=0.3351, W=0.2751. +- variates skill: multivariate=0.3528, univariate=0.3215. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_control_fixed128 backcast2_evals +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.050649642944336 seconds. +- Overall skill 0.359190; relative MASE 0.769269; relative WQL 0.533801. +- term skill: long=0.3663, medium=0.3893, short=0.3445. +- domain skill: Econ/Fin=0.1046, Energy=0.2371, Healthcare=0.3554, Nature=0.4689, Sales=0.5535, Transport=0.4194, Web/CloudOps=0.4333. +- frequency skill: A=0.3493, D=0.4307, H=0.3894, M=0.1531, Q=0.1429, S=0.2835, T=0.3601, W=0.2577. +- variates skill: multivariate=0.3643, univariate=0.3551. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_8192 backcast_evals +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.02571153640747 seconds. +- Overall skill 0.335778; relative MASE 0.796740; relative WQL 0.553746. +- term skill: long=0.4000, medium=0.3562, short=0.3012. +- domain skill: Econ/Fin=0.1625, Energy=0.2211, Healthcare=0.4240, Nature=0.3584, Sales=0.3963, Transport=0.3783, Web/CloudOps=0.4528. +- frequency skill: A=0.3183, D=0.3550, H=0.3608, M=0.1825, Q=0.2283, S=0.3383, T=0.3410, W=0.2775. +- variates skill: multivariate=0.3516, univariate=0.3229. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_8192 backcast2_evals +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.033729791641235 seconds. +- Overall skill 0.361619; relative MASE 0.766647; relative WQL 0.531576. +- term skill: long=0.3678, medium=0.3937, short=0.3464. +- domain skill: Econ/Fin=0.1060, Energy=0.2331, Healthcare=0.3615, Nature=0.4677, Sales=0.5540, Transport=0.4209, Web/CloudOps=0.4469. +- frequency skill: A=0.3484, D=0.4320, H=0.3875, M=0.1537, Q=0.1444, S=0.2887, T=0.3679, W=0.2592. +- variates skill: multivariate=0.3695, univariate=0.3552. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +E81 main: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3792404374337234, "rel_mase_gmean": 0.7413362113099933, "rel_wql_gmean": 0.5197944315124549, "groups": {"term": {"short": 0.3580501678473965, "medium": 0.4075051608812147, "long": 0.40436165270683755}, "domain": {"Econ/Fin": 0.14514965737880325, "Energy": 0.23693703384364162, "Healthcare": 0.4508892358362413, "Nature": 0.43068317186356664, "Sales": 0.3372290847442204, "Transport": 0.46921029381701185, "Web/CloudOps": 0.5049832577126345}, "freq": {"A-DEC": 0.3741084316720569, "Q-DEC": 0.2032048606604645, "M": 0.09063626527124269, "W-SUN": 0.11024985736894433, "D": 0.35966521985300126, "H": 0.39764382964309264, "15T": 0.21216406035245483, "W-FRI": -0.006517286299776881, "10T": 0.6144670200764979, "W-TUE": 0.5505379760713061, "W-THU": 0.20290227669295913, "W-WED": 0.3148429295780334, "5T": 0.5200294927472697, "10S": 0.42580083885860065}}, "cpu_seconds": 1.3077636559028178, "members": ["/workspace/research/evals/slow_ar_delta6k", "/workspace/research/evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 backcast: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3372609628923202, "rel_mase_gmean": 0.7949387478174683, "rel_wql_gmean": 0.5525243706037937, "groups": {"term": {"short": 0.30267748548708406, "medium": 0.3587870572492281, "long": 0.4004504376989413}, "domain": {"Econ/Fin": 0.16791580188275335, "Energy": 0.2249147271500851, "Healthcare": 0.41565091499514417, "Nature": 0.36337531871749584, "Sales": 0.3953576986774914, "Transport": 0.37558039099633533, "Web/CloudOps": 0.45422426929296467}, "freq": {"A-DEC": 0.3198896505754395, "Q-DEC": 0.2324966250821987, "M": 0.1868807358115966, "W-SUN": 0.05675657061089712, "D": 0.35253814976953, "H": 0.3643205260222693, "15T": 0.2214260132321374, "W-FRI": 0.25870400902354673, "10T": 0.32373236597235966, "W-TUE": 0.534873854215015, "W-THU": 0.23833675077582528, "W-WED": 0.34309889609685684, "5T": 0.44852116184278545, "10S": 0.34093317446682636}}, "cpu_seconds": 0.9129793490283191, "members": ["/workspace/research/backcast_evals/slow_ar_delta6k", "/workspace/research/backcast_evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 backcast2: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.36253066634723885, "rel_mase_gmean": 0.7663699578325764, "rel_wql_gmean": 0.5302493230514544, "groups": {"term": {"short": 0.3479807306166687, "medium": 0.39255912185019026, "long": 0.3693846383480154}, "domain": {"Econ/Fin": 0.1149608358698847, "Energy": 0.23668310113177404, "Healthcare": 0.35088547046370666, "Nature": 0.47069187269468127, "Sales": 0.5515284168852219, "Transport": 0.42149224872299274, "Web/CloudOps": 0.44469672192663035}, "freq": {"A-DEC": 0.3516200787127538, "Q-DEC": 0.14815814613753098, "M": 0.1464874832493296, "W-SUN": 0.06348262953040695, "D": 0.4307487103712574, "H": 0.3906466140437964, "15T": 0.10333300498128906, "W-FRI": 0.155407323458577, "10T": 0.5012397694349602, "W-TUE": 0.09030520980227696, "W-THU": 0.32093855640615543, "W-WED": 0.5365268550523004, "5T": 0.4842228628098807, "10S": 0.2879093531003366}}, "cpu_seconds": 0.9467690440360457, "members": ["/workspace/research/backcast2_evals/slow_ar_delta6k", "/workspace/research/backcast2_evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 actual candidate hash500fdde392c269ef1a6830477580bc7890b711824097ac711885bf0220e657cb,73,598,528parameters, contains original4096 E76 and recent-normalized8192 E65. Full package replay and relocation verification started. Candidate-only, submission unchanged. + +## E71 patch8 at3000 +- Checkpoint SHA-256: `5be1ccd5e5539619e4f5ff221a4088437e7267ceb34928015a0348187e4a575e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.875902891159058 seconds. +- Overall skill 0.378312; relative MASE 0.744947; relative WQL 0.518823. +- term skill: long=0.4027, medium=0.4023, short=0.3592. +- domain skill: Econ/Fin=0.1391, Energy=0.2401, Healthcare=0.4515, Nature=0.4387, Sales=0.3471, Transport=0.4584, Web/CloudOps=0.4997. +- frequency skill: A=0.3807, D=0.3546, H=0.3955, M=0.0952, Q=0.1935, S=0.4235, T=0.4386, W=0.2325. +- variates skill: multivariate=0.3942, univariate=0.3653. +- Outcome: Seed197, interrupted then full-state resumed at2000. Main0.378312 essentially matches E67paired16-point3000 at0.378318. Continue to6000; no publication on this near tie. + +Recovery-frequency change verified on the tiny permitted-data fixture: { "maximum_model_difference": 1.5543122344752192e-15, "maximum_ema_difference": 3.0531133177191805e-16, "batch_rng_equal": true, "sampler_rng_equal": true, "seconds": 29.735046536196023, "selection_checkpoint_every": 4, "recovery_checkpoint_every": 2, "fixture_only": true }; increasing recovery-state saves preserves the sampler stream and model/EMA up to measured GPU roundoff. Newly launched jobs default to complete-state saves every250steps, while selection weights remain every1000. Already-running processes retain their original code/schedule. + +## E82 final slow-AR correction transfer — predeclared comparison +When E61 completes12000, replace the6000-step correction with its12000-step counterpart: E67paired3000 + E61slowAR12000 - E42partial12000, coefficient1.0, confidence-only tensor retained from base. This is the already-planned final matched comparison, not addition on top of E76. No coefficient sweep or further training. Check all four screening cutoffs, then full public package only if justified. slow_ar_final_comparison.py executes the fixed composition and screens after the atomic EMA exists. + +## E81 equal long-history ensemble full package +- Checkpoint SHA-256: `500fdde392c269ef1a6830477580bc7890b711824097ac711885bf0220e657cb`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.375233; relative MASE 0.744322; relative WQL 0.524415. +- term skill: long=0.3984, medium=0.4064, short=0.3536. +- domain skill: Econ/Fin=0.1215, Energy=0.2298, Healthcare=0.4558, Nature=0.4307, Sales=0.3504, Transport=0.4695, Web/CloudOps=0.4976. +- frequency skill: A=0.2913, D=0.3631, H=0.3929, M=0.1149, Q=0.1839, S=0.4258, T=0.4330, W=0.2096. +- variates skill: multivariate=0.3929, univariate=0.3608. +- Outcome: Reject for publication: full0.375233 is below selected E76 0.375612, despite first/second-earlier gains. All97configs/151170instances valid, zero crossings. Public inference213.940586s on shared H100. No coefficient sweep; retain singleton E76. + +volatility_synth started 2026-10-23T02:55:46.196186+00:00 after long_memory_synth_recovery completed. Original predeclared settings and seed retained. + +## E75 corrected postloss first1000 +- Checkpoint SHA-256: `d33a29e773434d2f0faf2bc85b73151354dcb98bedc83f28c44e776835310afa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.844736576080322 seconds. +- Overall skill 0.376671; relative MASE 0.745163; relative WQL 0.521416. +- term skill: long=0.3992, medium=0.4062, short=0.3560. +- domain skill: Econ/Fin=0.1257, Energy=0.2385, Healthcare=0.4569, Nature=0.4304, Sales=0.3363, Transport=0.4666, Web/CloudOps=0.4975. +- frequency skill: A=0.3694, D=0.3556, H=0.3962, M=0.0824, Q=0.1976, S=0.4232, T=0.4357, W=0.2250. +- variates skill: multivariate=0.3926, univariate=0.3637. +- Outcome: Finite training after the verified normalization fallback. Main0.376671 is slightly below E67paired1000 at0.376860; continue to3000/6000, with newly queued overflow-only E80 control needed to isolate the objective. + +paired_long_memory started 2026-10-23T02:56:31.210459+00:00 after wide_capacity_control_recovery completed. Original predeclared settings and seed retained. + +## E61 slowAR final12000 +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.156561374664307 seconds. +- Overall skill 0.362914; relative MASE 0.759071; relative WQL 0.534704. +- term skill: long=0.3926, medium=0.4046, short=0.3342. +- domain skill: Econ/Fin=0.1187, Energy=0.1874, Healthcare=0.4331, Nature=0.4271, Sales=0.3429, Transport=0.4595, Web/CloudOps=0.5091. +- frequency skill: A=0.3722, D=0.3472, H=0.3824, M=0.1132, Q=0.2021, S=0.4423, T=0.4070, W=0.2137. +- variates skill: multivariate=0.3958, univariate=0.3355. +- Outcome: Seed79; main0.362914 improves matched E42partial12000 at0.361108. Completed final resumed phase569.4896 training-loop seconds; prior interrupted phase logs retained. E82 transfers the final matched correction to selected paired3000, compared with the already published6000 correction. + +E75 overflow source replay identifies bitcoin_with_missing (seed197,step53,row37), with daily periods7/365 and observed values from6.0e11 to2.28e18. These scales can be legitimate crypto quantities; no data-cleaning or filtering rule is inferred. Source diagnostic0.9295CPU seconds, no optimizer updates. The numerical fallback addresses the representation range. + +E81 relocated package checks passed: three example configurations bitwise equal, finite and monotone,21.2942s. Third-earlier cached ensemble0.389488 slightly exceeds E76 0.389281, but main/full remain lower, so the publication decision remains rejection. The long-history member alone scores0.386764 at this third cutoff. + +## E58/E66 recovered37M control final32000 +- Checkpoint SHA-256: `570983ddd4f6d8e136906f1669798d938ecd93738da55f624afc5b25606249bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.769165754318237 seconds. +- Overall skill 0.375305; relative MASE 0.746308; relative WQL 0.522900. +- term skill: long=0.3997, medium=0.4059, short=0.3535. +- domain skill: Econ/Fin=0.1400, Energy=0.2324, Healthcare=0.4362, Nature=0.4284, Sales=0.3384, Transport=0.4676, Web/CloudOps=0.5011. +- frequency skill: A=0.3825, D=0.3508, H=0.3940, M=0.0846, Q=0.2029, S=0.4232, T=0.4370, W=0.2159. +- variates skill: multivariate=0.3936, univariate=0.3604. +- Outcome: Final0.375305 below E47parent0.375793 and own24000 at0.375681. Final resumed phase616.7562 training-loop seconds; prior phase logs retained. No publication. Its allocation now trains E77pairedslowAR. + +E61 final12k EMA hashc27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e. Last resumed phase569.4895656s; phase2 reached10850 in767.8s, phase1 reached8450 in3037.0s, original pre-recovery attempt reached2150 in542.2s. These are overlapping process elapsed times, with discarded unsaved updates counted as spent compute; not exclusive GPU seconds. E65 final resumed phase708.0175s, prior phases3034.3s and71.8s. + +## E82 slowAR final correction evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.064879655838013 seconds. +- Overall skill 0.379181; relative MASE 0.741695; relative WQL 0.519643. +- term skill: long=0.4028, medium=0.4057, short=0.3593. +- domain skill: Econ/Fin=0.1465, Energy=0.2342, Healthcare=0.4607, Nature=0.4319, Sales=0.3354, Transport=0.4660, Web/CloudOps=0.5068. +- frequency skill: A=0.3720, D=0.3593, H=0.3969, M=0.1007, Q=0.1994, S=0.4227, T=0.4390, W=0.2245. +- variates skill: multivariate=0.3977, univariate=0.3640. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.045677423477173 seconds. +- Overall skill 0.336511; relative MASE 0.796069; relative WQL 0.552989. +- term skill: long=0.3975, medium=0.3593, short=0.3024. +- domain skill: Econ/Fin=0.1707, Energy=0.2251, Healthcare=0.4072, Nature=0.3664, Sales=0.3935, Transport=0.3727, Web/CloudOps=0.4527. +- frequency skill: A=0.3195, D=0.3490, H=0.3653, M=0.1930, Q=0.2358, S=0.3419, T=0.3374, W=0.2844. +- variates skill: multivariate=0.3537, univariate=0.3225. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast2_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.12555480003357 seconds. +- Overall skill 0.360111; relative MASE 0.768417; relative WQL 0.532858. +- term skill: long=0.3671, medium=0.3887, short=0.3461. +- domain skill: Econ/Fin=0.1203, Energy=0.2346, Healthcare=0.3518, Nature=0.4695, Sales=0.5471, Transport=0.4199, Web/CloudOps=0.4385. +- frequency skill: A=0.3524, D=0.4264, H=0.3900, M=0.1434, Q=0.1516, S=0.2859, T=0.3636, W=0.2642. +- variates skill: multivariate=0.3674, univariate=0.3541. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast3_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 23.64928960800171 seconds. +- Overall skill 0.389784; relative MASE 0.736377; relative WQL 0.505671. +- term skill: long=0.3953, medium=0.3617, short=0.3980. +- domain skill: Econ/Fin=0.1860, Energy=0.3200, Healthcare=0.2362, Nature=0.5068, Sales=0.3992, Transport=0.5052, Web/CloudOps=0.3945. +- frequency skill: A=0.3688, D=0.4453, H=0.4034, M=0.1130, Q=0.2642, S=0.2924, T=0.4309, W=0.2637. +- variates skill: multivariate=0.3749, univariate=0.4013. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +E82 composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/full_paired_candidate/ema003000.pt": "2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238", "/workspace/research/runs/long_memory_synth_recovery/ema012000.pt": "c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e", "/workspace/research/runs/partial_targets/ema012000.pt": "a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837"}, "seconds": 1.2579920410644263} + +## E61 slowAR final12k backcast_evals +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.161132097244263 seconds. +- Overall skill 0.332462; relative MASE 0.802575; relative WQL 0.555221. +- term skill: long=0.3889, medium=0.3582, short=0.2991. +- domain skill: Econ/Fin=0.1592, Energy=0.2274, Healthcare=0.4159, Nature=0.3553, Sales=0.3990, Transport=0.3647, Web/CloudOps=0.4455. +- frequency skill: A=0.3164, D=0.3542, H=0.3581, M=0.1781, Q=0.2386, S=0.3429, T=0.3325, W=0.2793. +- variates skill: multivariate=0.3483, univariate=0.3196. +- Outcome: Final direct slow-AR improves E42partial12k on both earlier cutoffs:0.332462 versus0.331074 and0.354079 versus0.353096. Matched synthetic-prior benefit survives the full schedule, while transferring its final delta is weaker than transferring6000 at the selected backbone. + +## E61 slowAR final12k backcast2_evals +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.80446219444275 seconds. +- Overall skill 0.354079; relative MASE 0.774604; relative WQL 0.538615. +- term skill: long=0.3715, medium=0.3752, short=0.3393. +- domain skill: Econ/Fin=0.1039, Energy=0.2274, Healthcare=0.3615, Nature=0.4600, Sales=0.5536, Transport=0.4138, Web/CloudOps=0.4332. +- frequency skill: A=0.3506, D=0.4274, H=0.3872, M=0.1661, Q=0.1581, S=0.2852, T=0.3480, W=0.2482. +- variates skill: multivariate=0.3615, univariate=0.3480. +- Outcome: Final direct slow-AR improves E42partial12k on both earlier cutoffs:0.332462 versus0.331074 and0.354079 versus0.353096. Matched synthetic-prior benefit survives the full schedule, while transferring its final delta is weaker than transferring6000 at the selected backbone. + +E73 usage diagnostic on8allowed-corpus windows,seed337,C512,H128,5.8388CPU seconds,0optimizer updates: initial added-head contribution is zero; atEMA2000 its output RMS is0.00924times the inherited head contribution. Cross-stream query-weight norm rises from0 to0.01672times within-stream norm; head-input streams remain distinct (relative RMS difference1.4274). Distinct features are being used, but this alone does not establish validation improvement. Full receipt wide_graft_usage2k.json includes hashes. + +## E75 corrected postloss3000 +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.580218076705933 seconds. +- Overall skill 0.378814; relative MASE 0.742602; relative WQL 0.519622. +- term skill: long=0.4027, medium=0.4070, short=0.3582. +- domain skill: Econ/Fin=0.1222, Energy=0.2441, Healthcare=0.4509, Nature=0.4321, Sales=0.3355, Transport=0.4650, Web/CloudOps=0.5021. +- frequency skill: A=0.3710, D=0.3521, H=0.4006, M=0.0768, Q=0.1947, S=0.4220, T=0.4401, W=0.2249. +- variates skill: multivariate=0.3963, univariate=0.3645. +- Outcome: Main0.378814 exceeds original E67paired3000 at0.378318, but remains below selected E76 at0.379721. Check earlier cutoffs; numerical-only control E80 remains queued, so causal attribution to postprocessing loss is provisional. + +## E83 combine postprocessing-aware3000 with the selected slow-AR6000 correction +E75 improves the original paired3000 main screen, while E76 demonstrates that the matched slow-AR6000 correction transfers across cutoffs. Test a fixed composition: E75postloss3000 + E61slowAR6000 - E42partial6000. Keep E75 confidence parameters, its verified overflow fallback and all inference rules. Coefficient1.0, no sweep; evaluate all four screening cutoffs before full replay/publication. This is a predictive composition test; E80 is still needed to separate the numerical correction from the postprocessing-aware loss. No additional training or validation gradients. + +## E77 pairedslowAR first1000 +- Checkpoint SHA-256: `278af3b837eee9032d80e20e70dc9155bd1f272983232826f16ff9df95547846`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.467870473861694 seconds. +- Overall skill 0.377046; relative MASE 0.744404; relative WQL 0.521319. +- term skill: long=0.3994, medium=0.4062, short=0.3566. +- domain skill: Econ/Fin=0.1382, Energy=0.2363, Healthcare=0.4530, Nature=0.4321, Sales=0.3345, Transport=0.4673, Web/CloudOps=0.4987. +- frequency skill: A=0.3685, D=0.3562, H=0.3951, M=0.1012, Q=0.1989, S=0.4234, T=0.4360, W=0.2232. +- variates skill: multivariate=0.3931, univariate=0.3639. +- Outcome: Seed197/B64/LR2e-5; main0.377046 slightly exceeds original paired1000 at0.376860. Early checkpoint only; continue matched3000/6000/12000 comparison. + +## E75 postloss3000 backcast_evals +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.485270261764526 seconds. +- Overall skill 0.333947; relative MASE 0.800204; relative WQL 0.554393. +- term skill: long=0.3971, medium=0.3587, short=0.2981. +- domain skill: Econ/Fin=0.1484, Energy=0.2303, Healthcare=0.3976, Nature=0.3612, Sales=0.3967, Transport=0.3722, Web/CloudOps=0.4461. +- frequency skill: A=0.3136, D=0.3467, H=0.3696, M=0.1659, Q=0.2280, S=0.3365, T=0.3319, W=0.2801. +- variates skill: multivariate=0.3510, univariate=0.3200. +- Outcome: Both earlier cutoffs regress against original E67paired3000:0.333947 versus0.335739 and0.357605 versus0.358235, exceeding the main gain. Prune corrected postloss continuation, preserve complete recovery and checkpoints, and release its allocation to E78multiscale. E83 composition screening continues; E80 numerical-only control remains needed for attribution. + +## E75 postloss3000 backcast2_evals +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.475824117660522 seconds. +- Overall skill 0.357605; relative MASE 0.772196; relative WQL 0.534413. +- term skill: long=0.3631, medium=0.3873, short=0.3437. +- domain skill: Econ/Fin=0.1041, Energy=0.2395, Healthcare=0.3227, Nature=0.4712, Sales=0.5519, Transport=0.4212, Web/CloudOps=0.4278. +- frequency skill: A=0.3532, D=0.4162, H=0.3932, M=0.1558, Q=0.1493, S=0.2753, T=0.3604, W=0.2566. +- variates skill: multivariate=0.3621, univariate=0.3540. +- Outcome: Both earlier cutoffs regress against original E67paired3000:0.333947 versus0.335739 and0.357605 versus0.358235, exceeding the main gain. Prune corrected postloss continuation, preserve complete recovery and checkpoints, and release its allocation to E78multiscale. E83 composition screening continues; E80 numerical-only control remains needed for attribution. + +multiscale_ar seed197 training started at 2026-10-23T03:01:47Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E75 stop receipt: {"experiment": "E75 corrected postloss stopped", "step": 3653, "checkpoint_sha256": "760314a6d65350417c4a58e32eb21cebaac953dc83820d300a4b6b24b0977cb1", "weights": "/workspace/research/runs/postloss/ema003653.pt", "recovery": "/workspace/research/runs/postloss/recovery.pt", "training_loop_final_record": {"completed_step": 3653, "training_process_loop_seconds": 799.9150489440653}, "process_receipt": {"command": ["python3", "/workspace/research/recovery/train.py", "--code-dir", "/workspace/research/postloss", "--packed", "/workspace/research/packed_sample", "--source-weights-from", "/workspace/research/packed_sample", "--out", "/workspace/research/runs/postloss", "--initialize-from", "/workspace/research/horizon_delta12k.pt", "--steps", "12000", "--batch", "64", "--lr", "2e-05", "--seed", "197", "--stop-file", "/workspace/research/postloss.stop", "--loss-mode", "paired"], "status": "complete", "pid": 1280, "log": "/workspace/research/postloss_recovery3.log", "started_utc": "2026-10-23T02:48:16Z", "note": "Restart own E62 initialization after verified float32 variance-overflow correction; original seed and recipe unchanged.", "returncode": 0, "process_seconds": 810.3138020890765}, "outcome": "Both earlier3000 cutoffs regress; E83 saved-checkpoint composition remains in screening, E80 numerical control queued."} + +## E83 postloss+slowAR evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.666229724884033 seconds. +- Overall skill 0.380251; relative MASE 0.741085; relative WQL 0.518280. +- term skill: long=0.4038, medium=0.4070, short=0.3603. +- domain skill: Econ/Fin=0.1348, Energy=0.2414, Healthcare=0.4552, Nature=0.4344, Sales=0.3382, Transport=0.4643, Web/CloudOps=0.5059. +- frequency skill: A=0.3743, D=0.3567, H=0.4003, M=0.0763, Q=0.1987, S=0.4254, T=0.4419, W=0.2242. +- variates skill: multivariate=0.3980, univariate=0.3658. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.061537742614746 seconds. +- Overall skill 0.335421; relative MASE 0.797508; relative WQL 0.553807. +- term skill: long=0.3950, medium=0.3597, short=0.3013. +- domain skill: Econ/Fin=0.1640, Energy=0.2281, Healthcare=0.3974, Nature=0.3657, Sales=0.3962, Transport=0.3713, Web/CloudOps=0.4494. +- frequency skill: A=0.3211, D=0.3463, H=0.3688, M=0.1723, Q=0.2313, S=0.3404, T=0.3344, W=0.2853. +- variates skill: multivariate=0.3526, univariate=0.3214. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast2_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.91576099395752 seconds. +- Overall skill 0.360099; relative MASE 0.769700; relative WQL 0.531990. +- term skill: long=0.3671, medium=0.3869, short=0.3468. +- domain skill: Econ/Fin=0.1196, Energy=0.2390, Healthcare=0.3200, Nature=0.4758, Sales=0.5509, Transport=0.4203, Web/CloudOps=0.4338. +- frequency skill: A=0.3513, D=0.4228, H=0.3920, M=0.1454, Q=0.1495, S=0.2810, T=0.3646, W=0.2628. +- variates skill: multivariate=0.3658, univariate=0.3555. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast3_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 23.31220841407776 seconds. +- Overall skill 0.389069; relative MASE 0.739022; relative WQL 0.505041. +- term skill: long=0.3936, medium=0.3628, short=0.3969. +- domain skill: Econ/Fin=0.1785, Energy=0.3245, Healthcare=0.2109, Nature=0.5039, Sales=0.4010, Transport=0.5082, Web/CloudOps=0.3908. +- frequency skill: A=0.3606, D=0.4409, H=0.4062, M=0.1151, Q=0.2596, S=0.2759, T=0.4323, W=0.2589. +- variates skill: multivariate=0.3734, univariate=0.4011. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +E83 CPU composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb"}, "seconds": 1.0092943429481238} + +## E83 postprocessing-aware3000 plus slowAR6000 full public-package replay +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.376131; relative MASE 0.743936; relative WQL 0.523180. +- term skill: long=0.3978, medium=0.4059, short=0.3557. +- domain skill: Econ/Fin=0.1127, Energy=0.2338, Healthcare=0.4604, Nature=0.4345, Sales=0.3517, Transport=0.4644, Web/CloudOps=0.4981. +- frequency skill: A=0.2909, D=0.3608, H=0.3952, M=0.1011, Q=0.1844, S=0.4254, T=0.4346, W=0.2165. +- variates skill: multivariate=0.3936, univariate=0.3619. +- Outcome: Publish as best full primary validation: skill0.376130733 versus E76 0.375612348; relMASE0.743936224 and relWQL0.523180415, 97 configurations/151170 instances, zero failures. Public inference120.396952s; independent relocation14.861885s gave bitwise equal finite ordered forecasts on three examples. All three earlier cutoffs regress versus E76, so this is a narrow primary-validation selection, not evidence of broad temporal improvement. Keep E76 as the more stable rollback. No training in this composition; coefficient1.0 fixed, source training seeds197/79; hashes and parent compute above. E80 numerical-only control remains queued. + +E83 descriptive cluster comparison: {"candidate": "/workspace/research/valid-report-postloss-slow-ar.json", "parent": "/workspace/research/valid-report-slow-ar-delta6k.json", "candidate_hash": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "parent_hash": "8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105", "skill_difference": 0.0005183850211532004, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 51, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": -0.0027720070621055277, "p50": 0.0002985771391603165, "p975": 0.004193731829011101}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E58/E66 recovered146M at global24000 +- Checkpoint SHA-256: `8f9a786a85c8fcd3d4aaba9e5651a68b6f2df74d5cdc0e30907a4293dd297492`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 37.02190327644348 seconds. +- Overall skill 0.375978; relative MASE 0.744657; relative WQL 0.522931. +- term skill: long=0.4006, medium=0.4073, short=0.3537. +- domain skill: Econ/Fin=0.1411, Energy=0.2353, Healthcare=0.4235, Nature=0.4300, Sales=0.3398, Transport=0.4674, Web/CloudOps=0.5021. +- frequency skill: A=0.3775, D=0.3521, H=0.3962, M=0.0785, Q=0.2030, S=0.4233, T=0.4372, W=0.2148. +- variates skill: multivariate=0.3957, univariate=0.3598. +- Outcome: Matched 37M control24000 is0.375680951 and original E47parent0.375792930. Widened model0.375977511 is modestly higher; continue planned32000, no publication against stronger E83. Seed113 then recovery reset179, batch96, baseLR3e-5; complete recovery retained. + +## E73 independent feature stream first4000 +- Checkpoint SHA-256: `c16f146c285d9e5c8c9ae60e54af3d9d1dae3f48e1cf2104e37676062df8ad5e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.91307091712952 seconds. +- Overall skill 0.372085; relative MASE 0.750057; relative WQL 0.525664. +- term skill: long=0.3976, medium=0.4060, short=0.3484. +- domain skill: Econ/Fin=0.1401, Energy=0.2348, Healthcare=0.4070, Nature=0.4248, Sales=0.3416, Transport=0.4634, Web/CloudOps=0.4971. +- frequency skill: A=0.3733, D=0.3439, H=0.3937, M=0.0971, Q=0.1987, S=0.4185, T=0.4336, W=0.2014. +- variates skill: multivariate=0.3914, univariate=0.3563. +- Outcome: Main0.372084568 regresses versus own function-preserving initialization0.375792503 and original-width parent. New-stream usage was nonzero at2000; use planned8000 to distinguish transient feature learning from persistent degradation. Seed113/B96/LR3e-5, compiled static loss; no publication. + +## E78 multiscale AR first1000 +- Checkpoint SHA-256: `a3c57dba6318728692a87990bf652a9a8469fa4fb24bf925e79a6f72510936d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.617778062820435 seconds. +- Overall skill 0.377072; relative MASE 0.744319; relative WQL 0.521335. +- term skill: long=0.3993, medium=0.4061, short=0.3568. +- domain skill: Econ/Fin=0.1341, Energy=0.2362, Healthcare=0.4612, Nature=0.4310, Sales=0.3345, Transport=0.4671, Web/CloudOps=0.4985. +- frequency skill: A=0.3662, D=0.3563, H=0.3950, M=0.1046, Q=0.1987, S=0.4232, T=0.4355, W=0.2248. +- variates skill: multivariate=0.3928, univariate=0.3643. +- Outcome: Main0.377071682 is effectively tied with E77 single slowAR1000 at0.377046018 and above E67 original AR1000 at0.376859515. Early checkpoint, continue matched3000/6000/12000. Seed197, extraRNG700200, B64/LR2e-5, unchanged corpus and main/horizon RNG. + +## E84 daily and weekly aggregation of permitted real series +Hypothesis: the original two/four-fold aggregation rarely exposes coarse energy and other dynamics. On20% of real rows, independently consider a daily or weekly block average of the same allowed series at the original cutoff. Only exact integral frequency ratios are used; require8 context blocks and1 future block. Select equally among eligible daily/weekly choices. Finite-value averages use float64 sums and disjoint past/future blocks. Context and target can be shorter than requested and remain masked; periods become[7,365] or[52,1]. All original sampling/random draws and original local synthetic windows remain unchanged; extra RNGseed900200. Planned own E62 initialization, seed197, paired B64, LR2e-5/12000steps match E67. This tests coarser real-series augmentation, not additional external data. Queue after E77 to stay within one H100. +Training-only fixture: {"seed": 197, "aggregation_seed": 900200, "diagnostic_shapes_seed": 331, "cpu_seconds": 3.8464299628976732, "rows": 4096, "aggregated_rows": 459, "main_and_horizon_rng_matched": true, "nonaggregated_rows_bitwise_equal": true, "changing_future_does_not_change_context": true, "before_period_counts": {"(24, 168)": 932, "(1440, 10080)": 160, "(288, 2016)": 805, "(12, 1)": 214, "(48, 336)": 249, "(4, 1)": 235, "(7, 365)": 513, "(96, 672)": 244, "(52, 1)": 148, "(144, 1008)": 149, "(2, 91)": 5, "(1, 1)": 153, "(900, 21600)": 23, "(360, 8640)": 73, "(4, 28)": 54, "(12, 84)": 30, "(720, 5040)": 14, "(6, 42)": 24, "(360, 2520)": 7, "(450, 10800)": 3, "(72, 504)": 51, "(4, 182)": 6, "(36, 252)": 3, "(1, 7)": 1}, "after_period_counts": {"(52, 1)": 352, "(1440, 10080)": 131, "(288, 2016)": 692, "(12, 1)": 214, "(48, 336)": 231, "(4, 1)": 235, "(7, 365)": 704, "(96, 672)": 223, "(24, 168)": 778, "(1, 1)": 153, "(900, 21600)": 23, "(360, 8640)": 73, "(144, 1008)": 133, "(4, 28)": 38, "(12, 84)": 26, "(720, 5040)": 10, "(360, 2520)": 6, "(450, 10800)": 3, "(72, 504)": 41, "(2, 91)": 3, "(4, 182)": 6, "(36, 252)": 3, "(6, 42)": 17, "(1, 7)": 1}, "factor_counts": {"168": 73, "288": 97, "2016": 37, "7": 66, "1440": 26, "24": 90, "48": 14, "96": 20, "28": 12, "144": 4, "336": 6, "4": 4, "10080": 8, "1008": 1, "672": 1}, "aggregated_context_percentiles": [8.0, 48.0, 4096.0], "aggregated_target_percentiles": [1.0, 60.0, 1024.0], "optimizer_updates": 0} + +## E71 patch8 at6000 +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.29093050956726 seconds. +- Overall skill 0.381179; relative MASE 0.741215; relative WQL 0.516638. +- term skill: long=0.4036, medium=0.4049, short=0.3630. +- domain skill: Econ/Fin=0.1328, Energy=0.2446, Healthcare=0.4760, Nature=0.4387, Sales=0.3481, Transport=0.4598, Web/CloudOps=0.5005. +- frequency skill: A=0.3764, D=0.3587, H=0.3961, M=0.1191, Q=0.1895, S=0.4235, T=0.4409, W=0.2396. +- variates skill: multivariate=0.3970, univariate=0.3683. +- Outcome: Main0.381178739 exceeds matched E67paired6000 0.378455389 and selected E83main0.380250568. Test all three earlier cutoffs and full public replay before publication. Architecture change only; seed197/B64/LR2e-5; checkpoints resumed with full optimizer and RNG state. + +## E77 paired slowAR at3000 +- Checkpoint SHA-256: `0691cb2a1f55203c949dcdd159bc9da17d56a3cccbba57fa2c61a9f74b769376`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.542114734649658 seconds. +- Overall skill 0.378238; relative MASE 0.743200; relative WQL 0.520166. +- term skill: long=0.4019, medium=0.4056, short=0.3580. +- domain skill: Econ/Fin=0.1408, Energy=0.2382, Healthcare=0.4444, Nature=0.4319, Sales=0.3325, Transport=0.4662, Web/CloudOps=0.5040. +- frequency skill: A=0.3686, D=0.3549, H=0.3971, M=0.0926, Q=0.1967, S=0.4234, T=0.4392, W=0.2222. +- variates skill: multivariate=0.3972, univariate=0.3627. +- Outcome: Main0.378238485 is slightly below original E67paired3000 0.378318033; continue planned6000 before choosing. Seed197/B64/LR2e-5, main and requested-horizon sampling matched. + +## E85 transfer the slow-AR correction to the finer-patch model +E71patch8 at6000 improves the main screen and first earlier cutoff. E76 previously showed a matched slow-AR6000 correction improves all four cutoffs on patch16. Test one fixed composition: patch8_6000 + fold16to8(slowAR6000 - partial6000), where the linear fold is exactly E71 initialization: sum projection halves, retain first8 output positions, other tensors unchanged. Confidence parameters remain those of patch8. This is a transfer hypothesis, not exact function preservation. Coefficient1 with no sweep, original inference rules, all four cutoffs before full replay/publication. No new optimizer updates or random draws; original training seeds197 and79. Script patch8_delta/merge.py and all parent hashes retained. + +## E86 learn the added feature stream while freezing inherited parameters — prepared +E73 at4000 underperforms its function-preserving starting model despite using the new stream. Hypothesis: a low-rate update of every parameter disturbs the mature function while learning the random additions too slowly. Reuse exactly E73 independent-stream initialization, but protect all36,800,800 inherited entries and train the109,676,544 new/cross-stream entries atLR2e-4 for8000steps. Original seed113/B96/source/context/horizon/loss unchanged. This changes trainable scope and learning rate together and is a method comparison, not a one-factor causal attribution. Gradient entries for protected blocks are zeroed before clipping; inherited values are restored after AdamW to cancel its weight decay. References reconstruct from the saved checkpoint on resume. All outputs still come from one146M model; inference has no adaptation or freezing machinery. Await E73next8000 before allocation. +Fixture on6 allowed-corpus windows, discarded copy only: {"cpu_seconds": 8.51362281711772, "seed": 347, "optimizer_updates_on_discarded_fixture_copy": 3, "allowed_corpus_windows": 6, "protected_parameters": 36800800, "trainable_parameters": 109676544, "all_inherited_parameters_bitwise_equal_to_parent": true, "recovery_reference_reconstruction_equal": true, "new_head_max_change": 0.0006009560311213136, "losses": [0.3154084384441376, 0.5418640375137329, 3.4678804874420166], "selection_checkpoint_written": false} + +## E71 patch8 at6000 first earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 31.848629474639893 seconds. +- Overall skill 0.337263; relative MASE 0.796725; relative WQL 0.551283. +- term skill: long=0.4004, medium=0.3547, short=0.3044. +- domain skill: Econ/Fin=0.1652, Energy=0.2281, Healthcare=0.4272, Nature=0.3699, Sales=0.4068, Transport=0.3692, Web/CloudOps=0.4462. +- frequency skill: A=0.3305, D=0.3545, H=0.3635, M=0.2050, Q=0.2352, S=0.3470, T=0.3351, W=0.2877. +- variates skill: multivariate=0.3553, univariate=0.3226. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 second earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 30.961294412612915 seconds. +- Overall skill 0.360620; relative MASE 0.769294; relative WQL 0.531405. +- term skill: long=0.3643, medium=0.3909, short=0.3471. +- domain skill: Econ/Fin=0.1073, Energy=0.2373, Healthcare=0.3614, Nature=0.4729, Sales=0.5535, Transport=0.4233, Web/CloudOps=0.4312. +- frequency skill: A=0.3265, D=0.4302, H=0.3900, M=0.1513, Q=0.1529, S=0.2830, T=0.3613, W=0.2737. +- variates skill: multivariate=0.3599, univariate=0.3612. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 third earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 30.769143104553223 seconds. +- Overall skill 0.384513; relative MASE 0.743664; relative WQL 0.509403. +- term skill: long=0.3930, medium=0.3668, short=0.3880. +- domain skill: Econ/Fin=0.1775, Energy=0.3064, Healthcare=0.2392, Nature=0.5093, Sales=0.3974, Transport=0.5038, Web/CloudOps=0.3894. +- frequency skill: A=0.3445, D=0.4405, H=0.4005, M=0.1373, Q=0.2471, S=0.2972, T=0.4240, W=0.2382. +- variates skill: multivariate=0.3641, univariate=0.4002. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 full public-package replay +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.377160; relative MASE 0.744341; relative WQL 0.521172. +- term skill: long=0.3977, medium=0.4038, short=0.3585. +- domain skill: Econ/Fin=0.1125, Energy=0.2381, Healthcare=0.4791, Nature=0.4387, Sales=0.3613, Transport=0.4600, Web/CloudOps=0.4920. +- frequency skill: A=0.2981, D=0.3626, H=0.3904, M=0.1423, Q=0.1804, S=0.4235, T=0.4341, W=0.2328. +- variates skill: multivariate=0.3923, univariate=0.3649. +- Outcome: Publish strongest full primary candidate: skill0.377160271, relMASE0.744340532 and relWQL0.521171845; 97 configurations/151170 instances and zero failures. Inference149.631765s under shared H100; relocation14.860671s, three configurations bitwise equal, finite and ordered. Earlier cutoffs1/2 improve but cutoff3 falls to0.384512704 from E83 0.389069333. This selection is based on primary full validation, with a material earlier-window tradeoff. Seed197/B64/LR2e-5; model36,665,488 parameters. Training continues to12000; E85slowAR transfer currently lowers main skill. + +E71 descriptive full comparison: {"candidate": "/workspace/research/valid-report-patch8-6k.json", "parent": "/workspace/research/valid-report-postloss-slow-ar.json", "candidate_hash": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "parent_hash": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "skill_difference": 0.001029538022933929, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 51, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": -0.0037342410536253257, "p50": 0.0011012262742491896, "p975": 0.005930261648940039}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E87 equal ensemble of postloss+slowAR and patch8_6000 +E71 improves full and first two earlier scores but regresses on the third. Its per-configuration differences against E83 run in both directions. Test a single predeclared equal average of their final quantiles, every member on every instance, to reduce these disagreements. No coefficient sweep or per-dataset rules; no additional training. Screen all four cutoffs with cached forecasts, then require a complete public-package replay if promising. Member hashes0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49 and308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988. + +E87 cached valid_screen: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.38368555666405846, "rel_mase_gmean": 0.7380746260326486, "rel_wql_gmean": 0.5146410398989778, "groups": {"term": {"short": 0.36538266249250273, "medium": 0.4082837973759923, "long": 0.4054283252594051}, "domain": {"Econ/Fin": 0.13784772212566998, "Energy": 0.24686600590076013, "Healthcare": 0.4744445530216731, "Nature": 0.43858582844670857, "Sales": 0.34499044135263635, "Transport": 0.4641713711179224, "Web/CloudOps": 0.504852655777996}, "freq": {"A-DEC": 0.37872174128763647, "Q-DEC": 0.19576783224250183, "M": 0.10352329460914667, "W-SUN": 0.0815487165237122, "D": 0.3619759620437517, "H": 0.40136898241411867, "15T": 0.21618729924976976, "W-FRI": 0.0005727425187482815, "10T": 0.6270627319464949, "W-TUE": 0.6195479435809044, "W-THU": 0.20656160899192244, "W-WED": 0.3284622519828829, "5T": 0.5178170596317864, "10S": 0.4250896621077831}}, "cpu_seconds": 0.8467225290369242, "members": ["/workspace/research/evals/postloss_slow_ar_delta6k", "/workspace/research/evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.33897078175106665, "rel_mase_gmean": 0.7947425391953629, "rel_wql_gmean": 0.549812808335635, "groups": {"term": {"short": 0.30566345086890123, "medium": 0.3596853813715456, "long": 0.4000253823922667}, "domain": {"Econ/Fin": 0.16860733481230095, "Energy": 0.23127409233361262, "Healthcare": 0.41508771848830917, "Nature": 0.3697364579642294, "Sales": 0.40314036211800997, "Transport": 0.3731226096810256, "Web/CloudOps": 0.44992972632456585}, "freq": {"A-DEC": 0.32848231511958337, "Q-DEC": 0.23562309290129158, "M": 0.19041732638938724, "W-SUN": 0.025351943698138202, "D": 0.3534437856481293, "H": 0.3688302027123801, "15T": 0.22312808413257845, "W-FRI": 0.2396493514491056, "10T": 0.3237622247956604, "W-TUE": 0.5543034150109358, "W-THU": 0.2604484095221261, "W-WED": 0.35736004737028026, "5T": 0.4409641017446271, "10S": 0.3450492950879055}}, "cpu_seconds": 0.7932982260826975, "members": ["/workspace/research/backcast_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast_evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast2: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.36315845377936284, "rel_mase_gmean": 0.7669826024462578, "rel_wql_gmean": 0.5287827307935709, "groups": {"term": {"short": 0.3500710560941004, "medium": 0.39152062222827344, "long": 0.36789234736191556}, "domain": {"Econ/Fin": 0.11764473029610945, "Energy": 0.2411172995160572, "Healthcare": 0.3456990033484809, "Nature": 0.4766227701429041, "Sales": 0.5542499449658524, "Transport": 0.4240681895536792, "Web/CloudOps": 0.43520532523252287}, "freq": {"A-DEC": 0.3426922609629939, "Q-DEC": 0.15231664461723582, "M": 0.15186824306557356, "W-SUN": 0.05088825731569291, "D": 0.4296455306851713, "H": 0.39379373998466227, "15T": 0.10856607437428756, "W-FRI": 0.14720063917754334, "10T": 0.5085351252790775, "W-TUE": 0.07220161720253104, "W-THU": 0.3450882445488662, "W-WED": 0.5601701661454508, "5T": 0.47180636145224786, "10S": 0.2848018841721206}}, "cpu_seconds": 0.8004084089770913, "members": ["/workspace/research/backcast2_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast2_evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast3: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3893067316884232, "rel_mase_gmean": 0.7388677045007551, "rel_wql_gmean": 0.5047537816165226, "groups": {"term": {"short": 0.3954965650939142, "medium": 0.3665319698411411, "long": 0.3951340525388045}, "domain": {"Econ/Fin": 0.18260879016430553, "Energy": 0.31821834617690903, "Healthcare": 0.23007490883688486, "Nature": 0.5085775372702099, "Sales": 0.40095301819850215, "Transport": 0.5083874509785007, "Web/CloudOps": 0.39193111101214995}, "freq": {"A-DEC": 0.3560016768547195, "Q-DEC": 0.2553722438340734, "M": 0.12861913252670398, "W-SUN": 0.15123578049216402, "D": 0.44398634475249976, "H": 0.40571804459976457, "15T": 0.25382261362712966, "W-FRI": 0.03470000993227129, "10T": 0.6063950584074473, "W-TUE": 0.24994144625076442, "W-THU": 0.35649129369337096, "W-WED": 0.3788996637883131, "5T": 0.4648714119960353, "10S": 0.2886025572123534}}, "cpu_seconds": 0.7890921849757433, "members": ["/workspace/research/backcast3_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast3_evals/patch8_ema6000"], "selection_only": true} + +E87 cached equal ensemble improves all four cutoffs over both members:0.383686/0.338971/0.363158/0.389307. Assemble exact per-member model code and start full public-package validation. No coefficient search or new optimization. + +## E88 matched late slow-AR continuation of patch8 — prepared +E71patch8 improves primary validation, while mapping the E61slowAR weight correction onto it lowers the main screen. Test direct training instead: preserve E71 complete model/EMA/AdamW/RNG/prefetched-batch state exactly at8000, then continue to12000 with only the synthetic AR coefficient law changed fromU(.2,.995) toexp(-10**(-U(0,4))). Reuse the already verified E77 data implementation and E71 model. All corpus windows, signs, horizon prefixes, batch64, seed197, original LR2e-5 cosine schedule and optimizer state stay matched. The saved prefetched batch is consumed once unchanged, so the changed generator starts with the following batch. No new random initialization, external data or validation training. Queue after E69 volatility releases its memory. Compare the unchanged E71 final12000 and the candidate; screen9000/12000 and earlier cutoffs for promising results. + +## E85 patch8 slowAR correction evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.3618426322937 seconds. +- Overall skill 0.379635; relative MASE 0.743623; relative WQL 0.517537. +- term skill: long=0.4040, medium=0.4057, short=0.3597. +- domain skill: Econ/Fin=0.1422, Energy=0.2420, Healthcare=0.4441, Nature=0.4393, Sales=0.3494, Transport=0.4592, Web/CloudOps=0.5028. +- frequency skill: A=0.3775, D=0.3606, H=0.3953, M=0.0567, Q=0.1914, S=0.4261, T=0.4427, W=0.2368. +- variates skill: multivariate=0.3979, univariate=0.3647. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 32.34789538383484 seconds. +- Overall skill 0.339493; relative MASE 0.792721; relative WQL 0.550345. +- term skill: long=0.4006, medium=0.3577, short=0.3072. +- domain skill: Econ/Fin=0.1745, Energy=0.2254, Healthcare=0.4254, Nature=0.3780, Sales=0.4071, Transport=0.3673, Web/CloudOps=0.4527. +- frequency skill: A=0.3339, D=0.3537, H=0.3634, M=0.2145, Q=0.2368, S=0.3480, T=0.3408, W=0.2893. +- variates skill: multivariate=0.3590, univariate=0.3235. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast2_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 31.240530729293823 seconds. +- Overall skill 0.363604; relative MASE 0.765287; relative WQL 0.529214. +- term skill: long=0.3689, medium=0.3919, short=0.3503. +- domain skill: Econ/Fin=0.1175, Energy=0.2366, Healthcare=0.3619, Nature=0.4770, Sales=0.5513, Transport=0.4209, Web/CloudOps=0.4416. +- frequency skill: A=0.3278, D=0.4365, H=0.3885, M=0.1369, Q=0.1530, S=0.2924, T=0.3673, W=0.2792. +- variates skill: multivariate=0.3657, univariate=0.3619. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast3_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 30.950783491134644 seconds. +- Overall skill 0.384319; relative MASE 0.743701; relative WQL 0.509698. +- term skill: long=0.3926, medium=0.3666, short=0.3878. +- domain skill: Econ/Fin=0.1844, Energy=0.3057, Healthcare=0.2112, Nature=0.5108, Sales=0.3977, Transport=0.5024, Web/CloudOps=0.3936. +- frequency skill: A=0.3446, D=0.4387, H=0.3996, M=0.1104, Q=0.2522, S=0.2976, T=0.4263, W=0.2439. +- variates skill: multivariate=0.3656, univariate=0.3987. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E69 stochastic volatility first3000 +- Checkpoint SHA-256: `f68cd2d694ecf03ff038c6a2f49657eb2f211f213d68c7dec3ed5cc0c5592c5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.498825311660767 seconds. +- Overall skill 0.359482; relative MASE 0.763227; relative WQL 0.537539. +- term skill: long=0.3909, medium=0.4022, short=0.3296. +- domain skill: Econ/Fin=0.1126, Energy=0.1841, Healthcare=0.4243, Nature=0.4229, Sales=0.3462, Transport=0.4587, Web/CloudOps=0.5052. +- frequency skill: A=0.3751, D=0.3459, H=0.3825, M=0.1061, Q=0.1992, S=0.4403, T=0.3990, W=0.2102. +- variates skill: multivariate=0.3912, univariate=0.3331. +- Outcome: Main0.359481571 exceeds matched E42partial3000 0.358812323, while E61slowAR3000 was0.360587999. Continue6000 to assess persistence before transfer or earlier-window selection. Seed79/B256/LR5e-5, independent generatorRNG500082, same real windows. + +## E78 multiscale AR at3000 +- Checkpoint SHA-256: `185d1a3d5d32a3cad539fb3a83bf98ae06a56606a35bafaf8deecd75c8b496d1`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.39926815032959 seconds. +- Overall skill 0.378048; relative MASE 0.743609; relative WQL 0.520198. +- term skill: long=0.4028, medium=0.4059, short=0.3572. +- domain skill: Econ/Fin=0.1377, Energy=0.2383, Healthcare=0.4460, Nature=0.4316, Sales=0.3318, Transport=0.4664, Web/CloudOps=0.5035. +- frequency skill: A=0.3675, D=0.3526, H=0.3972, M=0.1004, Q=0.1981, S=0.4242, T=0.4386, W=0.2228. +- variates skill: multivariate=0.3966, univariate=0.3629. +- Outcome: Main0.378048480 is slightly below E77single slowAR3000 0.378238485 and E67original AR3000 0.378318033. Continue planned6000; no publication or evidence of a gain yet. Seed197/B64/LR2e-5, extraRNG700200, main/horizon draws matched. + +E85 exact composition receipt: { + "method": "matched training delta with fixed linear patch conversion", + "formula": "patch8_base + fold16to8(slowAR6000 - partial6000)", + "coefficient": 1.0, + "mapping": "sum input/query/recency halves; take first8 output positions; other tensors unchanged", + "exact_function_preservation": false, + "parent_hashes": { + "/workspace/research/runs/patch8/ema006000.pt": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0393919900525361, + "checkpoint_sha256": "7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4", + "optimizer_updates": 0 +} + +Measured checkpoint compute through current selection milestones: +```json +{ + "E71 patch8 selected6000": { + "phase_log": "patch8_recovery3.log", + "checkpoint_loop_record": { + "step": 6000, + "loss": 0.27341755777597426, + "seconds": 1302.8, + "lr": 1.2000000000000002e-05, + "grad_norm": 0.12276209145784378, + "context": 2048, + "horizon": 512 + }, + "prior_interrupted_logged_seconds": { + "initial_unsaved_attempt": 63.0, + "recovery2_last_logged2700_resumed_from2000": 770.0 + }, + "total_logged_process_loop_seconds_including_repeated_work": 2135.8 + }, + "E58 recoveredwide24000": { + "phase_log": "wide_capacity_146m_recovery_recovery3.log", + "checkpoint_loop_record": { + "step": 24000, + "loss": 0.3451157429814339, + "seconds": 1117.3, + "lr": 9.51471862576143e-06, + "grad_norm": 0.31578314304351807, + "context": 2048, + "horizon": 1024 + } + }, + "E73 graft4000": { + "phase_log": "wide_graft_recovery3.log", + "checkpoint_loop_record": { + "step": 4000, + "loss": 0.34949749410152436, + "seconds": 1146.4, + "lr": 2.908655439013544e-05, + "grad_norm": 0.47331908345222473, + "context": 1024, + "horizon": 1024 + } + }, + "E69 volatility3000": { + "phase_log": "volatility_synth_recovery3.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.33109228551387787, + "seconds": 977.8, + "lr": 4.4142135623730954e-05, + "grad_norm": 0.13540834188461304, + "context": 2048, + "horizon": 1024 + } + }, + "E77 pairedslowAR3000": { + "phase_log": "paired_long_memory_recovery3.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.31684702143073085, + "seconds": 624.8, + "lr": 1.765685424949238e-05, + "grad_norm": 1.3133997917175293, + "context": 2048, + "horizon": 1024 + } + }, + "E78 multiscale3000": { + "phase_log": "multiscale_ar_train.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.3144953328371048, + "seconds": 637.3, + "lr": 1.765685424949238e-05, + "grad_norm": 1.2501322031021118, + "context": 2048, + "horizon": 1024 + } + }, + "note": "These are concurrent training-process loop measurements on the one H100, not exclusive GPU seconds. Prefix records exclude startup and may exclude unlogged tails before operator interruption. Earlier parent training is recorded separately in the lineage experiments." +} +``` + +E88 launcher correction: naming the launcher queue.py shadowed Python standard-library queue during Torch import, causing a circular-import failure before snapshotting or training. Renamed it launch.py and restarted while E71recovery8000 was still present. Also renamed the E84launcher to avoid the same import hazard in future sampler checks. Existing E84 queued process is unchanged. No optimizer updates or validation results were affected. + +E88 preserved complete exact8000 state: { + "snapshot": "/workspace/research/patch8_recovery008000.pt", + "step": 8000, + "sha256": "2fa4b6f18df4a5f2eed7e1bc153f8f5e3755584305569db42e047f3b1312f5d5", + "snapshot_process_seconds_including_wait": 2.3576558139175177, + "prefetched_batch_preserved": true +} + +## E87 equal patch16/patch8 ensemble complete public-package replay +- Checkpoint SHA-256: `65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.379630; relative MASE 0.741025; relative WQL 0.519360. +- term skill: long=0.3995, medium=0.4072, short=0.3609. +- domain skill: Econ/Fin=0.1168, Energy=0.2399, Healthcare=0.4788, Nature=0.4386, Sales=0.3583, Transport=0.4643, Web/CloudOps=0.4967. +- frequency skill: A=0.2977, D=0.3660, H=0.3960, M=0.1275, Q=0.1843, S=0.4251, T=0.4366, W=0.2280. +- variates skill: multivariate=0.3954, univariate=0.3668. +- Outcome: Publish strongest replayable candidate: full skill0.379629893, relMASE0.741025239, relWQL0.519360272; 97 configurations/151170 instances, zero failures. Both members forecast every instance with fixed .5/.5 weights, total73,466,288 parameters. Full inference229.446591s on the shared H100, relocation22.524727s with bitwise-equal finite ordered forecasts on3 examples. Actual package quantiles are bitwise equal to the independent member average on electricity hourly short, solar minute short and ETT2hourly long. Cached diagnostic skill0.383685557/0.338970782/0.363158454/0.389306732 exceeds each member at all four cutoffs. No additional training or coefficient sweep; member training seeds/compute recorded above. + +E87 composition verification: { + "cpu_seconds": 0.016339811962097883, + "comparisons": [ + { + "config_id": "electricity__H__short", + "shape": [ + 370, + 1, + 9, + 48 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + }, + { + "config_id": "solar__T__short", + "shape": [ + 137, + 1, + 9, + 48 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + }, + { + "config_id": "ett2__H__long", + "shape": [ + 1, + 7, + 9, + 720 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + } + ], + "no_new_inference_or_training": true +} + +E87 descriptive cluster comparison: {"candidate": "/workspace/research/valid-report-mixed-patch-ensemble.json", "parent": "/workspace/research/valid-report-patch8-6k.json", "candidate_hash": "65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d", "parent_hash": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "skill_difference": 0.002469622689308837, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 53, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": 0.0003627411169234291, "p50": 0.002411418344102745, "p975": 0.004671754347801495}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/README.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6db0596782f2075953d11a982b7fd65c429c49a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/README.md @@ -0,0 +1,9 @@ +# Two-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains two locally trained models totaling 73,466,288 parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed weights 0.5/0.5. + +Both members use4096-point history, with16-point and8-point patches respectively. Each member retains its own original model implementation and normalization; the first has a float64 fallback for nonfinite float32 context statistics. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary has fixed width128, and the zero projection threshold is0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/config.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/config.json new file mode 100644 index 0000000000000000000000000000000000000000..51eca79f5953f4f5ada685b2a4036f1ed471ef3a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/config.json @@ -0,0 +1,45 @@ +{ + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "parameters": 36800800, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + } + ], + "weights": [ + 0.5, + 0.5 + ], + "composition": "mean after each member applies its fixed inference rules" +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/continuity.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/continuity.py new file mode 100644 index 0000000000000000000000000000000000000000..bebb06b9c20f322b9d5564650889e2236ae94494 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/continuity.py @@ -0,0 +1,18 @@ +"""Fixed continuity prior for histories whose adjacent samples change slowly.""" +import numpy as np + +def apply_continuity(ctx,quant,tau=24.): + b,_,h=quant.shape + bias=np.zeros(b,np.float32) + positive=((ctx>=0)|~np.isfinite(ctx)).all(-1) + for i in range(b): + x=ctx[i,-512:].astype(np.float64) + if len(x)<8 or not np.isfinite(x[-1]):continue + diff=np.diff(x) + if np.isfinite(diff).sum()<8 or not np.isfinite(diff[-8:]).any():continue + ratio=np.nanmean(diff*diff)/(np.nanvar(x)+1e-12) + weight=float(np.clip(1-ratio/.5,0,.95)) + bias[i]=weight*(x[-1]+np.nanmedian(diff[-8:])-quant[i,4,0]) + out=quant+bias[:,None,None]*np.exp(-np.arange(h)/tau)[None,None,:] + out=np.where(positive[:,None,None],np.maximum(0,out),out) + return out.astype(np.float32) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model0.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model0.py new file mode 100644 index 0000000000000000000000000000000000000000..014b585df72cc69852a8eedf302320b52fe55aad --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model0.py @@ -0,0 +1,216 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model1.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model1.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model1.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..d2ea4e61a0cedc2049adba038b6d00a2ab4eb306 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/model_manifest.json @@ -0,0 +1,682 @@ +{ + "name": "direct-seasonal-two-patch-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 73466288, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "parameters": 36800800, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + } + ], + "checkpoint_sha256": "65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d", + "checkpoint_digest_method": "SHA-256 of config.json, including ordered member weight hashes", + "training_lineage": [ + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + } + ], + "ensemble_weights": [ + 0.5, + 0.5 + ], + "every_member_forecasts_every_instance": true, + "postprocessing_order": "each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4; then equal quantile average", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "model0.py": "d4b76fb1a63789e091b114dd947abe30be3e47c2e2e9d41cecb3e3353af86ac5", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "predict.py": "91a5bedfa5e1b13a0276771e5cf3a46971f3f4d4c06cb14aa1634c70ca7a506a", + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "model1.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e" + }, + "notes": "All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation." +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..12e473066a6ee446939182359d0540148c64854d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/predict.py @@ -0,0 +1,68 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import importlib.util +from seasonal import apply_gate +from continuity import apply_continuity +from zero_mass import project +import ts_io + +def load_model(checkpoint,device='cuda'): + from types import SimpleNamespace + path=Path(checkpoint);descriptor=json.loads(path.read_text());members=[] + for entry in descriptor['members']: + ck=torch.load(path.parent/entry['weights'],map_location='cpu',weights_only=False) + spec=importlib.util.spec_from_file_location('member_model_'+str(len(members)),path.parent/entry['model_code']) + module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) + model=module.DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval();members.append(model) + assert len(members)==2 + return SimpleNamespace(models=members,max_context=max(m.max_context for m in members)) + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + forecasts=[] + for member in model.models: + member_ctx=ctx[:,-member.max_context:] + member_x=x[:,-member.max_context:] + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16): + qq,mu,scale=member(torch.cat((member_x,-member_x),0),p.repeat(2,1),h) + qq=qq*scale[:,:,None]+mu[:,:,None] + qq=(qq[:len(ids)]-qq[len(ids):].flip(-1))*.5 + recent=member_x[:,-4096:] + positive=((recent>=0)|~torch.isfinite(recent)).all(-1) + qq=torch.where(positive[:,None,None],qq.clamp(min=0),qq) + q=qq.transpose(1,2).float().cpu().numpy() + q=apply_gate(member_ctx[:,-4096:],p.cpu().numpy(),q) + q=project(member_ctx,apply_continuity(member_ctx,q)) + forecasts.append(q) + q=(forecasts[0]+forecasts[1])*.5 + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'config.json'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..39b209306784e29bafb2d2428dfb3e940b5ff2dd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/model_manifest.json @@ -0,0 +1,659 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36800800, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "weights_sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "model.py": "d4b76fb1a63789e091b114dd947abe30be3e47c2e2e9d41cecb3e3353af86ac5" + }, + "checkpoint_composition": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 32768, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..95410ba700e638fc2e1375b14dece4df57c10110 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=np.exp(-10**(-r.uniform(0,4)));noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/train.py new file mode 100644 index 0000000000000000000000000000000000000000..61de733eea03837247278d9010c2ed8b955d7359 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/long_memory_synth/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + a.synthetic_ar_time_constants=[1,10000] + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/model.py new file mode 100644 index 0000000000000000000000000000000000000000..014b585df72cc69852a8eedf302320b52fe55aad --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/model.py @@ -0,0 +1,216 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/torch_post.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/torch_post.py new file mode 100644 index 0000000000000000000000000000000000000000..e19586bcc1677d56cedb6ce02c2f57797157f5f3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/postloss/torch_post.py @@ -0,0 +1,112 @@ +"""Differentiable forecast transforms with the package's fixed context rules. + +Context statistics are constants with respect to model parameters. Gradients +flow only through the forecast, including the continuity correction's anchor. +""" +import torch + + +@torch.no_grad() +def context_statistics(ctx, periods, horizon): + x=ctx.double(); finite=torch.isfinite(x); clean=torch.where(finite,x,0.) + b,c=x.shape; device=x.device + pos=torch.arange(c,device=device)[None,:] + count=finite.sum(-1).clamp(min=1) + mean=clean.sum(-1)/count + variance=(torch.where(finite,x-mean[:,None],0.).square()).sum(-1)/count + positive=((x>=0)|~finite).all(-1) + zeros=((x==0)&finite).sum(-1) + zero_active=positive&(zeros>=4)&(zeros/count>=.1) + cutoff=torch.where(zero_active,.4*variance.sqrt(),0.) + first=torch.where(finite,pos,c).min(-1).values + length=c-first + phase=torch.arange(max(1,c//3),device=device)[None,:] + future=torch.arange(horizon,device=device)[None,:] + z=torch.tensor([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0, + .2533471031,.5244005127,.8416212336,1.2815515655],device=device) + best_weight=torch.zeros(b,device=device,dtype=torch.float64) + prior=torch.zeros(b,horizon,9,device=device,dtype=torch.float64) + prior_valid=torch.zeros(b,horizon,device=device,dtype=torch.bool) + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + cycles=(length[:,None]//p).clamp(max=8) + history=finite&(pos>=c-cycles*p) + n=history.sum(-1).clamp(min=1) + center=(clean*history).sum(-1)/n + var=torch.where(history,x-center[:,None],0.).square().sum(-1)/n + previous=pos-p;safe=previous.clamp(min=0) + pairs=(previous>=c-cycles*p)&(previous>=0)&finite&finite.gather(1,safe) + pairs_count=pairs.sum(-1) + difference=clean-clean.gather(1,safe) + mse=(difference.square()*pairs).sum(-1)/pairs_count.clamp(min=1) + weight=(1-mse/(var+1e-12)/.25).clamp(0,.98) + eligible=(p[:,0]>=2)&(cycles[:,0]>=3)&(pairs_count>=p[:,0]) + weight=torch.where(eligible,weight,0.) + values=[];observed=[] + for cycle in range(4): + idx=c-p+phase-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(phase=0)&(cycle0 + template=(values*observed).sum(0)/nphase.clamp(min=1) + ntemplate=phase_valid.sum(-1).clamp(min=1) + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent=finite&(pos>=c-p) + nr=recent.sum(-1).clamp(min=1) + recent_mean=(clean*recent).sum(-1)/nr + template=template+(recent_mean-template_mean)[:,None] + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent_var=torch.where(recent,x-recent_mean[:,None],0.).square().sum(-1)/nr + template_var=((template-template_mean[:,None]).square()*phase_valid).sum(-1)/ntemplate + used_cycles=cycles[:,0].clamp(min=1,max=4) + noise=mse/2 + target_var=(recent_var-noise).clamp(min=0) + base_var=(template_var-noise/used_cycles).clamp(min=0) + ratio=(target_var/base_var.clamp(min=1e-12)).sqrt().clamp(.5,2.) + align=nr>=torch.maximum(torch.full_like(nr,2),.75*p[:,0]) + ratio=torch.where(align,ratio,1.) + template=template_mean[:,None]+(template-template_mean[:,None])*ratio[:,None] + sigma=(noise*(1+1/used_cycles)).sqrt() + index=(future%p).clamp(max=phase.shape[-1]-1) + selected=template.gather(1,index) + valid=phase_valid.gather(1,index) + q=selected[:,:,None]+sigma[:,None,None]*z[None,None,:] + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + choose=weight>best_weight + prior=torch.where(choose[:,None,None],q,prior) + prior_valid=torch.where(choose[:,None],valid,prior_valid) + best_weight=torch.maximum(best_weight,weight) + seasonal_weight=best_weight[:,None]*prior_valid + + recent=x[:,-512:];seen=torch.isfinite(recent) + n=seen.sum(-1).clamp(min=1);clean_recent=torch.where(seen,recent,0.) + center=clean_recent.sum(-1)/n + var=torch.where(seen,recent-center[:,None],0.).square().sum(-1)/n + differences=recent[:,1:]-recent[:,:-1] + diff_seen=torch.isfinite(differences);nd=diff_seen.sum(-1) + mse=torch.where(diff_seen,differences,0.).square().sum(-1)/nd.clamp(min=1) + tail=differences[:,-8:] + tail_seen=torch.isfinite(tail);nt=tail_seen.sum(-1) + sorted_tail=torch.where(tail_seen,tail,float('inf')).sort(-1).values + if tail.shape[-1]: + lo=((nt-1).clamp(min=0)//2)[:,None];hi=(nt//2).clamp(max=tail.shape[-1]-1)[:,None] + median=(sorted_tail.gather(1,lo)+sorted_tail.gather(1,hi))[:,0]/2 + else:median=torch.zeros(b,device=device,dtype=x.dtype) + continuity_weight=(1-mse/(var+1e-12)/.5).clamp(0,.95) + active=(nd>=8)&(nt>0)&seen[:,-1] + continuity_weight=torch.where(active,continuity_weight,0.) + anchor=torch.where(active,recent[:,-1]+median,0.) + return seasonal_weight,prior,continuity_weight,anchor,positive,cutoff + + +def apply_fixed(ctx,periods,quant): + """Quantiles are raw-scale tensors of shape (batch,horizon,9).""" + weight,prior,cweight,anchor,positive,cutoff=context_statistics(ctx,periods,quant.shape[1]) + q=torch.where(positive[:,None,None],quant.clamp(min=0),quant) + q=((1-weight[:,:,None])*q+weight[:,:,None]*prior).float() + bias=(cweight*(anchor-q[:,0,4])).float() + decay=torch.exp(-torch.arange(q.shape[1],device=q.device,dtype=torch.float64)/24) + q=(q.double()+bias[:,None,None]*decay[None,:,None]).float() + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return torch.where((q>=0)&(q8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..0b3bbf29f7f2d96a4e8c89e54f635c0171fe0446 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member0/training/recovery/train.py @@ -0,0 +1,130 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +a=ap.parse_args();sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='overflow_control':a.normalization_overflow_fallback=True +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':[a.initialize_ema] if a.initialize_ema else []} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=0 and step>a.reset_at else step + lr=a.lr*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/a.steps))) + for group in opt.param_groups:group['lr']=lr*group['lr_multiplier'] + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16): + loss=objective(model,x,y,p,paired=a.loss_mode=='paired') if a.loss_mode else objective(model,x,y,p) + loss.backward();norm=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(norm): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.monotonic()-started,1), + 'lr':lr,'grad_norm':float(norm),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with (out/'log.jsonl').open('a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=(a.stop_file and Path(a.stop_file).exists()) or (a.halt_after and step>=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9894508a5711da3218d3c11f8e038427757c2270 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/model_manifest.json @@ -0,0 +1,572 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36665488, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 16384, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..59444191c77e10f6bbad7d5a3c54d0c0aca5f55c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/member1/training/recovery/train.py @@ -0,0 +1,132 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +a=ap.parse_args();sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='overflow_control':a.normalization_overflow_fallback=True +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':[a.initialize_ema] if a.initialize_ema else []} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=0 and step>a.reset_at else step + lr=a.lr*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/a.steps))) + for group in opt.param_groups:group['lr']=lr*group['lr_multiplier'] + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16): + loss=objective(model,x,y,p,paired=a.loss_mode=='paired') if a.loss_mode else objective(model,x,y,p) + loss.backward();norm=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(norm): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.monotonic()-started,1), + 'lr':lr,'grad_norm':float(norm),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with (out/'log.jsonl').open('a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=(a.stop_file and Path(a.stop_file).exists()) or (a.halt_after and step>=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..1e84c23329d29a8949c7fa16b199a8c3bfb0ac58 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/provenance/publish.py @@ -0,0 +1,100 @@ +"""Assemble and atomically publish a complete two-member, fixed-weight package.""" +import argparse +import ctypes +import hashlib +import json +import os +import shutil +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ap = argparse.ArgumentParser() +ap.add_argument('--member', action='append', required=True) +ap.add_argument('--out', required=True) +ap.add_argument('--report') +ap.add_argument('--experiments', default='/workspace/research/direct_v1/EXPERIMENTS.md') +a = ap.parse_args() +assert len(a.member) == 2 +final = Path(a.out) +stage = final.parent / f'.{final.name}-staging-{os.getpid()}' +shutil.rmtree(stage, ignore_errors=True) +stage.mkdir(parents=True) + +def digest(path): + h = hashlib.sha256() + with Path(path).open('rb') as f: + for block in iter(lambda: f.read(8 * 1024 * 1024), b''): + h.update(block) + return h.hexdigest() + +for name in ('infer.sh', 'predict.py', 'model.py', 'seasonal.py', 'continuity.py', + 'zero_mass.py', 'ts_io.py'): + shutil.copy2(HERE / 'runtime' / name, stage / name) +shutil.copy2('/opt/runtime/requirements.txt', stage / 'requirements.txt') +shutil.copy2(a.experiments, stage / 'EXPERIMENTS.md') +members, sources, lineage = [], set(), {} +for i, source in enumerate(map(Path, a.member)): + manifest = json.loads((source / 'model_manifest.json').read_text()) + assert manifest['pretrained_assets'] == [] + name = f'member{i}.pt' + model_code = f'model{i}.py' + shutil.copy2(source / 'model.py', stage / model_code) + assert digest(stage / model_code) == manifest['runtime_code_sha256']['model.py'] + shutil.copy2(source / 'weights.pt', stage / name) + assert digest(stage / name) == manifest['weights_sha256'] + members.append({'weights': name, 'weights_sha256': manifest['weights_sha256'], + 'parameters': manifest['parameters'], 'config': manifest['config'], 'model_code': model_code}) + sources.update(manifest['sources_used']) + for item in manifest['training_lineage']: + lineage.setdefault(item['sha256'], item) + dst = stage / 'provenance' / f'member{i}' + dst.mkdir(parents=True) + shutil.copy2(source / 'model_manifest.json', dst / 'model_manifest.json') + shutil.copytree(source / 'provenance', dst / 'training') +shutil.copy2(__file__, stage / 'provenance' / 'publish.py') +descriptor = {'members': members, 'weights': [.5, .5], + 'composition': 'mean after each member applies its fixed inference rules'} +(stage / 'config.json').write_text(json.dumps(descriptor, indent=2) + '\n') +identifier = digest(stage / 'config.json') +manifest = { + 'name': 'direct-seasonal-two-patch-foundation', 'contract': 'timeseries-forecast/v1', + 'parameters': sum(m['parameters'] for m in members), 'pretrained_assets': [], + 'sources_used': sorted(sources), 'members': members, + 'checkpoint_sha256': identifier, + 'checkpoint_digest_method': 'SHA-256 of config.json, including ordered member weight hashes', + 'training_lineage': list(lineage.values()), 'ensemble_weights': [.5, .5], + 'every_member_forecasts_every_instance': True, + 'postprocessing_order': 'each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4; then equal quantile average', + 'runtime_code_sha256': {p.name: digest(p) for p in stage.iterdir() if p.suffix in ('.py', '.sh')}, + 'notes': 'All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation.', +} +(stage / 'model_manifest.json').write_text(json.dumps(manifest, indent=2) + '\n') +if a.report: + report = json.loads(Path(a.report).read_text()) + assert report['checkpoint_sha256'] == identifier + shutil.copy2(a.report, stage / 'validation_report.json') +else: + report = {'status': 'candidate validation pending'} + (stage / 'validation_report.json').write_text(json.dumps(report) + '\n') +if final.resolve() == Path('/workspace/submission').resolve(): + assert a.report and report['n_configs'] == 97 and report['n_instances'] == 151170 + assert report['n_failed'] == 0 +(stage / 'README.md').write_text(f'''# Two-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains two locally trained models totaling {manifest['parameters']:,} parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed weights 0.5/0.5. + +Both members use4096-point history, with16-point and8-point patches respectively. Each member retains its own original model implementation and normalization; the first has a float64 fallback for nonfinite float32 context statistics. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary has fixed width128, and the zero projection threshold is0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. +''') +if final.exists(): + libc = ctypes.CDLL(None, use_errno=True) + if libc.renameat2(-100, os.fsencode(stage), -100, os.fsencode(final), 2): + raise OSError(ctypes.get_errno(), os.strerror(ctypes.get_errno())) + shutil.rmtree(stage) +else: + os.replace(stage, final) +print(json.dumps({'out': str(final), 'checkpoint_sha256': identifier, + 'parameters': manifest['parameters']})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/requirements.txt b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca733199990e5dc8e6a90509cc691f00ab8e9f5d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/requirements.txt @@ -0,0 +1,12 @@ +# Runtime pins recorded from the contributor's working environment on 2026-09-17 (Python 3.11). +# torch comes from the pytorch/pytorch:2.14.0-cuda12.6-cudnn9-runtime base image (cu130 needs driver >= 580). +torch==2.14.0 +numpy==2.4.6 +h5py==3.16.0 +pandas==2.3.3 +scipy==1.17.1 +pyarrow==25.0.1 +huggingface-hub==0.36.2 +einops==0.8.2 +safetensors==0.8.0 +pytest==9.1.1 diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/seasonal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/seasonal.py new file mode 100644 index 0000000000000000000000000000000000000000..cd8d8ebbf65c59c69f3d1c537e8cd5cb024d0330 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/seasonal.py @@ -0,0 +1,51 @@ +"""A fixed confidence gate for highly repeatable history; no fitted parameters.""" +import numpy as np + +def apply_gate(ctx,periods,quant,threshold=.25,strength=1.,cycles=4,mode='aligned'): + # Each row uses only its own context. Quantile blending preserves ordering. + b,_,h=quant.shape + out=quant.copy() + for i in range(b): + x=ctx[i];valid=np.isfinite(x) + if not valid.any():continue + x=x[np.flatnonzero(valid)[0]:] + best=None + for p in periods[i]: + p=int(p) + if p<2 or len(x)<3*p:continue + k=min(len(x)//p,8);history=x[-k*p:] + pairs=np.isfinite(history[p:])&np.isfinite(history[:-p]) + if pairs.sum()0) + if mode in ('centered','aligned'): + mu=mu+np.nanmean(seasons[-1])-np.nanmean(mu) + if mode=='aligned' and np.isfinite(seasons[-1]).sum()>=max(2,.75*p): + noise=float(np.mean(err.astype(np.float64)**2)/2) + target_var=max(0.,float(np.nanvar(seasons[-1]))-noise) + template_var=max(0.,float(np.nanvar(mu))-noise/min(k,cycles)) + ratio=float(np.clip(np.sqrt(target_var/max(template_var,1e-12)),.5,2.)) + center=float(np.nanmean(mu));mu=center+(mu-center)*ratio + if mode=='exponential': + w=.5**np.arange(len(recent)-1,-1,-1,dtype=np.float32) + den=(w[:,None]*np.isfinite(recent)).sum(0) + mu=np.divide((w[:,None]*np.nan_to_num(recent)).sum(0),den,out=np.full(p,np.nan,np.float32),where=den>0) + # Error of a season relative to the previous one, corrected for averaging. + sigma=float(np.sqrt(np.mean(err.astype(np.float64)**2)/2*(1+1/min(k,cycles)))) + idx=np.arange(h)%p;median=mu[idx] + z=np.array([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0,.2533471031,.5244005127,.8416212336,1.2815515655]) + sq=median[None]+z[:,None]*sigma + sq=np.where(np.isfinite(sq),sq,quant[i]) + if np.nanmin(x)>=0:sq=np.maximum(0,sq) + best=(weight,sq) + if best is not None:out[i]=(1-best[0])*quant[i]+best[0]*best[1] + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..f27ce3890f2f79e13ea87856f41e27ec00b0eff5 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.3796298932618224, + "skill_score": 0.3796298932618224, + "rel_mase_gmean": 0.7410252389855017, + "rel_wql_gmean": 0.5193602715357281, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.7396644201381213, + "rel_wql_gmean": 0.48754431017676786 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7046892529993588, + "rel_wql_gmean": 0.49873027199156994 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.7559184214677772, + "rel_wql_gmean": 0.5403467539435655 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.9072313135446312, + "rel_wql_gmean": 0.8597282344616265 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.8954714353445241, + "rel_wql_gmean": 0.6452608905713332 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.5448663141815844, + "rel_wql_gmean": 0.49849527532689536 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.8052997104488152, + "rel_wql_gmean": 0.39131890045413364 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8193836517842737, + "rel_wql_gmean": 0.5025418086987113 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.6483125151505809, + "rel_wql_gmean": 0.44257160799389683 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5662594361132869, + "rel_wql_gmean": 0.44730415194171963 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6793109676463996, + "rel_wql_gmean": 0.7260693495043361 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7654238568294898, + "rel_wql_gmean": 0.525193245952017 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7342892730019599, + "rel_wql_gmean": 0.4967927309147643 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 0.9537984738109576, + "rel_wql_gmean": 0.7980592851144276 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.7976305334001698, + "rel_wql_gmean": 0.8340993400913765 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.6561255296510066, + "rel_wql_gmean": 0.5037479593137425 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.6877599598529993, + "rel_wql_gmean": 0.4614493104463149 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.8956757728119278, + "rel_wql_gmean": 0.6654408484343844 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7113690677247957, + "rel_wql_gmean": 0.5138626971306121 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.7655220811512132, + "rel_wql_gmean": 0.523780003915209 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2136865882858103, + "wql": 0.1132838858560101, + "wsql_by_level": [ + 0.06398613188188708, + 0.09822528205662003, + 0.12010913271783907, + 0.13291743580973667, + 0.1383183447735484, + 0.13819520128572751, + 0.13076513176553392, + 0.11388517073637335, + 0.08315314167682493 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 717.9978231112505, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6793109676463996, + "wql": 0.7260693495043361 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2689578599710318, + "wql": 0.08307552982416051, + "wsql_by_level": [ + 0.04864492580798832, + 0.07366206625644547, + 0.08912919943080395, + 0.09817935410550235, + 0.10223204652650751, + 0.101093108729488, + 0.09479825368321679, + 0.08163760998103321, + 0.05830320389645902 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 582.1389450466875, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7976305334001698, + "wql": 0.8340993400913765 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9987615394122884, + "wql": 0.09291229894291991, + "wsql_by_level": [ + 0.05448398684367033, + 0.08241622675438229, + 0.09994609870173886, + 0.11025340310596365, + 0.11492044924325953, + 0.11367974975677088, + 0.10596018618301738, + 0.09050590717832938, + 0.06404468271914691 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 544.9168029630084, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8076222850734955, + "wql": 0.7886541308151606 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.384587327228709, + "wql": 0.050782001389526224, + "wsql_by_level": [ + 0.02614786106255035, + 0.040602038323742394, + 0.051742918871806876, + 0.05920060630333194, + 0.0636643121077855, + 0.06530649648082683, + 0.06183145600347102, + 0.05270918216404008, + 0.03583314118818105 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 331.3636018201305, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1690628654231183, + "wql": 0.7802154373021952 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.3488163529826873, + "wql": 0.022324136666282957, + "wsql_by_level": [ + 0.014309656028574197, + 0.020563303965626178, + 0.024290297640343992, + 0.026409196113926732, + 0.027239362809187005, + 0.026903746483888, + 0.024994734196891095, + 0.021190595355720848, + 0.015016337402388573 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 174.5293591858269, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0412609272957534, + "wql": 0.9663452147811642 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2857548431526218, + "wql": 0.03865818409791883, + "wsql_by_level": [ + 0.019717202963999335, + 0.03278676327631433, + 0.0417934233895258, + 0.04708729232565546, + 0.04940020048890855, + 0.04883665531551276, + 0.0452593176835286, + 0.037666421006931156, + 0.025376380430893436 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 372.13173961678694, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0467237093600872, + "wql": 1.1213413443456337 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9783697686169258, + "wql": 0.04861871743188503, + "wsql_by_level": [ + 0.030611600208701746, + 0.046495408542598, + 0.05640601131740423, + 0.061882215290043965, + 0.06328347959661039, + 0.06018104145052205, + 0.05241089221826434, + 0.0401279330133644, + 0.02616987524945614 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 64.28035836378002, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8962037002036943, + "wql": 0.7843166186337657 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9580813256345484, + "wql": 0.0894267840526778, + "wsql_by_level": [ + 0.04185588053738328, + 0.06687942070084649, + 0.0850260557332927, + 0.09915771309907699, + 0.10943012029427777, + 0.11398952740332853, + 0.11180717812887744, + 0.10077963882999963, + 0.07591552174701732 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 78.7044676713656, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.6344935945557633, + "wql": 0.7418685954080876 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.881210632473089, + "wql": 0.08608332478482404, + "wsql_by_level": [ + 0.04025552637462287, + 0.06455726911232142, + 0.08169192255884761, + 0.09402959451244088, + 0.10346443237645893, + 0.1080800970491846, + 0.10736040219017083, + 0.09841691286130343, + 0.07689376602806584 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 74.60266345566076, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8054148450928788, + "wql": 0.8002961387337184 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.028168337254421, + "wql": 0.07391224163599172, + "wsql_by_level": [ + 0.04599530207482213, + 0.06696792494996434, + 0.08086970340795833, + 0.08882287681814599, + 0.09195264140666141, + 0.09077426824244175, + 0.08440756320207495, + 0.07057475224745545, + 0.04484514237440116 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 279.2629790345952, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0425986159600704, + "wql": 1.0928721019953744 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9711287953733899, + "wql": 0.07827935138301585, + "wsql_by_level": [ + 0.04290874651171859, + 0.06462368981396495, + 0.07804058210349063, + 0.08699550977988307, + 0.09421058777743616, + 0.09701734969308796, + 0.09426838094122247, + 0.08417851442009644, + 0.062270801406242415 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 253.5363286341384, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.7782464220258843, + "wql": 0.6358409403070728 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1982722895006817, + "wql": 0.09252680496100266, + "wsql_by_level": [ + 0.04393514069789959, + 0.06970103698400384, + 0.08806256511405945, + 0.10107464055806947, + 0.10964250567608043, + 0.11361528728769323, + 0.1128136718925709, + 0.10633721645021571, + 0.08755917998843124 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 300.50784933484175, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.883225900966702, + "wql": 0.630511268024951 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4989855783917896, + "wql": 0.06679712515660609, + "wsql_by_level": [ + 0.028816753838481046, + 0.04729724106077162, + 0.06354597377970037, + 0.0748188232110515, + 0.08237399678127429, + 0.08544919535812423, + 0.08363331854276876, + 0.07603409310961455, + 0.05920473072766835 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 5418.489655466175, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.910868308920584, + "wql": 0.7212438969234862 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.504404144706961, + "wql": 0.06933740016170654, + "wsql_by_level": [ + 0.02737074669056731, + 0.049441605967278604, + 0.06970997081699351, + 0.08088839164255755, + 0.08963175151687768, + 0.09073237964397028, + 0.08569434288814437, + 0.07515925605206282, + 0.05540815623690676 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 38598.83998806754, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.1423995779804303, + "wql": 1.062816767389148 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.017466055309400458, + "wql": 0.42404828444556525, + "wsql_by_level": [ + 0.2001050015683981, + 0.3488482190761366, + 0.4326349839908402, + 0.4733119597464247, + 0.5015607017895363, + 0.49778019812002644, + 0.4926627441068104, + 0.47776644157959575, + 0.39176431003231865 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.048470472201473845, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0903769236657337, + "wql": 0.03499163011722252 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6907126893246468, + "wql": 0.2830563010714067, + "wsql_by_level": [ + 0.20654390565066127, + 0.3113058584247742, + 0.34865292871455766, + 0.34910402705308985, + 0.33405251444546774, + 0.3156236517156509, + 0.2860475551231447, + 0.2359386925950278, + 0.16023757592028592 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.5961693076659877, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8290449808552859, + "wql": 0.5009462981645948 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7072830575650605, + "wql": 0.22464913945663534, + "wsql_by_level": [ + 0.16849353152807833, + 0.26146873121335995, + 0.29906139960856354, + 0.3022493762762963, + 0.2822769053939235, + 0.24613433744979132, + 0.1991981848795913, + 0.15157671833991318, + 0.11138307042020062 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.658581000259214, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3301797202936133, + "wql": 0.2487179320956508 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8697021235757034, + "wql": 0.3278883296942181, + "wsql_by_level": [ + 0.2073959913518703, + 0.3596179614964976, + 0.4257366453376511, + 0.43516642399676864, + 0.41208598083855125, + 0.37059332151292823, + 0.3139051337402247, + 0.2489189747724338, + 0.1775745342010369 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 11.366050121320612, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8228552000716556, + "wql": 0.5443960968120827 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1937248184549127, + "wql": 0.4406500640625478, + "wsql_by_level": [ + 0.43457475869963, + 0.5596394960331353, + 0.5847890150140912, + 0.5645320781493758, + 0.5200518685801557, + 0.4592163929771093, + 0.3818550130823358, + 0.28721856934717693, + 0.17397338467992035 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 15.584409612037668, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8661038548939156, + "wql": 0.45522525046243323 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0403647664410578, + "wql": 0.35545342024712, + "wsql_by_level": [ + 0.4210833830018464, + 0.46370836393407866, + 0.46312315950481703, + 0.4409691188051744, + 0.4055382494346859, + 0.3578894959565884, + 0.2972227910623836, + 0.22142277286793838, + 0.12812344765656747 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.671083523505477, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9701817444313068, + "wql": 0.39372844582513955 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1415381747162323, + "wql": 0.28878569870994425, + "wsql_by_level": [ + 0.24940001201027018, + 0.35357554668194785, + 0.3864767002741883, + 0.3837395769469655, + 0.35701291918924877, + 0.31458606261294336, + 0.25738207287009984, + 0.18859707104514836, + 0.10830132675868565 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 288.8459540155972, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9781328159014941, + "wql": 0.6125851818167387 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0257474722888975, + "wql": 0.12051032112681553, + "wsql_by_level": [ + 0.05750558515223916, + 0.11804262351138507, + 0.14787095716164125, + 0.15589887832420268, + 0.15340803592076072, + 0.14346872686707612, + 0.12760395086097623, + 0.10600172080605907, + 0.07479241153699961 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 942.0384866756244, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.017750161086495, + "wql": 0.8675455009208892 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7939676261914504, + "wql": 0.05465259997375631, + "wsql_by_level": [ + 0.030453833956324255, + 0.04661724420926695, + 0.057188479310588056, + 0.06454375699330364, + 0.06849042727196444, + 0.06799797928702143, + 0.06357747555934103, + 0.05444970760651256, + 0.03855449556948444 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 19.01576735713284, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8512728361612727, + "wql": 0.8621221303190508 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 42.62606117010779, + "wql": 0.07936123444466403, + "wsql_by_level": [ + 0.06868272162621543, + 0.09750855162568861, + 0.11075665143117389, + 0.10339107512836242, + 0.08216409275383835, + 0.055029547787182116, + 0.05189812367041048, + 0.06944273417709569, + 0.07537761180200943 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 166.92107011294155, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8431539439385701, + "wql": 0.6324072546229492 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.45471419211754216, + "wql": 0.025836077840676243, + "wsql_by_level": [ + 0.01225692218766685, + 0.017917619833959515, + 0.024276107016717053, + 0.026414964648019734, + 0.029509635861091368, + 0.033496304553174566, + 0.035074629825786886, + 0.03186579477876554, + 0.02171272186090465 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 300.29694010416665, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.19531508299457995, + "wql": 0.19787656062151054 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.27583329440655097, + "wql": 0.008216461888626441, + "wsql_by_level": [ + 0.005492699451091738, + 0.006051101055078237, + 0.005906743199170506, + 0.00787176204383515, + 0.008241761796961813, + 0.009149822649380933, + 0.010977835088080692, + 0.011372153855710231, + 0.008884277858328682 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 2587.3046875, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9124149597390383, + "wql": 0.7401015852162276 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4486296687347386, + "wql": 0.01627577816779986, + "wsql_by_level": [ + 0.0067934249516486515, + 0.015312097247123705, + 0.019682766734775835, + 0.02101783475852891, + 0.021191522592808546, + 0.020370148271869847, + 0.01825753352668272, + 0.015070287990885917, + 0.008786387435874598 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 1576.4453125, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.37544468756512167, + "wql": 0.38552620939246224 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.261857253559399, + "wql": 0.3237512240825603, + "wsql_by_level": [ + 0.14794408913271762, + 0.2663975794788256, + 0.36100755011364843, + 0.4287520111873283, + 0.461622912247948, + 0.4369952543007286, + 0.3499111901543392, + 0.22106717937752898, + 0.24006325074997809 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 14.341085243225098, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8367027380027973, + "wql": 0.5974771150119321 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46651011298006845, + "wql": 0.24513846173305728, + "wsql_by_level": [ + 0.1234592653588507, + 0.2100225434254629, + 0.2584578401369491, + 0.27797301809230457, + 0.27807306960163775, + 0.2641299246216671, + 0.26883343918370634, + 0.2873669182704561, + 0.2379301369064806 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 8.086993058522543, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.4039625057092329, + "wql": 0.9374270169456879 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7360614773513552, + "wql": 0.2425971269485449, + "wsql_by_level": [ + 0.10969501635056664, + 0.1859739587532623, + 0.2532906964721831, + 0.31461983276935584, + 0.3607508879807264, + 0.36339714564355163, + 0.29033543729670325, + 0.1384753714695383, + 0.16683579580101673 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.82164752483368, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2945813673620583, + "wql": 0.40472708495405707 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.1173691767010427, + "wql": 0.5285994347299672, + "wsql_by_level": [ + 0.18078184996734778, + 0.3402422753852603, + 0.47659668871351935, + 0.5861638837779848, + 0.6629608280490096, + 0.7060024033787128, + 0.703950041873561, + 0.6355782050702578, + 0.46511873635405154 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.660742510523565, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.643337610905163, + "wql": 0.4809020475289127 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5349349264578205, + "wql": 0.37877236794844393, + "wsql_by_level": [ + 0.1511088750264045, + 0.25306393347898243, + 0.34082739883907165, + 0.4168772487329778, + 0.47275263259043143, + 0.4964477917173027, + 0.4917135958524366, + 0.45174972999398466, + 0.3344101053044036 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.150915942998793, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7853722682358341, + "wql": 0.6044739841502849 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9275197378505298, + "wql": 0.46177747149069337, + "wsql_by_level": [ + 0.18120953915026686, + 0.331314870236465, + 0.45230286469575853, + 0.5431325599417974, + 0.599435493111558, + 0.6140042800034773, + 0.5825263283299642, + 0.5000315077882885, + 0.35203980015866443 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 20.090881614662777, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7256764134163822, + "wql": 0.4398304032258195 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8720112057351073, + "wql": 0.47255405467133826, + "wsql_by_level": [ + 0.18380042711684633, + 0.32985887025545363, + 0.45168519340657526, + 0.54507696674326, + 0.6070129844923564, + 0.6303961670521976, + 0.6114092052102358, + 0.5339686897270026, + 0.35977798803811684 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.512777974598336, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8888543922185207, + "wql": 0.38225609432512175 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0421689566643524, + "wql": 0.40378164636417746, + "wsql_by_level": [ + 0.1745283371555537, + 0.3025008993115183, + 0.3969926639024084, + 0.4642379902063315, + 0.5043560650295923, + 0.5201618048639606, + 0.5072528892264593, + 0.45150253635716153, + 0.31250163122461205 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 15.653436406414924, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8589653158899316, + "wql": 0.4489028655177878 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3953856835972696, + "wql": 1.1075714130004275, + "wsql_by_level": [ + 0.27831980479818286, + 0.545113225797921, + 0.8155754250570302, + 1.0707613653643446, + 1.3009090554281613, + 1.4883862952465639, + 1.600262071463611, + 1.5685119767172513, + 1.3003034971307799 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6155856022547168, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.8963097887233826, + "wql": 0.6862646015260111 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6998697492086313, + "wql": 0.26522967761906036, + "wsql_by_level": [ + 0.13479197478530688, + 0.21859391665592307, + 0.27788326513556505, + 0.31657581629301895, + 0.3361809189593577, + 0.33638679587074993, + 0.3146297560861296, + 0.2675645286404522, + 0.18446012614504004 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.190362069518815, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6979030654465919, + "wql": 0.39229569806361375 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9596807835708794, + "wql": 0.6304737852305721, + "wsql_by_level": [ + 0.1987455383259417, + 0.3733638150829808, + 0.5272885103965235, + 0.6602561927397438, + 0.7651115644559583, + 0.838101838387999, + 0.8694306438799266, + 0.8189545079441249, + 0.6230114558619501 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 3.0004692919660565, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.875913620616002, + "wql": 0.4321927170662307 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8187433063482177, + "wql": 0.4047049451809845, + "wsql_by_level": [ + 0.14855443927626288, + 0.2651161124049454, + 0.3555789333274204, + 0.42720759682851855, + 0.4838454897336484, + 0.52153348271914, + 0.5355222675919274, + 0.5074155001898908, + 0.39757068455710587 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 11.814235739788767, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8226870362082608, + "wql": 0.5481585671878038 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4140605333717944, + "wql": 0.030296516210314213, + "wsql_by_level": [ + 0.019456425134293208, + 0.027967684805062648, + 0.03334051009535246, + 0.036493667104408725, + 0.0377622552328327, + 0.03697380747386939, + 0.03398686761215462, + 0.028202528266770204, + 0.0184849001680839 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.4492053467668864, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.680078639801691, + "wql": 0.5281713062590535 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6112006456280451, + "wql": 0.05070331935305628, + "wsql_by_level": [ + 0.039917511959190466, + 0.05379907484338828, + 0.06085944002651941, + 0.0635011425226914, + 0.06270482804776768, + 0.05847940732092987, + 0.05120069194999517, + 0.040456813918432116, + 0.025410963588592118 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.8095619627381256, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38380323338987343, + "wql": 0.3593477256143351 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.678927769572324, + "wql": 0.0575271960616987, + "wsql_by_level": [ + 0.04506013823357867, + 0.061853181622916, + 0.07006741299796845, + 0.07279518745857497, + 0.07118995111668262, + 0.06595568204509152, + 0.05739133040810897, + 0.04513239129209145, + 0.02829948938027569 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.1878957009249875, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4267238336001622, + "wql": 0.38991108566844 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6860557459222443, + "wql": 0.04444396009811325, + "wsql_by_level": [ + 0.03639900712559551, + 0.048029667978658916, + 0.053052061811088486, + 0.05478833753289642, + 0.05362549652763438, + 0.050865918048628826, + 0.04522633672510192, + 0.03577522290428728, + 0.02223359222912753 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.2482043893160095, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.34129623834555833, + "wql": 0.3252231450575319 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7402823460225629, + "wql": 0.05290489166303669, + "wsql_by_level": [ + 0.044964514190732746, + 0.05899015639010374, + 0.06441861780098103, + 0.06519152898190443, + 0.06295389814085463, + 0.05817058640635365, + 0.051306132717435025, + 0.04201703654704173, + 0.028131553791923232 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.512248741060311, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6417532684201892, + "wql": 0.3547977131073046 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.724128278316365, + "wql": 0.051247080916943334, + "wsql_by_level": [ + 0.04324001153018693, + 0.0560697646884863, + 0.06125533801598764, + 0.06226383181191703, + 0.060592624259737056, + 0.05666183951660153, + 0.050615150811131424, + 0.041963290679263354, + 0.02856187693917877 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.400871695554519, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.58169736769309, + "wql": 0.29239967469117795 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6218210488652132, + "wql": 0.029150607935111053, + "wsql_by_level": [ + 0.02084364858418701, + 0.029852351111669752, + 0.03443914968769036, + 0.036261648941411255, + 0.03584611519534881, + 0.033595307144074694, + 0.030130377964404056, + 0.02494942193239407, + 0.01643745085481947 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 2.0119286799947544, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5245609166031968, + "wql": 0.3140644227742312 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5236277811117971, + "wql": 0.1972462897885597, + "wsql_by_level": [ + 0.10258240359570776, + 0.1670609002976437, + 0.21105512867106385, + 0.23886340372269588, + 0.2510872305116523, + 0.24823685321907837, + 0.23035242244278836, + 0.19390171560513014, + 0.13207655003127683 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.810278970356534, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7221365984908177, + "wql": 0.6523777464823901 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46648219988225065, + "wql": 0.19421245043327667, + "wsql_by_level": [ + 0.10104651169062401, + 0.1610641980105734, + 0.2017397930976333, + 0.22785516473181838, + 0.24097479168484884, + 0.24117566926043124, + 0.2278791657903754, + 0.19939315980900046, + 0.146783599824185 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.6669336336394984, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7346116820302979, + "wql": 0.4959406905862325 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4949274958400236, + "wql": 0.21766181342704474, + "wsql_by_level": [ + 0.1151798962088511, + 0.18017162349030924, + 0.2228434868594972, + 0.24914676150444506, + 0.2620219910851547, + 0.2636481119669016, + 0.25457709239576565, + 0.23226252054496999, + 0.17910483678750844 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.909942958868945, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8134609927631595, + "wql": 0.47814356115757445 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4807728353482825, + "wql": 0.13071997625901322, + "wsql_by_level": [ + 0.07022630927067681, + 0.10955523147300623, + 0.13561093421894962, + 0.15192129207093258, + 0.15934741310901065, + 0.15869462723655245, + 0.1500109923888567, + 0.13498406957813103, + 0.1061289169850029 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7616086505205693, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7898169575550299, + "wql": 0.6329321613348539 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.708481389583232, + "wql": 0.12699442000109226, + "wsql_by_level": [ + 0.09126537484748211, + 0.12425879705268704, + 0.14259423638064642, + 0.1529956642330167, + 0.1555627199085248, + 0.14959795179510535, + 0.13624689343275734, + 0.11412194723360705, + 0.07630619512600366 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 97.98236801293162, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8101876778292224, + "wql": 0.6689808672809099 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7866011938614023, + "wql": 0.13970309349877783, + "wsql_by_level": [ + 0.08466282534985417, + 0.1230555864239127, + 0.14512571205070926, + 0.15875505050167654, + 0.16736324871676664, + 0.16887388174341475, + 0.16122448911857665, + 0.14241611669681942, + 0.1058509308872701 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 98.23561948650413, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6713767540332096, + "wql": 0.39944126262653107 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0903728566648554, + "wql": 0.1805380175792964, + "wsql_by_level": [ + 0.08900818397641708, + 0.1421451532698879, + 0.1801206639807977, + 0.2075444679297693, + 0.22669914753978054, + 0.23264283909282596, + 0.2233464847782064, + 0.19165637106080363, + 0.13167884658517914 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 132.8605602669716, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0091201847767735, + "wql": 0.4700052817669189 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0870510367212338, + "wql": 0.10112100134347618, + "wsql_by_level": [ + 0.0665681008306147, + 0.09872567332363137, + 0.11947449792885977, + 0.1310386960790055, + 0.1328501560115257, + 0.12566676324213258, + 0.10887702454688336, + 0.08069427269435638, + 0.046193827434276316 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 77.85889959547255, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0787569301084154, + "wql": 0.5076055387934383 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7909125224343124, + "wql": 0.2770959831365556, + "wsql_by_level": [ + 0.17292576450356903, + 0.2643759229679922, + 0.31772584239006013, + 0.34935000276621936, + 0.3584958895289874, + 0.35382679969835096, + 0.3176611189560128, + 0.23745783211305369, + 0.12204467530475446 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.310225653329066, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6560963433693557, + "wql": 0.5760305933933253 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9587434788812675, + "wql": 0.37643460416713215, + "wsql_by_level": [ + 0.1838658175346849, + 0.3343460847240301, + 0.4470637156862312, + 0.4985271245568418, + 0.5060219581349393, + 0.47952372899628415, + 0.4154614869939838, + 0.3223619294237991, + 0.20073959145339493 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.650092424748038, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2377783879108912, + "wql": 0.8581086138187134 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.318123928114607, + "wql": 0.4868729670130112, + "wsql_by_level": [ + 0.31549700259284663, + 0.4745593432764067, + 0.587343643339829, + 0.6465822652748968, + 0.6469808198471884, + 0.5962717417367275, + 0.5048795496363911, + 0.38323220780262013, + 0.22651012961019504 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.2180754101273443, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9932564667616388, + "wql": 0.8398995063445879 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.770252029951011, + "wql": 0.34230440829870007, + "wsql_by_level": [ + 0.19450847771899824, + 0.3020142246272256, + 0.3730874720802519, + 0.42313451432292126, + 0.44274085528082097, + 0.43960747001049394, + 0.401821262118335, + 0.32153162201926916, + 0.18229377650998416 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.35048106170836, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7376758587932809, + "wql": 0.678621183338175 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3947569364341041, + "wql": 0.4336720988042952, + "wsql_by_level": [ + 0.3098625914016961, + 0.4724051336828235, + 0.5390286393477195, + 0.5563340058331854, + 0.5422036143597995, + 0.49967136445618887, + 0.4316608905405676, + 0.3402956270229457, + 0.21158702259373052 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.296831495463405, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1398917202498404, + "wql": 0.7885874452897172 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4216102235689059, + "wql": 0.41864164953745736, + "wsql_by_level": [ + 0.3149478845989131, + 0.4782142305771531, + 0.5461378129408794, + 0.5555571763249064, + 0.5282817879961684, + 0.47109400594432277, + 0.3930018365481162, + 0.29707809585688894, + 0.1834620150497675 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 8.895031181434613, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9927007770340284, + "wql": 0.723887441910908 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.7379281209777138, + "wql": 0.33561363954678936, + "wsql_by_level": [ + 0.1638396961398518, + 0.30014047936278243, + 0.39639835850689437, + 0.44860425769729995, + 0.45035502438521197, + 0.4216855060248208, + 0.35899946416173406, + 0.2849475920592368, + 0.1955523775832721 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 142.9536171913147, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9558526291227953, + "wql": 0.6915830531364314 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0202816739341702, + "wql": 0.19554563867646294, + "wsql_by_level": [ + 0.1363739672259357, + 0.1865904285337758, + 0.22518353513904507, + 0.23104059960636816, + 0.2182295570730849, + 0.2163178141612387, + 0.21770474557808006, + 0.19258699062124346, + 0.13588311014939444 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 544.6438931056431, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8198901230524355, + "wql": 0.7575073163475727 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0586018139024367, + "wql": 0.128242963725863, + "wsql_by_level": [ + 0.06700297022940617, + 0.10548758846782029, + 0.1331124128373453, + 0.15202553121944756, + 0.16284495603870758, + 0.1634533441736308, + 0.15385402355001043, + 0.13088183317944854, + 0.08552401383695031 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.5984961182943414, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.3895601897735648, + "wql": 1.3653091945136697 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.800387790836893, + "wql": 0.0956915286731333, + "wsql_by_level": [ + 0.06273675916179988, + 0.09564528902266503, + 0.11414560138308609, + 0.12239453102042108, + 0.12181151118041142, + 0.1140276831551516, + 0.099974899479754, + 0.07895885096476238, + 0.05152863269014804 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.8537638287636495, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8866411568611583, + "wql": 0.7010833141109647 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.010079820335309, + "wql": 0.12570894347416262, + "wsql_by_level": [ + 0.08690629106303667, + 0.12672526677344007, + 0.15139698435781754, + 0.16351763346894688, + 0.16190261858366983, + 0.14892978228108703, + 0.12699182833229186, + 0.09900141215880169, + 0.06600867424837202 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.4418136373823804, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.955975858415944, + "wql": 0.7502352996766724 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6950192572626066, + "wql": 0.07539604806755343, + "wsql_by_level": [ + 0.05263586125711691, + 0.0789853442110364, + 0.09291581638767848, + 0.09823292432290721, + 0.09497032782135059, + 0.08545250570294283, + 0.07181964511876057, + 0.05987868953968681, + 0.043673318246500954 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.822835160153253, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7009334174259153, + "wql": 0.631912351865917 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.662804294185369, + "wql": 0.2541382896464894, + "wsql_by_level": [ + 0.10485482528199604, + 0.18377041507644343, + 0.2523318708524593, + 0.30854099830843407, + 0.3477026029592859, + 0.3545068222390054, + 0.3247593557999638, + 0.25804439243947963, + 0.15273332386133667 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 19.776000247665106, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.005183312678311, + "wql": 0.7348887664234015 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.215531187098684, + "wql": 0.3539730929212086, + "wsql_by_level": [ + 0.2856403572674056, + 0.385812101687508, + 0.43361363589738666, + 0.45176600331471395, + 0.4449572674881164, + 0.41131190280760777, + 0.3527354854270664, + 0.26778312346005384, + 0.1521379589410194 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.10750415101056, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0137939057928589, + "wql": 0.9559174998125468 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.747727033678056, + "wql": 0.3318228509993689, + "wsql_by_level": [ + 0.3113507639282168, + 0.40587812965133396, + 0.4359217437419228, + 0.43307216912195556, + 0.4072787815225473, + 0.3603254749487071, + 0.29584244009250005, + 0.2161311129761924, + 0.12060504301094434 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 550.7416887192499, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0092012864777422, + "wql": 1.041258175404241 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.643391959128255, + "wql": 0.17433375120726383, + "wsql_by_level": [ + 0.10393614352282718, + 0.1739367770148251, + 0.20733482704202094, + 0.2220277840244284, + 0.22435612257621843, + 0.21070226481855808, + 0.1783689860874599, + 0.146508630325262, + 0.10183222545377428 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2183.549336705889, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9294882701439989, + "wql": 0.8248998802664099 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4180426814355424, + "wql": 0.018459983693809964, + "wsql_by_level": [ + 0.006707848210024851, + 0.012026293615026341, + 0.01579285910673984, + 0.018852164216554813, + 0.02170265164498617, + 0.023438891324444225, + 0.02428120493447748, + 0.024246353370206673, + 0.0190915868218293 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.4199992263955727, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5484920537385621, + "wql": 0.13506577816972695 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8150708855797851, + "wql": 0.08336060316160461, + "wsql_by_level": [ + 0.024346238453900566, + 0.049924774132619525, + 0.07281684918632841, + 0.09024543857902587, + 0.10197499966371887, + 0.10885815808693017, + 0.10935943979101134, + 0.10335577171187632, + 0.08936375884903047 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.245498728857463, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8335384905745832, + "wql": 0.365770504085655 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7049940503880631, + "wql": 0.07683355590958543, + "wsql_by_level": [ + 0.026654221689775662, + 0.05118984830679849, + 0.07109761634228419, + 0.08530263661228794, + 0.09420704162622659, + 0.09744440647146083, + 0.09654492584644632, + 0.09078934185138814, + 0.0782719644396007 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.10508348365467, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.778523820387952, + "wql": 0.3163296671913231 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5073856742042889, + "wql": 0.05701439480862595, + "wsql_by_level": [ + 0.022172961702513764, + 0.04868756606412725, + 0.062450796143993716, + 0.06925146511862804, + 0.07010096186350277, + 0.0679439446474096, + 0.06529509541532044, + 0.060124736961010346, + 0.047102025361127633 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 11.713747894787783, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6683360357863006, + "wql": 0.3106765177846212 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8091343867774174, + "wql": 0.09021169946115155, + "wsql_by_level": [ + 0.041814642115737106, + 0.0722289377471975, + 0.09014371637563261, + 0.1001024087942262, + 0.10420626386012109, + 0.10761514679314785, + 0.10759097543437017, + 0.10217143562406042, + 0.08603176840587107 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.94902354221595, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7556840251848039, + "wql": 0.24776696515877186 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9847534755909029, + "wql": 0.12052786980028407, + "wsql_by_level": [ + 0.06130213905343835, + 0.11187043134599027, + 0.13818867960847947, + 0.1475200313078249, + 0.14578567857672117, + 0.14024508813641282, + 0.13014111611693296, + 0.11554118335010871, + 0.09415648070664795 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 25.411182950768314, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6597759072935957, + "wql": 0.2715336110749009 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.429399877243543, + "wql": 0.11004672005593324, + "wsql_by_level": [ + 0.053710737984237124, + 0.09761219717965697, + 0.12265276578960273, + 0.13522707681575322, + 0.13912706156871102, + 0.13553166189705715, + 0.12646370575958432, + 0.10584830138602719, + 0.07424697212276954 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 24.250552133404344, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.769385244748497, + "wql": 0.47560424241454524 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0563961915052509, + "wql": 0.46450886990215107, + "wsql_by_level": [ + 0.19100400535412423, + 0.32603597898460557, + 0.42652797262768616, + 0.49950134631419857, + 0.5546183534594248, + 0.5927090372709845, + 0.5991142267907765, + 0.5544339023701379, + 0.4366350059474216 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 162.93087576581172, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5355150248327445, + "wql": 0.24470252552987815 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1088831163395414, + "wql": 0.692204695480189, + "wsql_by_level": [ + 0.5930979855518793, + 0.9172665312760448, + 0.9638494404834778, + 0.9187249895747565, + 0.8324116839476589, + 0.7187756504059439, + 0.5862663658004668, + 0.43498039993105514, + 0.2644692123504183 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 517.38998457309, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8323038157204431, + "wql": 0.8689861275189058 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2573603993737728, + "wql": 0.505655556632234, + "wsql_by_level": [ + 0.374500146289352, + 0.5754897424998322, + 0.646578458676133, + 0.6603858470326348, + 0.6349164748536388, + 0.5721387787646786, + 0.4854735130451713, + 0.3718433409541445, + 0.22957370757452117 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 463.4992741610331, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8344274951681644, + "wql": 0.7245331185619093 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.359648345951097, + "wql": 0.49106018359965237, + "wsql_by_level": [ + 0.35664721143177447, + 0.5738282979330871, + 0.6484927726367717, + 0.651545323517308, + 0.6081592383863704, + 0.5400252811379748, + 0.4583454376048117, + 0.3586434487799432, + 0.2238546409688305 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 429.36347827069676, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8731465977598223, + "wql": 0.7880640938588218 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5548757827236952, + "wql": 0.2209434997892071, + "wsql_by_level": [ + 0.11531986397018876, + 0.17536030907498093, + 0.2148443759631769, + 0.2421708671771516, + 0.2545831618730272, + 0.26119629965803937, + 0.25901344579980373, + 0.24724956531755712, + 0.21875360926893825 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 136.42516072581327, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6629575808346102, + "wql": 0.24670268672829565 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8223325227611781, + "wql": 0.8989860697024464, + "wsql_by_level": [ + 0.4214334709236999, + 0.7706316083660982, + 0.938720511119862, + 1.0240325835070851, + 1.0604238325508872, + 1.0589873679225892, + 1.022155358252854, + 0.9532466590273946, + 0.8412432356515482 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 318.4649045708599, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8442773936136888, + "wql": 0.8139353665287388 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9645145906520364, + "wql": 0.7501865978888778, + "wsql_by_level": [ + 0.2826242950453414, + 0.44170521088140274, + 0.5788104379627049, + 0.7053295597328167, + 0.8202173111174296, + 0.9267894369447688, + 1.011919095879212, + 1.0559969691922286, + 0.9282870642439942 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 268.31254074569466, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.8271937236394551, + "wql": 0.7518756249154661 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.919264560575754, + "wql": 0.6175302586650572, + "wsql_by_level": [ + 0.17035922813302126, + 0.32812385442256, + 0.504611483443402, + 0.6565535530942008, + 0.786993596558457, + 0.8492212539690365, + 0.841466897827589, + 0.7836674878504571, + 0.6367749726867907 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 254.93623222581334, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8225825432739063, + "wql": 0.6629681575619343 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5370656039486735, + "wql": 0.009665956671546223, + "wsql_by_level": [ + 0.005725767086974047, + 0.009209470258091797, + 0.01147081096436008, + 0.012669505651541913, + 0.012964773072675814, + 0.012330674796789452, + 0.010563438802106192, + 0.007779143634362656, + 0.004280025777014055 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 335.46868991851807, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38538910771464857, + "wql": 0.5251932199073153 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6708944519909023, + "wql": 0.008991219416298688, + "wsql_by_level": [ + 0.005363093401116743, + 0.008064607736538172, + 0.009927350278533385, + 0.011046492250765632, + 0.011523183060663423, + 0.011243003560996395, + 0.010225522281987061, + 0.00832100160514925, + 0.005206720570938128 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 275.8662420463562, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7305563242842124, + "wql": 0.6542651537043443 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7080554834895543, + "wql": 0.009388052414459551, + "wsql_by_level": [ + 0.005590715860452989, + 0.008767118741066948, + 0.01071821499499025, + 0.011747774837913056, + 0.011941920852874321, + 0.011517871435202902, + 0.010403185480640384, + 0.00845543792564772, + 0.0053502316013473855 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 290.9693203883701, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9456804678638295, + "wql": 0.7253561439752841 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5049458075272754, + "wql": 0.00898518668589089, + "wsql_by_level": [ + 0.005539118347084895, + 0.008716250613186368, + 0.010757901425519086, + 0.011813739361798487, + 0.011989060990809635, + 0.011358877445171478, + 0.009834008519224368, + 0.0072258732123507, + 0.0036318502578729906 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 16.075871651182098, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.47820981592731643, + "wql": 0.35215260123513603 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6714602686927872, + "wql": 0.00981646092946955, + "wsql_by_level": [ + 0.006115255627611097, + 0.009259825141237285, + 0.011211594808517814, + 0.012244917983944309, + 0.012480578577290805, + 0.011992144604458643, + 0.010786872670417013, + 0.008748512310802545, + 0.005508446640946446 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.741901024324553, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7033471154594209, + "wql": 0.41748329720273997 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7409673718705544, + "wql": 0.010559629600521312, + "wsql_by_level": [ + 0.006351157367229412, + 0.009842862095966973, + 0.011994041675544227, + 0.013173496564575955, + 0.013514388727970847, + 0.013089596937709376, + 0.011737526820940716, + 0.00937513601470915, + 0.005958460200045164 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 17.26916056037767, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8909141592122642, + "wql": 0.4459494147286848 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.18282018772100314, + "wql": 0.054020214049003014, + "wsql_by_level": [ + 0.036302482179588286, + 0.05489048228983174, + 0.06521437599952663, + 0.0692057797949694, + 0.06832803538516315, + 0.06448093759830364, + 0.055220195059194344, + 0.04266704450109075, + 0.02987259363335921 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.7552963963576727, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.23677044020348592, + "wql": 0.2444966294354746 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.47137854942905916, + "wql": 0.1540878332578824, + "wsql_by_level": [ + 0.122522476118914, + 0.167554195317838, + 0.18881255787968826, + 0.18804931895246974, + 0.18180755358862755, + 0.17480178476421177, + 0.1553921362634952, + 0.12126827706150688, + 0.08658219937418989 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 4.0462407334219845, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3269619122658867, + "wql": 0.3272116367005915 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7540425454908205, + "wql": 0.28124687270339455, + "wsql_by_level": [ + 0.14307158282692464, + 0.22883714884299666, + 0.2925539711569096, + 0.3392595192132015, + 0.37308709245151794, + 0.3782823923998815, + 0.3584117249276486, + 0.2782145557198961, + 0.139503866791574 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.825108701759388, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.44829345506386137, + "wql": 0.41631094055748796 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7185723412082329, + "wql": 0.21667990960763914, + "wsql_by_level": [ + 0.1309618056465113, + 0.22534410941151034, + 0.2898914931721202, + 0.3166985934530759, + 0.3122733522309296, + 0.27194888869434525, + 0.1984933659641607, + 0.12644605084748178, + 0.07806152704861695 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.533460969371455, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4534771515652352, + "wql": 0.3887497700062742 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3552979095462014, + "wql": 0.2115123929497653, + "wsql_by_level": [ + 0.11719054794293611, + 0.18035740470982456, + 0.21694741840068416, + 0.24237980231109532, + 0.25561046573552093, + 0.25519993154014714, + 0.24326872508597128, + 0.22118719885271879, + 0.1714700419689894 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.4984776844048784, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.21986755023743207, + "wql": 0.18939297678391975 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4308070989664152, + "wql": 0.21396107175814455, + "wsql_by_level": [ + 0.11799912146670648, + 0.1869007873139871, + 0.2295342289261647, + 0.2537291225106593, + 0.2626706521537121, + 0.2559162803822535, + 0.24040566004426608, + 0.2159961410419795, + 0.16249765198357202 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.968644107626899, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3365091620944994, + "wql": 0.21113089123569492 + } + } + ], + "checkpoint_sha256": "65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d", + "inference_seconds": 229.4465912480373 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/zero_mass.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/zero_mass.py new file mode 100644 index 0000000000000000000000000000000000000000..7e9c7067950c67da130e2c2538ffb42f34537402 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S042/zero_mass.py @@ -0,0 +1,12 @@ +"""Fixed zero-mass projection from the supplied history only.""" +import numpy as np + +def project(ctx,q,threshold=.4): + finite=np.isfinite(ctx);n=finite.sum(-1).clip(min=1) + x=np.where(finite,ctx,0.) + mean=x.sum(-1)/n + scale=np.sqrt((np.where(finite,ctx-mean[...,None],0.)**2).sum(-1)/n) + zero=((ctx==0)&finite).sum(-1) + active=((ctx>=0)|~finite).all(-1)&(zero>=4)&(zero/n>=.1) + cutoff=np.where(active,threshold*scale,0.) + return np.where((q>=0)&(q=400, average the sign-symmetric prediction with a four-step-aggregated prediction from the same weights, then apply the unchanged seasonal gate. Screening skill falls from 0.328463 to 0.320862, so this is rejected. No training or fitted context parameters. + +## E8 median and predictable-series loss weighting +- Hypothesis: optimizing median error explicitly and weighting by context seasonal error aligns pretraining with MASE and quantile loss. +- Initial weights: E4 averaged small model, trained here from random initialization; no external pretrained assets. +- Changed factor: loss = mean over valid steps of 0.5 times mean pinball loss plus 0.25 times absolute median error, weighted per instance by clip(1/(0.25 + normalized context seasonal absolute difference), 0.25, 4). Weights are normalized across the batch. Training-only calculation; inference model unchanged. +- Seed 31, batch 256, 6,000 steps, AdamW 1e-4 with 400-step warmup and cosine decay, same source sample and synthetic generator. EMA as E5. +- Compute: 272.9 seconds elapsed on the sole H100, shared concurrently with E5. Underlying initial pretraining used 349.9 seconds. + +## E8 step 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `e7cb5c4b4f04ba1ca873bc725f5e4345874520a96cbd3f079e4f631fd3c46d50`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.978966474533081 seconds. +- Overall skill 0.331642; relative MASE 0.791898; relative WQL 0.564091. +- term skill: long=0.3735, medium=0.3891, short=0.2910. +- domain skill: Econ/Fin=-0.0197, Energy=0.1668, Healthcare=0.2894, Nature=0.4040, Sales=0.3301, Transport=0.4439, Web/CloudOps=0.4906. +- frequency skill: A=0.2646, D=0.3158, H=0.3714, M=0.0669, Q=0.1387, S=0.3726, T=0.3764, W=0.1424. +- variates skill: multivariate=0.3652, univariate=0.3036. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `dab309aff5a3a28936391b84b3ebd9d5dfc208e53c1e1602e4f5c599e3004c33`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.16230034828186 seconds. +- Overall skill 0.332263; relative MASE 0.790121; relative WQL 0.564310. +- term skill: long=0.3745, medium=0.3873, short=0.2925. +- domain skill: Econ/Fin=0.0051, Energy=0.1638, Healthcare=0.2952, Nature=0.4011, Sales=0.3311, Transport=0.4450, Web/CloudOps=0.4919. +- frequency skill: A=0.3239, D=0.3220, H=0.3698, M=0.0488, Q=0.1636, S=0.3751, T=0.3783, W=0.1317. +- variates skill: multivariate=0.3653, univariate=0.3047. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `111cf52c0662c60aebb44355135a65675a09d898995deeb4dd2f8f2b66339a0f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.85259199142456 seconds. +- Overall skill 0.326318; relative MASE 0.796087; relative WQL 0.570097. +- term skill: long=0.3658, medium=0.3826, short=0.2873. +- domain skill: Econ/Fin=-0.0159, Energy=0.1477, Healthcare=0.3155, Nature=0.4038, Sales=0.3247, Transport=0.4419, Web/CloudOps=0.4862. +- frequency skill: A=0.2949, D=0.3163, H=0.3678, M=0.0654, Q=0.1519, S=0.3722, T=0.3655, W=0.1286. +- variates skill: multivariate=0.3573, univariate=0.3006. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `5fa525d923b4af5949f2415cf0ad0b325dae7623f07aae06b3131bdbda08c209`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.634822130203247 seconds. +- Overall skill 0.332843; relative MASE 0.789360; relative WQL 0.563874. +- term skill: long=0.3745, medium=0.3875, short=0.2936. +- domain skill: Econ/Fin=0.0007, Energy=0.1627, Healthcare=0.3135, Nature=0.4026, Sales=0.3309, Transport=0.4452, Web/CloudOps=0.4913. +- frequency skill: A=0.3152, D=0.3249, H=0.3696, M=0.0640, Q=0.1700, S=0.3757, T=0.3784, W=0.1261. +- variates skill: multivariate=0.3645, univariate=0.3065. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `8ce9867a6005c28005b32d163254c088279f2a46febeadc433b403aeffc29066`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.403828620910645 seconds. +- Overall skill 0.333292; relative MASE 0.789778; relative WQL 0.562816. +- term skill: long=0.3723, medium=0.3857, short=0.2961. +- domain skill: Econ/Fin=-0.0157, Energy=0.1603, Healthcare=0.3279, Nature=0.4080, Sales=0.3286, Transport=0.4450, Web/CloudOps=0.4921. +- frequency skill: A=0.2821, D=0.3254, H=0.3697, M=0.0826, Q=0.1490, S=0.3718, T=0.3810, W=0.1182. +- variates skill: multivariate=0.3645, univariate=0.3073. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `e61535b34efac923328f1dd464f5ab8ab05913438f86125d8b933f1b166281d9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.288180112838745 seconds. +- Overall skill 0.334221; relative MASE 0.787768; relative WQL 0.562681. +- term skill: long=0.3735, medium=0.3879, short=0.2964. +- domain skill: Econ/Fin=-0.0016, Energy=0.1638, Healthcare=0.3235, Nature=0.4037, Sales=0.3295, Transport=0.4477, Web/CloudOps=0.4916. +- frequency skill: A=0.3041, D=0.3326, H=0.3704, M=0.0629, Q=0.1674, S=0.3746, T=0.3813, W=0.1128. +- variates skill: multivariate=0.3653, univariate=0.3084. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `15833e7668d9cd11ed55a4820b4700d71c6f734415d11490c7e8beb654abfa12`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.2668559551239 seconds. +- Overall skill 0.334430; relative MASE 0.788174; relative WQL 0.562038. +- term skill: long=0.3762, medium=0.3886, short=0.2953. +- domain skill: Econ/Fin=-0.0108, Energy=0.1611, Healthcare=0.3518, Nature=0.4037, Sales=0.3298, Transport=0.4457, Web/CloudOps=0.4924. +- frequency skill: A=0.2760, D=0.3360, H=0.3690, M=0.0736, Q=0.1605, S=0.3759, T=0.3813, W=0.1132. +- variates skill: multivariate=0.3660, univariate=0.3081. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.340764284133911 seconds. +- Overall skill 0.335038; relative MASE 0.787307; relative WQL 0.561630. +- term skill: long=0.3762, medium=0.3878, short=0.2968. +- domain skill: Econ/Fin=-0.0053, Energy=0.1637, Healthcare=0.3401, Nature=0.4031, Sales=0.3292, Transport=0.4464, Web/CloudOps=0.4934. +- frequency skill: A=0.2894, D=0.3329, H=0.3693, M=0.0767, Q=0.1622, S=0.3763, T=0.3828, W=0.1162. +- variates skill: multivariate=0.3659, univariate=0.3094. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E9 neural context 512 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.416622161865234 seconds. +- Overall skill 0.320871; relative MASE 0.803968; relative WQL 0.573675. +- term skill: long=0.3740, medium=0.3863, short=0.2718. +- domain skill: Econ/Fin=0.0457, Energy=0.1466, Healthcare=0.2113, Nature=0.3887, Sales=0.3285, Transport=0.4330, Web/CloudOps=0.4911. +- frequency skill: A=0.2986, D=0.2904, H=0.3587, M=-0.0099, Q=0.1658, S=0.3756, T=0.3687, W=0.1716. +- variates skill: multivariate=0.3665, univariate=0.2822. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 1024 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.072535276412964 seconds. +- Overall skill 0.329251; relative MASE 0.796444; relative WQL 0.564891. +- term skill: long=0.3740, medium=0.3863, short=0.2876. +- domain skill: Econ/Fin=0.0323, Energy=0.1629, Healthcare=0.1832, Nature=0.3978, Sales=0.3361, Transport=0.4415, Web/CloudOps=0.4998. +- frequency skill: A=0.2986, D=0.3031, H=0.3649, M=-0.0077, Q=0.1661, S=0.3761, T=0.3907, W=0.1240. +- variates skill: multivariate=0.3738, univariate=0.2915. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 2048 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.426023244857788 seconds. +- Overall skill 0.329063; relative MASE 0.794285; relative WQL 0.566744. +- term skill: long=0.3740, medium=0.3863, short=0.2872. +- domain skill: Econ/Fin=0.0227, Energy=0.1628, Healthcare=0.2235, Nature=0.3975, Sales=0.3314, Transport=0.4448, Web/CloudOps=0.4931. +- frequency skill: A=0.2986, D=0.3154, H=0.3656, M=-0.0077, Q=0.1661, S=0.3738, T=0.3847, W=0.1224. +- variates skill: multivariate=0.3651, univariate=0.2989. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E10 fixed 50/50 ensemble diagnostic +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 4.082070589065552 seconds. +- Overall skill 0.332712; relative MASE 0.791350; relative WQL 0.562676. +- term skill: long=0.3746, medium=0.3901, short=0.2921. +- domain skill: Econ/Fin=-0.0029, Energy=0.1641, Healthcare=0.3036, Nature=0.4055, Sales=0.3288, Transport=0.4500, Web/CloudOps=0.4870. +- frequency skill: A=0.2971, D=0.3243, H=0.3712, M=0.0353, Q=0.1843, S=0.3742, T=0.3778, W=0.1385. +- variates skill: multivariate=0.3658, univariate=0.3052. +- Outcome: Average of E8 EMA4000 and E5 EMA12000, both with sign symmetry and the same fixed seasonal gate. Skill 0.332712 is below E8 alone (0.334221). Rejected for now; both members would forecast every instance. + +## E8 EMA6000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.330109; relative MASE 0.789610; relative WQL 0.568323. +- term skill: long=0.3687, medium=0.3851, short=0.2920. +- domain skill: Econ/Fin=-0.0223, Energy=0.1525, Healthcare=0.3475, Nature=0.4024, Sales=0.3415, Transport=0.4461, Web/CloudOps=0.4860. +- frequency skill: A=0.2370, D=0.3358, H=0.3639, M=0.0960, Q=0.1447, S=0.3763, T=0.3738, W=0.1061. +- variates skill: multivariate=0.3616, univariate=0.3039. +- Outcome: Full validation skill 0.330109, relative MASE 0.789610, relative WQL 0.568323, zero failed configurations. Inference took 48.1 seconds while sharing the one H100. Improves the previous published 0.323978 and is selected for atomic publication. + +## E11 matched corpus-coverage experiment +- Hypothesis: broader source coverage improves generalization after the initial model has plateaued. +- Expanded sample: 95 directories, 1,032,415 series, 5,653,290,832 points (22.613 GB), versus 357,789 series and 958,745,103 points (3.835 GB). Per-source cap rises from 24M to 192M points, Arrow record batches are shuffled within each selected shard, and the per-series crop cap rises from 131,072 to 1,048,576. The same deterministic directory-hash seeds and at most eight sampled shards per directory are used. +- Two matched continuations start from E8 EMA6000: original sample control and expanded sample. Both use seed 41, batch 256, the E8 loss, 6,000 steps, AdamW 1e-4 and the same schedule/EMA. Training uses only corpus/synthetic data. +- Runs share the single H100 with E5; CPU threads are limited to three per new trainer. Completed matched runs: control 363.4 s, expanded 364.8 s; the expanded corpus did not improve either matched checkpoint. Detailed results are below. + +## E12 fixed continuity correction +- Hypothesis: a direct-horizon head can miss the immediate level of a smooth history, and a small decaying correction should reduce short-horizon error. No training or context fitting. E8 EMA6000 weights, seed 31. +- Fixed formula: ratio=mean(square(first differences))/variance over the last 512 points; w=clip(1-ratio/0.5,0,0.95); bias=w*(last value + median of the last eight differences - first forecast median). Add bias*exp(-step/tau) to each quantile, then retain the existing positivity rule. Skip sparse missing-value differences. +- Initial diagnostic needed a missing-value guard; invalid intermediate scores were discarded. A positivity-lookback mismatch in the probe was also corrected so tau=0 exactly reproduces the control. +- CPU sweep took 6.0 seconds; final verified control and all candidate scores follow. Tau 24 selected for package/full validation. +- tau=0: skill 0.335038, relative MASE 0.787307, relative WQL 0.561630, group skills {'term': {'short': 0.2967927346774093, 'medium': 0.38776799350809343, 'long': 0.37616349665047677}, 'domain': {'Econ/Fin': -0.005273788909573085, 'Energy': 0.16374587322817125, 'Healthcare': 0.34007707190705616, 'Nature': 0.4030815329292825, 'Sales': 0.32924485226314826, 'Transport': 0.4464324047455728, 'Web/CloudOps': 0.4934311796492926}, 'freq': {'A-DEC': 0.2893784388532201, 'Q-DEC': 0.16218093798601307, 'M': 0.07665328507242941, 'W-SUN': -0.31450314757766273, 'D': 0.332876404786148, 'H': 0.3693479345200832, '15T': 0.14228566862247327, 'W-FRI': 0.032405497411887585, '10T': 0.4887742379514316, 'W-TUE': 0.309664207244038, 'W-THU': 0.14794979612329628, 'W-WED': 0.29198895648742507, '5T': 0.5120305409377247, '10S': 0.3762720731817548}}. +- tau=2: skill 0.337508, relative MASE 0.783332, relative WQL 0.560293, group skills {'term': {'short': 0.30112159439110886, 'medium': 0.3882128168958763, 'long': 0.3763449044348186}, 'domain': {'Econ/Fin': 0.012010642573481944, 'Energy': 0.1687336419481582, 'Healthcare': 0.33847751009406857, 'Nature': 0.4038059435050727, 'Sales': 0.32920024652725177, 'Transport': 0.4463400575252827, 'Web/CloudOps': 0.4950030531002031}, 'freq': {'A-DEC': 0.2973561434987757, 'Q-DEC': 0.17698071591831765, 'M': 0.07233297868059718, 'W-SUN': -0.2582996069171355, 'D': 0.3346112879714367, 'H': 0.36855118351366944, '15T': 0.14569114456054433, 'W-FRI': 0.021432593572035197, '10T': 0.5064176027092252, 'W-TUE': 0.3132256284193611, 'W-THU': 0.1516542652623164, 'W-WED': 0.29198895648742507, '5T': 0.5121886153783087, '10S': 0.38181456512243606}}. +- tau=8: skill 0.339730, relative MASE 0.781190, relative WQL 0.558067, group skills {'term': {'short': 0.30468677533784194, 'medium': 0.3890128603479147, 'long': 0.3768542253336602}, 'domain': {'Econ/Fin': 0.04357586882889164, 'Energy': 0.17060177779549268, 'Healthcare': 0.3292576172809155, 'Nature': 0.4040895491577191, 'Sales': 0.32915095007230155, 'Transport': 0.4455718893158739, 'Web/CloudOps': 0.498582535356759}, 'freq': {'A-DEC': 0.30427943534005153, 'Q-DEC': 0.18739632573970566, 'M': 0.05811644843967234, 'W-SUN': -0.14993519310493708, 'D': 0.33691177813304396, 'H': 0.36800946318922256, '15T': 0.15562275067857723, 'W-FRI': 0.015293948848938421, '10T': 0.5022238811405833, 'W-TUE': 0.308852394109824, 'W-THU': 0.16531962754891327, 'W-WED': 0.29198895648742507, '5T': 0.5124270255950129, '10S': 0.3959332124123227}}. +- tau=24: skill 0.341604, relative MASE 0.780976, relative WQL 0.555056, group skills {'term': {'short': 0.30735425505077896, 'medium': 0.38984232067302926, 'long': 0.37791322023985785}, 'domain': {'Econ/Fin': 0.07789629542475163, 'Energy': 0.16814859423491146, 'Healthcare': 0.32219860777640197, 'Nature': 0.4027938268275436, 'Sales': 0.32911299366848257, 'Transport': 0.4440214473788372, 'Web/CloudOps': 0.505502554697025}, 'freq': {'A-DEC': 0.30701454754159097, 'Q-DEC': 0.18894276751813088, 'M': 0.04173508991923269, 'W-SUN': -0.06710914169849702, 'D': 0.33891978173454174, 'H': 0.36806701600948255, '15T': 0.16691265843751302, 'W-FRI': 0.011149977535114819, '10T': 0.48062823437029445, 'W-TUE': 0.3054618645258299, 'W-THU': 0.17135723270801106, 'W-WED': 0.29198895648742507, '5T': 0.5128629288387704, '10S': 0.42606586812368186}}. +- tau=64: skill 0.340824, relative MASE 0.783313, relative WQL 0.554713, group skills {'term': {'short': 0.3064164746371565, 'medium': 0.38779908004530583, 'long': 0.3787937309532532}, 'domain': {'Econ/Fin': 0.09969949435020342, 'Energy': 0.15974598777640392, 'Healthcare': 0.3189527251466179, 'Nature': 0.4009254556920715, 'Sales': 0.32909545704191134, 'Transport': 0.44166143132149305, 'Web/CloudOps': 0.5103628293774518}, 'freq': {'A-DEC': 0.3079352359976604, 'Q-DEC': 0.18879190434187287, 'M': 0.03049481695615497, 'W-SUN': -0.03231570437562303, 'D': 0.33992332397958547, 'H': 0.36593420410508737, '15T': 0.1654947222236236, 'W-FRI': 0.009213828856730832, '10T': 0.46016772262416383, 'W-TUE': 0.3040006089982843, 'W-THU': 0.17343046632698478, 'W-WED': 0.29198895648742507, '5T': 0.5128850832828526, '10S': 0.4486615108502494}}. +- tau=128: skill 0.338292, relative MASE 0.786639, relative WQL 0.556618, group skills {'term': {'short': 0.3043668884529205, 'medium': 0.38176748757743373, 'long': 0.37868472074438897}, 'domain': {'Econ/Fin': 0.10637792737302931, 'Energy': 0.1531270206619928, 'Healthcare': 0.31816668045459984, 'Nature': 0.39985518410953147, 'Sales': 0.3290895550941987, 'Transport': 0.4399018505526925, 'Web/CloudOps': 0.5082609219137205}, 'freq': {'A-DEC': 0.3082114553822066, 'Q-DEC': 0.1886335736447592, 'M': 0.026327746733658897, 'W-SUN': -0.021307580325764297, 'D': 0.34025742210101806, 'H': 0.3625439077766571, '15T': 0.1628300810039216, 'W-FRI': 0.00856370190545519, '10T': 0.4513327819863723, 'W-TUE': 0.30351149262807786, 'W-THU': 0.1740816133131421, 'W-WED': 0.29198895648742507, '5T': 0.512369368619311, '10S': 0.44352723463256316}}. + +## E12 continuity prior, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.336914; relative MASE 0.783869; relative WQL 0.560914. +- term skill: long=0.3705, medium=0.3876, short=0.3028. +- domain skill: Econ/Fin=0.0580, Energy=0.1590, Healthcare=0.3286, Nature=0.4018, Sales=0.3415, Transport=0.4438, Web/CloudOps=0.4980. +- frequency skill: A=0.2499, D=0.3408, H=0.3619, M=0.0606, Q=0.1682, S=0.4261, T=0.3809, W=0.1368. +- variates skill: multivariate=0.3731, univariate=0.3066. +- Outcome: Full validation skill 0.336914 versus 0.330109 without the correction, relative MASE 0.783869 and relative WQL 0.560914; zero failures. Package inference took 69.8 seconds while three trainers shared the sole H100. Selected for atomic publication. + +## E11 corpus_control_ema1000 +- Checkpoint SHA-256: `f81bf26e2a17265332fdb3b29204d140703d7c3e9d9abdd7e3297715a7b1153a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.393452167510986 seconds. +- Overall skill 0.335216; relative MASE 0.787169; relative WQL 0.561427. +- term skill: long=0.3757, medium=0.3878, short=0.2973. +- domain skill: Econ/Fin=-0.0001, Energy=0.1627, Healthcare=0.3427, Nature=0.4053, Sales=0.3297, Transport=0.4460, Web/CloudOps=0.4926. +- frequency skill: A=0.3085, D=0.3314, H=0.3702, M=0.0765, Q=0.1659, S=0.3764, T=0.3820, W=0.1191. +- variates skill: multivariate=0.3656, univariate=0.3100. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_control_ema3000 +- Checkpoint SHA-256: `c72daec0504f6082965d689dd9a9f1a7005ac0d9694fb8d4de3d2622db9d615b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.011096715927124 seconds. +- Overall skill 0.334832; relative MASE 0.787218; relative WQL 0.562040. +- term skill: long=0.3765, medium=0.3877, short=0.2963. +- domain skill: Econ/Fin=0.0014, Energy=0.1632, Healthcare=0.3213, Nature=0.4049, Sales=0.3317, Transport=0.4468, Web/CloudOps=0.4939. +- frequency skill: A=0.2922, D=0.3214, H=0.3695, M=0.0723, Q=0.1640, S=0.3781, T=0.3850, W=0.1283. +- variates skill: multivariate=0.3670, univariate=0.3081. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_control_ema6000 +- Checkpoint SHA-256: `fa23c895ff4926b3d0df6d15267718a1dda41ad9386abbfef1306becb262da1c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.355180501937866 seconds. +- Overall skill 0.334809; relative MASE 0.788444; relative WQL 0.561205. +- term skill: long=0.3770, medium=0.3879, short=0.2960. +- domain skill: Econ/Fin=-0.0139, Energy=0.1615, Healthcare=0.3361, Nature=0.4053, Sales=0.3305, Transport=0.4466, Web/CloudOps=0.4951. +- frequency skill: A=0.2945, D=0.3215, H=0.3707, M=0.0639, Q=0.1501, S=0.3778, T=0.3855, W=0.1254. +- variates skill: multivariate=0.3680, univariate=0.3071. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema1000 +- Checkpoint SHA-256: `8c0f66d7a2377fa37b4d3358c89ae9b5786a6f5f0223b1480fb7a0b20b17ebc8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.571230411529541 seconds. +- Overall skill 0.333782; relative MASE 0.789135; relative WQL 0.562448. +- term skill: long=0.3749, medium=0.3867, short=0.2955. +- domain skill: Econ/Fin=-0.0143, Energy=0.1614, Healthcare=0.3302, Nature=0.4029, Sales=0.3292, Transport=0.4472, Web/CloudOps=0.4938. +- frequency skill: A=0.2932, D=0.3308, H=0.3695, M=0.0696, Q=0.1628, S=0.3754, T=0.3818, W=0.1103. +- variates skill: multivariate=0.3653, univariate=0.3075. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema3000 +- Checkpoint SHA-256: `51586b5ce1a426dc2f3adf42aba9599b731b62ab316159dafe681e77317015a2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.598361253738403 seconds. +- Overall skill 0.333836; relative MASE 0.789352; relative WQL 0.562201. +- term skill: long=0.3750, medium=0.3869, short=0.2954. +- domain skill: Econ/Fin=-0.0087, Energy=0.1631, Healthcare=0.3250, Nature=0.4036, Sales=0.3303, Transport=0.4468, Web/CloudOps=0.4922. +- frequency skill: A=0.3132, D=0.3259, H=0.3690, M=0.0696, Q=0.1693, S=0.3752, T=0.3829, W=0.1162. +- variates skill: multivariate=0.3659, univariate=0.3071. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema6000 +- Checkpoint SHA-256: `b82b9da6afa6b7ec864a5c4f9829a2a68b29f0923d0c556a998b9d79623d9ba9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.799206972122192 seconds. +- Overall skill 0.333432; relative MASE 0.790380; relative WQL 0.562151. +- term skill: long=0.3759, medium=0.3881, short=0.2938. +- domain skill: Econ/Fin=-0.0272, Energy=0.1621, Healthcare=0.3299, Nature=0.4047, Sales=0.3298, Transport=0.4459, Web/CloudOps=0.4936. +- frequency skill: A=0.3024, D=0.3227, H=0.3691, M=0.0639, Q=0.1574, S=0.3794, T=0.3834, W=0.1166. +- variates skill: multivariate=0.3662, univariate=0.3061. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E5 direct_large_ema12000_gate +- Checkpoint SHA-256: `202e23ba9d7560bf2bd67a609d024449facabdfd338c9268bc013ff6b613168f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.02167820930481 seconds. +- Overall skill 0.314336; relative MASE 0.813757; relative WQL 0.577734. +- term skill: long=0.3670, medium=0.3868, short=0.2623. +- domain skill: Econ/Fin=-0.0160, Energy=0.1404, Healthcare=0.2477, Nature=0.3897, Sales=0.3170, Transport=0.4355, Web/CloudOps=0.4760. +- frequency skill: A=0.3627, D=0.3141, H=0.3649, M=-0.1520, Q=0.1593, S=0.3730, T=0.3518, W=0.1342. +- variates skill: multivariate=0.3564, univariate=0.2788. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema16000_gate +- Checkpoint SHA-256: `8ba1220059af5a85180b3ad740402a48b2d38172598510da796339378e529a73`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.176010131835938 seconds. +- Overall skill 0.322612; relative MASE 0.806599; relative WQL 0.568877. +- term skill: long=0.3668, medium=0.3875, short=0.2777. +- domain skill: Econ/Fin=0.0042, Energy=0.1444, Healthcare=0.3056, Nature=0.3937, Sales=0.3266, Transport=0.4361, Web/CloudOps=0.4847. +- frequency skill: A=0.3573, D=0.3049, H=0.3646, M=-0.0462, Q=0.1603, S=0.3803, T=0.3607, W=0.1797. +- variates skill: multivariate=0.3644, univariate=0.2874. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema20000_gate +- Checkpoint SHA-256: `1ec9d54fa1270442b0023da3f7fc23f5fa5291e58210a55f63878983afccc606`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.57221269607544 seconds. +- Overall skill 0.324943; relative MASE 0.805088; relative WQL 0.566028. +- term skill: long=0.3666, medium=0.3878, short=0.2821. +- domain skill: Econ/Fin=0.0218, Energy=0.1439, Healthcare=0.2912, Nature=0.4039, Sales=0.3250, Transport=0.4352, Web/CloudOps=0.4880. +- frequency skill: A=0.3533, D=0.3058, H=0.3660, M=-0.0485, Q=0.1544, S=0.3756, T=0.3665, W=0.1840. +- variates skill: multivariate=0.3678, univariate=0.2887. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema2000_gate +- Checkpoint SHA-256: `bea7fbebdc754a6cef068a4b835e644d896305e928b4a63974c731874dc49028`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.918560028076172 seconds. +- Overall skill 0.279056; relative MASE 0.848285; relative WQL 0.612718. +- term skill: long=0.3485, medium=0.3540, short=0.2185. +- domain skill: Econ/Fin=-0.0871, Energy=0.1232, Healthcare=0.1986, Nature=0.3855, Sales=0.3094, Transport=0.3731, Web/CloudOps=0.4269. +- frequency skill: A=0.3054, D=0.2729, H=0.3360, M=-0.1424, Q=0.1034, S=0.3706, T=0.2968, W=0.1303. +- variates skill: multivariate=0.3283, univariate=0.2373. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema24000_gate +- Checkpoint SHA-256: `e5bb7f70c0adbf61b4292cfc40a419e6757854a255ef0c47d3d47c7f2d68b7a2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.641167879104614 seconds. +- Overall skill 0.323234; relative MASE 0.806197; relative WQL 0.568114. +- term skill: long=0.3665, medium=0.3864, short=0.2795. +- domain skill: Econ/Fin=0.0385, Energy=0.1492, Healthcare=0.2588, Nature=0.4037, Sales=0.3217, Transport=0.4347, Web/CloudOps=0.4807. +- frequency skill: A=0.3645, D=0.3062, H=0.3653, M=-0.0563, Q=0.1548, S=0.3766, T=0.3656, W=0.1664. +- variates skill: multivariate=0.3653, univariate=0.2877. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema4000_gate +- Checkpoint SHA-256: `2f45a9ce8bed8e0e3ebe37ba98ac36ab8b9a630a615856760f46c0763fa78b5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.853939056396484 seconds. +- Overall skill 0.296679; relative MASE 0.830007; relative WQL 0.595971. +- term skill: long=0.3569, medium=0.3692, short=0.2413. +- domain skill: Econ/Fin=-0.0411, Energy=0.1331, Healthcare=0.1511, Nature=0.3889, Sales=0.3253, Transport=0.4031, Web/CloudOps=0.4590. +- frequency skill: A=0.3534, D=0.2760, H=0.3509, M=-0.1255, Q=0.1495, S=0.3734, T=0.3314, W=0.1185. +- variates skill: multivariate=0.3480, univariate=0.2530. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema8000_gate +- Checkpoint SHA-256: `1b15662821b8c7a20d973f548dacabd237f470ffd1c75457c0b92011d3f0cc88`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.06697702407837 seconds. +- Overall skill 0.310188; relative MASE 0.816631; relative WQL 0.582688. +- term skill: long=0.3619, medium=0.3788, short=0.2604. +- domain skill: Econ/Fin=-0.0143, Energy=0.1404, Healthcare=0.2015, Nature=0.3934, Sales=0.3255, Transport=0.4210, Web/CloudOps=0.4744. +- frequency skill: A=0.3680, D=0.2929, H=0.3581, M=-0.0609, Q=0.1607, S=0.3679, T=0.3513, W=0.1178. +- variates skill: multivariate=0.3533, univariate=0.2739. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step12000_gate +- Checkpoint SHA-256: `8788d76e331dcd9cca1d6dab37db34b4c8b1257fc83da49b532c11643cd0ebfa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.492464065551758 seconds. +- Overall skill 0.304901; relative MASE 0.821804; relative WQL 0.587930. +- term skill: long=0.3555, medium=0.3694, short=0.2575. +- domain skill: Econ/Fin=-0.0110, Energy=0.1063, Healthcare=0.2456, Nature=0.3830, Sales=0.2991, Transport=0.4416, Web/CloudOps=0.4763. +- frequency skill: A=0.3131, D=0.3025, H=0.3517, M=-0.0499, Q=0.1271, S=0.3821, T=0.3324, W=0.1350. +- variates skill: multivariate=0.3451, univariate=0.2712. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step16000_gate +- Checkpoint SHA-256: `beb43e784be8db8ee5ec14e83fa9c68f7ce897790441453eb6d72cceedb80650`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.434912919998169 seconds. +- Overall skill 0.311197; relative MASE 0.820659; relative WQL 0.578132. +- term skill: long=0.3577, medium=0.3731, short=0.2667. +- domain skill: Econ/Fin=-0.0270, Energy=0.1289, Healthcare=0.2653, Nature=0.3904, Sales=0.3264, Transport=0.4341, Web/CloudOps=0.4732. +- frequency skill: A=0.3445, D=0.2986, H=0.3593, M=-0.0768, Q=0.1596, S=0.3715, T=0.3463, W=0.1472. +- variates skill: multivariate=0.3513, univariate=0.2775. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step20000_gate +- Checkpoint SHA-256: `9332e5088244bd4a2a1ad5b6470a108ebaa6bc387a525202f6bf954d9796b1a6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.937657117843628 seconds. +- Overall skill 0.319529; relative MASE 0.811224; relative WQL 0.570793. +- term skill: long=0.3661, medium=0.3842, short=0.2737. +- domain skill: Econ/Fin=0.0113, Energy=0.1395, Healthcare=0.3332, Nature=0.3983, Sales=0.3058, Transport=0.4236, Web/CloudOps=0.4804. +- frequency skill: A=0.3483, D=0.3114, H=0.3599, M=-0.0666, Q=0.1435, S=0.3671, T=0.3551, W=0.1967. +- variates skill: multivariate=0.3633, univariate=0.2825. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step2000_gate +- Checkpoint SHA-256: `f16c3270e2d4adafc8dbc1416687932a81b040bed29ad21887f7f8953437ba86`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.376563549041748 seconds. +- Overall skill 0.284757; relative MASE 0.840864; relative WQL 0.608389. +- term skill: long=0.3356, medium=0.3611, short=0.2319. +- domain skill: Econ/Fin=-0.0840, Energy=0.1152, Healthcare=0.2242, Nature=0.3840, Sales=0.3264, Transport=0.3898, Web/CloudOps=0.4386. +- frequency skill: A=0.2579, D=0.2746, H=0.3418, M=-0.0497, Q=0.1253, S=0.3787, T=0.2935, W=0.1458. +- variates skill: multivariate=0.3309, univariate=0.2458. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step24000_gate +- Checkpoint SHA-256: `b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.831688165664673 seconds. +- Overall skill 0.326279; relative MASE 0.802486; relative WQL 0.565617. +- term skill: long=0.3671, medium=0.3874, short=0.2845. +- domain skill: Econ/Fin=0.0453, Energy=0.1487, Healthcare=0.3262, Nature=0.4087, Sales=0.3234, Transport=0.4251, Web/CloudOps=0.4821. +- frequency skill: A=0.3544, D=0.3106, H=0.3612, M=-0.0014, Q=0.1548, S=0.3765, T=0.3668, W=0.1910. +- variates skill: multivariate=0.3662, univariate=0.2927. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step4000_gate +- Checkpoint SHA-256: `a085c48b8bac06dba51118942d58b632dfc8fd934455232b2f1f7c7329f1ae76`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.682147979736328 seconds. +- Overall skill 0.291006; relative MASE 0.830831; relative WQL 0.605023. +- term skill: long=0.3451, medium=0.3504, short=0.2444. +- domain skill: Econ/Fin=-0.0403, Energy=0.0877, Healthcare=0.2367, Nature=0.3707, Sales=0.3185, Transport=0.4275, Web/CloudOps=0.4638. +- frequency skill: A=0.2862, D=0.2949, H=0.3327, M=-0.1134, Q=0.1567, S=0.3705, T=0.3243, W=0.1248. +- variates skill: multivariate=0.3352, univariate=0.2538. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step8000_gate +- Checkpoint SHA-256: `7c0ca8d6f3023ecefc12818560b9bac64e044102cb27d478978c48ce82276c38`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.785595417022705 seconds. +- Overall skill 0.307945; relative MASE 0.812528; relative WQL 0.589444. +- term skill: long=0.3650, medium=0.3688, short=0.2592. +- domain skill: Econ/Fin=-0.0843, Energy=0.1539, Healthcare=0.1762, Nature=0.3845, Sales=0.3220, Transport=0.4223, Web/CloudOps=0.4730. +- frequency skill: A=0.3235, D=0.2684, H=0.3578, M=-0.0688, Q=0.1156, S=0.3591, T=0.3615, W=0.1148. +- variates skill: multivariate=0.3471, univariate=0.2751. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E13/E14 matched large-model continuations +- Parent: raw E5 step 24000 (random-init pretraining here, seed 23), selected after final gated and sign-symmetric/continuity comparisons. +- Three runs share seed 43, batch 256, 6,000 steps, AdamW 8e-5 with 400-step warmup/cosine decay, the original packed sample, and the E8 median/seasonal-error-weighted objective. All use EMA. GPU: the one H100; three CPU threads per trainer. +- large_loss: unchanged synthetic generator, control for applying E8 loss to the larger model. +- large_synth: replace half of the 20% synthetic windows with newly generated integrated colored innovations, stochastic local-linear trends with level shifts, or sharp periodic pulses with slowly drifting amplitude. Generator is in large_synth/data.py; no external synthetic assets. +- large_sign: independently negate each sampled context and target with probability 0.5. Context seasonal scales are sign-invariant. Data RNG is shared with augmentation, so later draws diverge from the control despite the matched seed; this is a single-seed comparison. +- All inference rules remain fixed (sign symmetry, seasonal confidence gate and 24-step continuity). Results pending. + +## E15 final-checkpoint ensemble +- Hypothesis: the differently trained small and large models have complementary median and distribution errors. Fixed equal weights, both members forecast every instance. E8 EMA6000 (seed31 continuation of seed17) plus E5 raw24000 (seed23). Same fixed inference rules applied separately before averaging. +- Cached prediction diagnostic skill 0.344733 exceeds the small model 0.341604 and large model 0.343219. Actual bundled inference and full validation are required before publication. + +## E15 actual bundled ensemble screening +- Checkpoint SHA-256: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.611496925354004 seconds. +- Overall skill 0.344715; relative MASE 0.780210; relative WQL 0.550363. +- term skill: long=0.3780, medium=0.3928, short=0.3118. +- domain skill: Econ/Fin=0.0849, Energy=0.1725, Healthcare=0.3305, Nature=0.4119, Sales=0.3307, Transport=0.4448, Web/CloudOps=0.5036. +- frequency skill: A=0.2873, D=0.3348, H=0.3699, M=0.0563, Q=0.1938, S=0.4258, T=0.3912, W=0.1713. +- variates skill: multivariate=0.3825, univariate=0.3130. +- Outcome: Actual package inference skill 0.344715, within 0.000019 of cached averaging; zero failures. The difference comes from numerical batching. Full package inference remains required. + +## E15 bundled ensemble, full validation +- Checkpoint SHA-256: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.340239; relative MASE 0.782773; relative WQL 0.556081. +- term skill: long=0.3706, medium=0.3906, short=0.3076. +- domain skill: Econ/Fin=0.0668, Energy=0.1633, Healthcare=0.3369, Nature=0.4112, Sales=0.3436, Transport=0.4446, Web/CloudOps=0.4963. +- frequency skill: A=0.2315, D=0.3371, H=0.3638, M=0.0773, Q=0.1704, S=0.4258, T=0.3837, W=0.1660. +- variates skill: multivariate=0.3783, univariate=0.3083. +- Outcome: Full skill 0.340239, relative MASE 0.782773, relative WQL 0.556081, zero failed configurations. Improves the previous published 0.336914. Relocated package inference took 119.3 seconds while three 37M trainers shared the sole H100. Repeated example calls were bitwise identical, finite and monotone. Selected for atomic publication. + +## E16 earlier-window diagnostic +- Hypothesis: a second cutoff reveals whether gains on single-series configurations are stable over time. +- Constructed the immediately preceding nonoverlapping window from each selected validation context (never used for training). All 97 configurations remain; short histories with fewer than H+8 points are omitted. Seasonal-error scales use the available capped prefix and Seasonal Naive is recomputed on that same input, so these are diagnostic scores on a separate scale. +- The small E8 EMA6000 model improves from 0.308552 without continuity to 0.314127 with it. The large parent scores 0.312321; the first sign-augmented checkpoint scores 0.312240. Thus continuity is supported at both cutoffs, while the first sign-augmentation gain does not yet repeat on the earlier cutoff. No weights or rules are adapted on the diagnostic contexts. + +## Full-validation checkpoint identity audit +- valid-report-1000.json: `ebdd9eaa223c2bb6e38b8faec6f465a227fcd735b654a26f3b617a757addb0d3`, skill 0.206132. +- valid-report-4000-gate.json: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`, skill 0.296168. +- valid-report-swa-gate.json: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`, skill 0.315325. +- valid-report-symmetric.json: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`, skill 0.323978. +- valid-report-objective.json: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`, skill 0.330109. +- valid-report-continuity.json: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`, skill 0.336914. +- valid-report-ensemble.json: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`, skill 0.340239. + +## E13/E14 large_loss_ema1000_continuity +- Checkpoint SHA-256: `872c92ee27b0d63f310b7be7434ffe3d5342b19a42d48fefd0a468b87501b28e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.880280256271362 seconds. +- Overall skill 0.342546; relative MASE 0.782779; relative WQL 0.552194. +- term skill: long=0.3792, medium=0.3907, short=0.3082. +- domain skill: Econ/Fin=0.0879, Energy=0.1741, Healthcare=0.2781, Nature=0.4155, Sales=0.3277, Transport=0.4454, Web/CloudOps=0.5007. +- frequency skill: A=0.2788, D=0.3141, H=0.3715, M=0.0511, Q=0.1869, S=0.4248, T=0.3925, W=0.1774. +- variates skill: multivariate=0.3827, univariate=0.3087. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_loss_ema3000_continuity +- Checkpoint SHA-256: `18c2788192e4028dd45255512b1c4bcddf12a50eb813e34fa0987b8949d75f15`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.631194829940796 seconds. +- Overall skill 0.345993; relative MASE 0.778768; relative WQL 0.549233. +- term skill: long=0.3793, medium=0.3902, short=0.3147. +- domain skill: Econ/Fin=0.0850, Energy=0.1714, Healthcare=0.3423, Nature=0.4181, Sales=0.3281, Transport=0.4479, Web/CloudOps=0.5015. +- frequency skill: A=0.2956, D=0.3232, H=0.3727, M=0.0705, Q=0.1917, S=0.4274, T=0.3904, W=0.1972. +- variates skill: multivariate=0.3829, univariate=0.3150. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_loss_ema6000_continuity +- Checkpoint SHA-256: `f5c7327b365832e8bd2d1b7b01e61c334f5bf620f5cae5f4d45feef2041090e8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.797317266464233 seconds. +- Overall skill 0.346864; relative MASE 0.778052; relative WQL 0.548275. +- term skill: long=0.3803, medium=0.3907, short=0.3157. +- domain skill: Econ/Fin=0.0848, Energy=0.1765, Healthcare=0.3460, Nature=0.4171, Sales=0.3275, Transport=0.4491, Web/CloudOps=0.4990. +- frequency skill: A=0.2988, D=0.3201, H=0.3724, M=0.0715, Q=0.1909, S=0.4236, T=0.3942, W=0.2029. +- variates skill: multivariate=0.3831, univariate=0.3165. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema1000_continuity +- Checkpoint SHA-256: `393950048f9d0487869b7aa5e6bd01e7ea1715dba16b1367ee8be353eac7f408`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.772316932678223 seconds. +- Overall skill 0.347448; relative MASE 0.776694; relative WQL 0.548252. +- term skill: long=0.3829, medium=0.3908, short=0.3157. +- domain skill: Econ/Fin=0.0975, Energy=0.1743, Healthcare=0.3647, Nature=0.4116, Sales=0.3348, Transport=0.4489, Web/CloudOps=0.5001. +- frequency skill: A=0.3764, D=0.3250, H=0.3728, M=0.0605, Q=0.1918, S=0.4294, T=0.3920, W=0.1973. +- variates skill: multivariate=0.3811, univariate=0.3193. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema3000_continuity +- Checkpoint SHA-256: `24a38240b540c1311317103b880d4be47e17b7de883f535ef95977a3acc596dd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.933598279953003 seconds. +- Overall skill 0.348060; relative MASE 0.775887; relative WQL 0.547794. +- term skill: long=0.3822, medium=0.3909, short=0.3171. +- domain skill: Econ/Fin=0.1095, Energy=0.1761, Healthcare=0.3575, Nature=0.4106, Sales=0.3331, Transport=0.4503, Web/CloudOps=0.5000. +- frequency skill: A=0.3842, D=0.3252, H=0.3741, M=0.0510, Q=0.1966, S=0.4324, T=0.3901, W=0.2089. +- variates skill: multivariate=0.3815, univariate=0.3201. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema6000_continuity +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.297121286392212 seconds. +- Overall skill 0.349298; relative MASE 0.774499; relative WQL 0.546694. +- term skill: long=0.3853, medium=0.3928, short=0.3172. +- domain skill: Econ/Fin=0.1160, Energy=0.1799, Healthcare=0.3608, Nature=0.4057, Sales=0.3338, Transport=0.4511, Web/CloudOps=0.5017. +- frequency skill: A=0.3836, D=0.3247, H=0.3752, M=0.0334, Q=0.1968, S=0.4300, T=0.3937, W=0.2168. +- variates skill: multivariate=0.3827, univariate=0.3214. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema1000_continuity +- Checkpoint SHA-256: `c04fc8cad141754a2cb540b636cc3ac7744554cc85e201b4b291e777b2aee196`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.066582441329956 seconds. +- Overall skill 0.343871; relative MASE 0.781301; relative WQL 0.551010. +- term skill: long=0.3732, medium=0.3938, short=0.3118. +- domain skill: Econ/Fin=0.1001, Energy=0.1746, Healthcare=0.2638, Nature=0.4169, Sales=0.3281, Transport=0.4461, Web/CloudOps=0.5042. +- frequency skill: A=0.3050, D=0.3243, H=0.3716, M=-0.0066, Q=0.1903, S=0.4298, T=0.3943, W=0.1851. +- variates skill: multivariate=0.3847, univariate=0.3094. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema3000_continuity +- Checkpoint SHA-256: `aa73bdf3e3b2d44e69c716f2dc788789949b96d69f4cd92c2b0169bfd4dc89ce`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.854033946990967 seconds. +- Overall skill 0.343138; relative MASE 0.782085; relative WQL 0.551689. +- term skill: long=0.3690, medium=0.3946, short=0.3119. +- domain skill: Econ/Fin=0.1103, Energy=0.1771, Healthcare=0.2214, Nature=0.4199, Sales=0.3279, Transport=0.4472, Web/CloudOps=0.5016. +- frequency skill: A=0.2856, D=0.3228, H=0.3725, M=0.0162, Q=0.1940, S=0.4277, T=0.3929, W=0.1727. +- variates skill: multivariate=0.3849, univariate=0.3079. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema6000_continuity +- Checkpoint SHA-256: `f23469b8d187d0304e0accdc424ddd2233ed87dd77b97500176eec73644e0591`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.708917140960693 seconds. +- Overall skill 0.343184; relative MASE 0.781828; relative WQL 0.551793. +- term skill: long=0.3706, medium=0.3947, short=0.3112. +- domain skill: Econ/Fin=0.1127, Energy=0.1747, Healthcare=0.2160, Nature=0.4195, Sales=0.3267, Transport=0.4485, Web/CloudOps=0.5041. +- frequency skill: A=0.2764, D=0.3186, H=0.3736, M=0.0181, Q=0.1970, S=0.4302, T=0.3934, W=0.1723. +- variates skill: multivariate=0.3851, univariate=0.3077. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E16 earlier-window diagnostic large_loss6000 +- Checkpoint SHA-256: `f5c7327b365832e8bd2d1b7b01e61c334f5bf620f5cae5f4d45feef2041090e8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.924073696136475 seconds. +- Overall skill 0.311219; relative MASE 0.824887; relative WQL 0.575132. +- term skill: long=0.3825, medium=0.3465, short=0.2673. +- domain skill: Econ/Fin=0.1171, Energy=0.2168, Healthcare=0.3670, Nature=0.3256, Sales=0.3803, Transport=0.3468, Web/CloudOps=0.4260. +- frequency skill: A=0.2543, D=0.3358, H=0.3410, M=0.1505, Q=0.2187, S=0.3402, T=0.3096, W=0.2343. +- variates skill: multivariate=0.3301, univariate=0.2958. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_parent +- Checkpoint SHA-256: `b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 15.111237525939941 seconds. +- Overall skill 0.312321; relative MASE 0.824141; relative WQL 0.573812. +- term skill: long=0.3880, medium=0.3443, short=0.2678. +- domain skill: Econ/Fin=0.1255, Energy=0.2150, Healthcare=0.3460, Nature=0.3326, Sales=0.3821, Transport=0.3403, Web/CloudOps=0.4349. +- frequency skill: A=0.2124, D=0.3388, H=0.3399, M=0.1428, Q=0.2091, S=0.3387, T=0.3160, W=0.2326. +- variates skill: multivariate=0.3359, univariate=0.2930. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_sign1000 +- Checkpoint SHA-256: `393950048f9d0487869b7aa5e6bd01e7ea1715dba16b1367ee8be353eac7f408`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 14.428916931152344 seconds. +- Overall skill 0.312240; relative MASE 0.821151; relative WQL 0.576037. +- term skill: long=0.3855, medium=0.3437, short=0.2691. +- domain skill: Econ/Fin=0.1296, Energy=0.2106, Healthcare=0.3560, Nature=0.3340, Sales=0.3905, Transport=0.3466, Web/CloudOps=0.4302. +- frequency skill: A=0.3161, D=0.3390, H=0.3442, M=0.1574, Q=0.2111, S=0.3426, T=0.3054, W=0.2304. +- variates skill: multivariate=0.3287, univariate=0.2988. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_sign6000 +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.61752462387085 seconds. +- Overall skill 0.318367; relative MASE 0.813893; relative WQL 0.570866. +- term skill: long=0.3826, medium=0.3453, short=0.2811. +- domain skill: Econ/Fin=0.1456, Energy=0.2164, Healthcare=0.3902, Nature=0.3427, Sales=0.3912, Transport=0.3501, Web/CloudOps=0.4291. +- frequency skill: A=0.3181, D=0.3498, H=0.3477, M=0.1673, Q=0.2198, S=0.3427, T=0.3048, W=0.2686. +- variates skill: multivariate=0.3320, univariate=0.3073. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_synth6000 +- Checkpoint SHA-256: `f23469b8d187d0304e0accdc424ddd2233ed87dd77b97500176eec73644e0591`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.829549789428711 seconds. +- Overall skill 0.311804; relative MASE 0.824530; relative WQL 0.574404. +- term skill: long=0.3704, medium=0.3520, short=0.2715. +- domain skill: Econ/Fin=0.1602, Energy=0.2091, Healthcare=0.3496, Nature=0.3283, Sales=0.3808, Transport=0.3477, Web/CloudOps=0.4301. +- frequency skill: A=0.2270, D=0.3331, H=0.3416, M=0.1436, Q=0.2168, S=0.3434, T=0.3110, W=0.2438. +- variates skill: multivariate=0.3289, univariate=0.2979. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic small_continuity +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 12.578126668930054 seconds. +- Overall skill 0.314127; relative MASE 0.818301; relative WQL 0.574876. +- term skill: long=0.3797, medium=0.3430, short=0.2755. +- domain skill: Econ/Fin=0.1152, Energy=0.2137, Healthcare=0.3801, Nature=0.3283, Sales=0.3845, Transport=0.3460, Web/CloudOps=0.4366. +- frequency skill: A=0.2537, D=0.3362, H=0.3448, M=0.1858, Q=0.2208, S=0.3366, T=0.3083, W=0.2433. +- variates skill: multivariate=0.3331, univariate=0.2986. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic small_no_continuity +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 11.378507137298584 seconds. +- Overall skill 0.308552; relative MASE 0.826361; relative WQL 0.578561. +- term skill: long=0.3803, medium=0.3416, short=0.2654. +- domain skill: Econ/Fin=0.0571, Energy=0.2115, Healthcare=0.3152, Nature=0.3257, Sales=0.3845, Transport=0.3471, Web/CloudOps=0.4427. +- frequency skill: A=0.2363, D=0.3288, H=0.3546, M=0.1261, Q=0.1813, S=0.3403, T=0.3019, W=0.2031. +- variates skill: multivariate=0.3334, univariate=0.2881. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E14 final sign-augmented single model, full validation +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.344508; relative MASE 0.777383; relative WQL 0.552713. +- term skill: long=0.3776, medium=0.3912, short=0.3123. +- domain skill: Econ/Fin=0.0926, Energy=0.1707, Healthcare=0.3648, Nature=0.4053, Sales=0.3446, Transport=0.4514, Web/CloudOps=0.4943. +- frequency skill: A=0.2937, D=0.3275, H=0.3694, M=0.0521, Q=0.1776, S=0.4300, T=0.3859, W=0.2124. +- variates skill: multivariate=0.3784, univariate=0.3162. +- Outcome: Full skill 0.344508, relative MASE 0.777383, relative WQL 0.552713, zero failures. Outperforms the published two-model ensemble (0.340239) and also improves the earlier-cutoff diagnostic. Full inference 57.2 s. Relocated repeated example calls are bitwise deterministic, finite and monotone. Selected for atomic publication. + +## E18 remove symmetric inference after sign-augmented training +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 13.020774841308594 seconds. +- Overall skill 0.345482; relative MASE 0.778014; relative WQL 0.550625. +- term skill: long=0.3817, medium=0.3909, short=0.3125. +- domain skill: Econ/Fin=0.1197, Energy=0.1784, Healthcare=0.3304, Nature=0.4074, Sales=0.3304, Transport=0.4474, Web/CloudOps=0.4960. +- frequency skill: A=0.3782, D=0.3248, H=0.3710, M=0.0198, Q=0.1916, S=0.4321, T=0.3889, W=0.2113. +- variates skill: multivariate=0.3767, univariate=0.3195. +- Outcome: Negative result: removing the x/-x average lowers screening skill from 0.349298 to 0.345482 despite sign-augmented training. We retain symmetric inference; the speed saving is not needed for the contract budget. + +## E17 16-point projection conversion before continuation +- Checkpoint SHA-256: `d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 17.147535800933838 seconds. +- Overall skill 0.341987; relative MASE 0.782323; relative WQL 0.553456. +- term skill: long=0.3765, medium=0.3855, short=0.3105. +- domain skill: Econ/Fin=0.0851, Energy=0.1664, Healthcare=0.3542, Nature=0.4067, Sales=0.3482, Transport=0.4386, Web/CloudOps=0.4996. +- frequency skill: A=0.2894, D=0.3469, H=0.3634, M=-0.0442, Q=0.1930, S=0.4414, T=0.3853, W=0.1987. +- variates skill: multivariate=0.3808, univariate=0.3093. +- Outcome: Conversion of our own E14 EMA6000 checkpoint loses screening skill from 0.349298 to 0.341987 before updates. Input/query projection halves are folded by summation, constant-feature activation preserved, first 16 output rows retained, and physical sine positions remain in 32-point units. No external weights. Continuation is needed. + +## E17 matched patch-resolution continuation +- Hypothesis: finer patches improve short-horizon detail and align common seasonal periods more closely without shortening context. +- Control: 32-point patches, 37,002,816 parameters; treatment: 16-point patches, 36,764,960 parameters, initialized by conversion of the same owned parent E14 EMA6000. Only patch projections and positional spacing change. Physical position units remain 32 points; metadata horizon is floored at 32 to preserve short-horizon conditioning. +- Both use the same window stream: seed47, batch256, 6000steps, AdamW8e-5, same sign-augmented sampler and median/seasonal-error-weighted loss/EMA. Context remains4096, maximum output1024. One H100 shared between runs. +- Conversion code: patch16/convert.py. The converted checkpoint retains its parent hash and conversion description. Training and runtime require the model in patch16/model.py, copied to patch16_inference/model.py. Results pending final matched checkpoints. + +## E17 patch16_trial_ema1000 +- Checkpoint SHA-256: `396a7e827e8ddd068535f96f590e710f1931818c4e0b4cc589648bf68c830ba1`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.109450101852417 seconds. +- Overall skill 0.348957; relative MASE 0.771301; relative WQL 0.549536. +- term skill: long=0.3832, medium=0.3926, short=0.3175. +- domain skill: Econ/Fin=0.0969, Energy=0.1735, Healthcare=0.3953, Nature=0.4077, Sales=0.3495, Transport=0.4526, Web/CloudOps=0.4982. +- frequency skill: A=0.3699, D=0.3389, H=0.3688, M=0.0874, Q=0.1860, S=0.4381, T=0.3905, W=0.1934. +- variates skill: multivariate=0.3799, univariate=0.3232. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch16_trial_ema3000 +- Checkpoint SHA-256: `aad4bb2f079c957b1c2a064fc245e660bd9992bf0a01b57c9a48b0d33a44436e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 13.450159549713135 seconds. +- Overall skill 0.348611; relative MASE 0.772343; relative WQL 0.549378. +- term skill: long=0.3843, medium=0.3974, short=0.3144. +- domain skill: Econ/Fin=0.1014, Energy=0.1753, Healthcare=0.3863, Nature=0.4037, Sales=0.3479, Transport=0.4516, Web/CloudOps=0.4997. +- frequency skill: A=0.3647, D=0.3298, H=0.3718, M=0.0756, Q=0.1866, S=0.4393, T=0.3930, W=0.1879. +- variates skill: multivariate=0.3823, univariate=0.3204. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch16_trial_ema6000 +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.25124716758728 seconds. +- Overall skill 0.351398; relative MASE 0.770359; relative WQL 0.546090. +- term skill: long=0.3847, medium=0.3993, short=0.3185. +- domain skill: Econ/Fin=0.1048, Energy=0.1768, Healthcare=0.3969, Nature=0.4061, Sales=0.3499, Transport=0.4528, Web/CloudOps=0.5033. +- frequency skill: A=0.3673, D=0.3318, H=0.3738, M=0.0802, Q=0.1913, S=0.4391, T=0.3969, W=0.1924. +- variates skill: multivariate=0.3843, univariate=0.3240. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema1000 +- Checkpoint SHA-256: `56edd93dd7e80399be57a359574b2fb89eba843fa1ddf01f1d3f3a2d9c2fd73b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 12.499926567077637 seconds. +- Overall skill 0.347764; relative MASE 0.775926; relative WQL 0.548263. +- term skill: long=0.3840, medium=0.3930, short=0.3148. +- domain skill: Econ/Fin=0.1090, Energy=0.1783, Healthcare=0.3531, Nature=0.4057, Sales=0.3333, Transport=0.4508, Web/CloudOps=0.5005. +- frequency skill: A=0.3826, D=0.3190, H=0.3738, M=0.0404, Q=0.1937, S=0.4305, T=0.3927, W=0.2146. +- variates skill: multivariate=0.3815, univariate=0.3196. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema3000 +- Checkpoint SHA-256: `fe46ac478011854b20eeba3bbde42023f299e2d8544d223f046be0e234ae7c6e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.177376747131348 seconds. +- Overall skill 0.349507; relative MASE 0.774280; relative WQL 0.546496. +- term skill: long=0.3853, medium=0.3964, short=0.3160. +- domain skill: Econ/Fin=0.1062, Energy=0.1803, Healthcare=0.3631, Nature=0.4048, Sales=0.3322, Transport=0.4510, Web/CloudOps=0.5041. +- frequency skill: A=0.3765, D=0.3187, H=0.3755, M=0.0515, Q=0.1928, S=0.4362, T=0.3953, W=0.2095. +- variates skill: multivariate=0.3848, univariate=0.3199. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema6000 +- Checkpoint SHA-256: `3ee55007ebabdc41a5bbb6553dcd0c4b86e90b717dd1cff758d2318f538c0929`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.685351848602295 seconds. +- Overall skill 0.350171; relative MASE 0.774332; relative WQL 0.545345. +- term skill: long=0.3851, medium=0.3971, short=0.3171. +- domain skill: Econ/Fin=0.1122, Energy=0.1816, Healthcare=0.3633, Nature=0.4023, Sales=0.3323, Transport=0.4516, Web/CloudOps=0.5054. +- frequency skill: A=0.3791, D=0.3172, H=0.3768, M=0.0518, Q=0.1910, S=0.4349, T=0.3964, W=0.2119. +- variates skill: multivariate=0.3854, univariate=0.3207. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E19 prefix-consistent direct decoder +- Hypothesis: requested total horizon should not change predictions of the same first steps. The context-only probe compared H48 versus H720 after all inference rules; mean absolute median-prefix differences were 0.0059–0.0582 context standard deviations across six sampled configurations (prefix_probe.json). +- Change: future-query self-attention becomes causal and the total-horizon metadata feature is replaced by its constant training-mixture mean. Forecasts remain direct and parallel; no generated output is fed back. Encoder/cross attention and all data/loss settings stay unchanged. +- Seed47, batch256, 6000steps, same original E14 EMA6000 parent and sampled-window stream as E17 patch32_control. Reuse that completed control instead of repeating it. Only the new decoder variant trains. Runtime/model: prefix_consistent/model.py, copied into prefix_inference. +- Results pending. + +## E17 patch16, full validation +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.346729; relative MASE 0.773486; relative WQL 0.551739. +- term skill: long=0.3768, medium=0.3979, short=0.3138. +- domain skill: Econ/Fin=0.0839, Energy=0.1675, Healthcare=0.4022, Nature=0.4059, Sales=0.3593, Transport=0.4530, Web/CloudOps=0.4957. +- frequency skill: A=0.2818, D=0.3356, H=0.3684, M=0.0967, Q=0.1741, S=0.4391, T=0.3887, W=0.1870. +- variates skill: multivariate=0.3799, univariate=0.3190. +- Outcome: Full skill 0.346729, relative MASE 0.773486 and relative WQL 0.551739, zero failures; improves the previous published 0.344508. Inference 57.5 seconds. Earlier-window skill 0.322486 versus control 0.319021. Relocated repeated example outputs are bitwise identical, finite and monotone. Initial assembly failed on a symlinked lineage path, was never published, and was rebuilt after canonicalizing paths; the missing-output score from that failed pipeline is discarded. + +## E19 prefix_consistent_ema1000 +- Checkpoint SHA-256: `aa797f3356c30e1859821bd807202298774b8d44b59b8325cc73956796a83b21`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.920389413833618 seconds. +- Overall skill 0.347132; relative MASE 0.775797; relative WQL 0.549418. +- term skill: long=0.3820, medium=0.3928, short=0.3146. +- domain skill: Econ/Fin=0.1091, Energy=0.1769, Healthcare=0.3709, Nature=0.4082, Sales=0.3333, Transport=0.4492, Web/CloudOps=0.4954. +- frequency skill: A=0.3824, D=0.3200, H=0.3727, M=0.0361, Q=0.1918, S=0.4265, T=0.3902, W=0.2278. +- variates skill: multivariate=0.3798, univariate=0.3199. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E19 prefix_consistent_ema3000 +- Checkpoint SHA-256: `11094f18080cd31f38a7f33d1df852adc957d9f1705653360b21e790e55b6648`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.28545594215393 seconds. +- Overall skill 0.348148; relative MASE 0.775101; relative WQL 0.548201. +- term skill: long=0.3814, medium=0.3951, short=0.3158. +- domain skill: Econ/Fin=0.1060, Energy=0.1786, Healthcare=0.3758, Nature=0.4101, Sales=0.3323, Transport=0.4489, Web/CloudOps=0.4963. +- frequency skill: A=0.3799, D=0.3215, H=0.3735, M=0.0487, Q=0.1876, S=0.4294, T=0.3915, W=0.2202. +- variates skill: multivariate=0.3812, univariate=0.3206. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E19 prefix_consistent_ema6000 +- Checkpoint SHA-256: `2572d0401c85966c3936b3feed906dee4206ca403a778c2356406aca57988ef7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.322679996490479 seconds. +- Overall skill 0.349313; relative MASE 0.774658; relative WQL 0.546555. +- term skill: long=0.3800, medium=0.3960, short=0.3181. +- domain skill: Econ/Fin=0.1130, Energy=0.1774, Healthcare=0.3765, Nature=0.4114, Sales=0.3328, Transport=0.4502, Web/CloudOps=0.4987. +- frequency skill: A=0.3795, D=0.3224, H=0.3737, M=0.0589, Q=0.1895, S=0.4294, T=0.3930, W=0.2214. +- variates skill: multivariate=0.3825, univariate=0.3216. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E20: learned cross-variable adapter on the frozen E17 backbone +Hypothesis: a jointly trained attention layer can exploit synchronized channels, especially on multivariate energy and weather series. Only a new 1.05M-parameter axial attention adapter is optimized; every backbone weight is frozen. Adapter output starts at zero, and univariate contexts bypass it exactly. Attention is confined to the channels of one instance. Context rows are grouped by whole instance in inference. +Training: seed 53, 6,000 steps, 32 groups per batch, 2/3/4/8 variates, learning rate 2e-4 with 200-step warmup, AdamW, same median/quantile seasonal-scaled objective as E17, EMA. Joint pack has 334,868,547 aligned observations from 26 allow-listed directories. Thirty percent locally generated multivariate series use mixtures of latent seasonal/AR drivers with random channel lags, optional integrated noise, and observation noise. Channel signs/scales and missing observations are augmented. No validation observations are used by training. The new adapter is zero-initialized so step 0 supplies an inference grouping control. + +## E21: longer context at inference, without retraining +Hypothesis: the encoder can benefit from histories longer than its 4,096-point training maximum. Hold E17 weights and all rules fixed and compare 8,192/16,384-point context caps with the current 4,096-point cap on all 97 screen configurations. This is a selection diagnostic, not adaptation; checkpoint tensor values are unchanged. + +## E22: function-preserving depth expansion +Hypothesis: more learned capacity can improve the persistent energy and economic errors. Expand E17 from 6 encoder/4 decoder layers to 12 encoder/8 decoder layers, 72,499,488 parameters. Keep original blocks at even positions and insert random blocks with zero attention and feedforward output projections at odd positions. The initial enlarged model produces bitwise identical quantiles in a synthetic bf16 forward check. Conversion seed 59; both the expanded model and a continued 36.8M control will use seed 59, identical sampled windows, sign augmentation, revised seasonal-scaled median/quantile loss, and 24,000 AdamW steps, batch 256, learning rate 8e-5. Data remains packed_sample from 95 allowed sources plus the original local generator. GPU jobs share the single H100 if overlapping; elapsed training-process seconds will be reported. + +## E21 untrained 8192 context cap +- Checkpoint SHA-256: `4cdcd096105c711926d1be912debeecf2999cc4e70389385ea60e516a211d035`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.263309001922607 seconds. +- Overall skill 0.350147; relative MASE 0.769937; relative WQL 0.548498. +- term skill: long=0.3906, medium=0.3940, short=0.3160. +- domain skill: Econ/Fin=0.1042, Energy=0.1740, Healthcare=0.4046, Nature=0.3925, Sales=0.3499, Transport=0.4581, Web/CloudOps=0.5047. +- frequency skill: A=0.3673, D=0.3338, H=0.3751, M=0.0802, Q=0.1913, S=0.4410, T=0.3905, W=0.1924. +- variates skill: multivariate=0.3814, univariate=0.3241. +- Outcome: Screen skill 0.350147 is below the 4096-point parent 0.351398. Not selected. + +## E21 untrained 16384 context cap +- Checkpoint SHA-256: `a7504466f8d21bf752f3d99c32927a57cd63d0af5d5f15618ef4e8e1bdbeeb47`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.697236776351929 seconds. +- Overall skill 0.347052; relative MASE 0.771167; relative WQL 0.552852. +- term skill: long=0.3936, medium=0.3900, short=0.3107. +- domain skill: Econ/Fin=0.1042, Energy=0.1694, Healthcare=0.4046, Nature=0.3838, Sales=0.3499, Transport=0.4577, Web/CloudOps=0.5032. +- frequency skill: A=0.3673, D=0.3345, H=0.3752, M=0.0802, Q=0.1913, S=0.4410, T=0.3807, W=0.1924. +- variates skill: multivariate=0.3779, univariate=0.3214. +- Outcome: Below the 4096-point parent; longer context needs training and is not selected. + +## E23: fixed local-level diffusion prior (negative result) +Hypothesis: smooth series might benefit from a decaying blend with their last value and random-walk intervals. Keep E17 forecasts fixed, estimate RMS consecutive differences from the last 512 context points, and blend Gaussian last-value forecasts with weight capped at 0.8, active only where squared-difference/context-variance ratio is below 0.05. Sweep decay 24/96/384 steps; no training, no fitting, no new random seed. All variants substantially regress on the 97-configuration screen, so none is adopted. Probe elapsed 5.3 CPU seconds. Parent checkpoint SHA-256: 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. +- Decay 0: skill 0.3513976241007074; term skills {"short": 0.3185422008330211, "medium": 0.3993234467710519, "long": 0.38466658538687104}; domain skills {"Econ/Fin": 0.1047749678551001, "Energy": 0.17678999618615132, "Healthcare": 0.3968888878939394, "Nature": 0.4060764075001204, "Sales": 0.349917064856452, "Transport": 0.4527521728604965, "Web/CloudOps": 0.50332745421581}. +- Decay 24: skill 0.34165742688714285; term skills {"short": 0.30882663252618237, "medium": 0.38422047231265555, "long": 0.3803807240673608}; domain skills {"Econ/Fin": 0.09820862504146799, "Energy": 0.14638236482304767, "Healthcare": 0.3994101685341417, "Nature": 0.4097541459355638, "Sales": 0.34991701707454004, "Transport": 0.45281938688271317, "Web/CloudOps": 0.49437598362265067}. +- Decay 96: skill 0.3235906270632306; term skills {"short": 0.30736381494165377, "medium": 0.31870169010171356, "long": 0.3688721255257502}; domain skills {"Econ/Fin": 0.09505897302445243, "Energy": 0.1285464282539771, "Healthcare": 0.3977611664977332, "Nature": 0.41574057336372194, "Sales": 0.34991700862256025, "Transport": 0.45284743770041946, "Web/CloudOps": 0.43886394048274135}. +- Decay 384: skill 0.28712372958270105; term skills {"short": 0.30561653681994894, "medium": 0.2119589494208397, "long": 0.3091633781775974}; domain skills {"Econ/Fin": 0.09383616546291695, "Energy": 0.10801096739511007, "Healthcare": 0.3957240300486188, "Nature": 0.4179314810204363, "Sales": 0.3499170061816316, "Transport": 0.4526991548827556, "Web/CloudOps": 0.3016411139705769}. + +## E20 joint adapter full validation +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.348181; relative MASE 0.773070; relative WQL 0.549586. +- term skill: long=0.3789, medium=0.3973, short=0.3159. +- domain skill: Econ/Fin=0.0839, Energy=0.1670, Healthcare=0.4022, Nature=0.4151, Sales=0.3593, Transport=0.4530, Web/CloudOps=0.4958. +- frequency skill: A=0.2818, D=0.3370, H=0.3714, M=0.0967, Q=0.1741, S=0.4354, T=0.3901, W=0.1878. +- variates skill: multivariate=0.3830, univariate=0.3190. +- Outcome: Full validation improves from 0.346729 to 0.348181 with no failures. Main screen improves from 0.351398 to 0.352838, but the earlier-window diagnostic regresses from 0.322486 to 0.321225. Selected on the task full validation metric, with this temporal limitation recorded. Training 157.8 process seconds on the single shared H100; full inference 63.7 seconds excluding startup. Frozen backbone equality, within-instance isolation, and repeated relocated example determinism verified. + +## E20 joint adapter screen +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.721086978912354 seconds. +- Overall skill 0.352838; relative MASE 0.769945; relative WQL 0.543959. +- term skill: long=0.3868, medium=0.3987, short=0.3205. +- domain skill: Econ/Fin=0.1048, Energy=0.1763, Healthcare=0.3969, Nature=0.4152, Sales=0.3499, Transport=0.4528, Web/CloudOps=0.5034. +- frequency skill: A=0.3673, D=0.3332, H=0.3768, M=0.0802, Q=0.1913, S=0.4354, T=0.3982, W=0.1932. +- variates skill: multivariate=0.3874, univariate=0.3240. +- Outcome: The added adapter improves weather forecasts most; some ETT and cloud configurations regress. Original univariate forecasts are unchanged. + +## E20 joint adapter earlier-window diagnostic +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 16.06979727745056 seconds. +- Overall skill 0.321225; relative MASE 0.812345; relative WQL 0.567168. +- term skill: long=0.3839, medium=0.3520, short=0.2830. +- domain skill: Econ/Fin=0.1423, Energy=0.2143, Healthcare=0.3841, Nature=0.3485, Sales=0.3968, Transport=0.3596, Web/CloudOps=0.4341. +- frequency skill: A=0.3026, D=0.3536, H=0.3503, M=0.1681, Q=0.2189, S=0.3405, T=0.3157, W=0.2466. +- variates skill: multivariate=0.3338, univariate=0.3110. +- Outcome: Temporal diagnostic regression; this limits confidence in the small primary-validation gain. + +## E24: seasonal-template recency +Hypothesis: averaging the last four cycles induces bias when level or amplitude changes. Compare fixed 4/2/1-cycle means, four-cycle mean shifted to the latest cycle mean, and exponentially weighted four-cycle mean. The rest of the E17 forecaster and all confidence thresholds are fixed. Validation only; no parameter fitting. Centering improves the main screen 0.351398 to 0.353163 but decreases the earlier-window diagnostic 0.322486 to 0.321979. Other variants show larger temporal disagreement. Detailed per-configuration and group results remain in research/seasonal_recency/{screen,backcast}.json. Probe runtime: 15.3 and 15.0 CPU seconds. No variant published yet. + +## E25: learned recency features +Hypothesis: adding level and amplitude change features to future queries lets the model learn when seasonal recency matters, instead of imposing a uniform template rule. Add a zero-initialized 32,768-parameter query projection receiving, for each of the two periods, latest-cycle minus four-cycle mean and the phase template times the latest/four-cycle standard deviation ratio minus one. Ratios are clipped to [0.5,2]; features require three observed cycles. Existing query and median heads stay structurally unchanged. Starting function is preserved; all weights are then trained. Same seed 59, parent E17, 24,000-step learning-rate schedule, batch 256 and identical sampler stream as E22's 36.8M control. Checkpoints every 3,000 steps; an unpromising trial can be stopped early. No validation data is used by training. + +## E26: second earlier-cutoff diagnostic +Create a second nonoverlapping diagnostic window by removing another forecast horizon from E16 inputs. All observations remain within supplied validation histories and are never passed to trainers. 94 configurations and 8,934 instances have usable normalizers; Seasonal Naive and seasonal-error normalizers are recomputed for these prefixes. This diagnostic has its own scale and cannot be compared directly to primary validation or held-out reward. Purpose: assess temporal stability of the adapter and recency changes after the first earlier diagnostic disagreed with primary validation. + +E26 eligibility correction: SZ_TAXI long has exactly one seasonal period (96 points) left, so its prefix seasonal error is undefined. It is excluded from this diagnostic, alongside two configurations with insufficient context. An initial reference attempt detected the undefined metric; no candidate was selected on that invalid draft. + +E26 paired comparison on the 94 common configurations: adapter minus parent mean log geometric error by cutoff = [-0.0023015101916589752, 0.0019472848873323858, 0.0034041402255075566]. Positive means worse; the three-cutoff mean is 0.0010166383070603225. The adapter improves primary full validation but regresses on both earlier cutoffs, so its apparent gain is not temporally robust. + +E24 complete recency-rule ablation; parent checkpoint SHA-256 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. No training, no random seed; model weights unchanged. + +screen diagnostic, 15.3 CPU seconds total: +- (4, 'mean'): skill 0.3513976241007074; group skills {"term": {"short": 0.3185422008330211, "medium": 0.3993234467710519, "long": 0.38466658538687104}, "domain": {"Econ/Fin": 0.1047749678551001, "Energy": 0.17678999618615132, "Healthcare": 0.3968888878939394, "Nature": 0.4060764075001204, "Sales": 0.349917064856452, "Transport": 0.4527521728604965, "Web/CloudOps": 0.50332745421581}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19127390925064935, "M": 0.08024694183722458, "W-SUN": 0.035758619864346475, "D": 0.3318015817783623, "H": 0.37383534533108864, "15T": 0.1940857197364374, "W-FRI": -0.03678057554518466, "10T": 0.4946120106982924, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5069054537063827, "10S": 0.43906058031696027}} +- (2, 'mean'): skill 0.3515869592249251; group skills {"term": {"short": 0.31946055343361235, "medium": 0.395564454113736, "long": 0.3871567716641673}, "domain": {"Econ/Fin": 0.12253197026836216, "Energy": 0.18298948886090993, "Healthcare": 0.39741811166060514, "Nature": 0.40643913101885387, "Sales": 0.34900834734187824, "Transport": 0.45646747263938636, "Web/CloudOps": 0.4921796292797348}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19172301173815798, "M": 0.07891640026491331, "W-SUN": 0.04042355013060539, "D": 0.3321769544067552, "H": 0.38073675441614074, "15T": 0.20117188206554237, "W-FRI": -0.03695866316509533, "10T": 0.49452343668884957, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5070472862431538, "10S": 0.3973951356554515}} +- (1, 'mean'): skill 0.3435908999493934; group skills {"term": {"short": 0.3116909988543801, "medium": 0.38160533975903543, "long": 0.384670295110323}, "domain": {"Econ/Fin": 0.13426770743669836, "Energy": 0.18216526583305703, "Healthcare": 0.40167072012279914, "Nature": 0.4064404130881688, "Sales": 0.3492754711813856, "Transport": 0.4589127441324581, "Web/CloudOps": 0.45693278131755455}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19143020771042418, "M": 0.08285832779020297, "W-SUN": 0.04327272071755062, "D": 0.33288417189993846, "H": 0.38267829909706397, "15T": 0.19937252608994493, "W-FRI": -0.037004579119138015, "10T": 0.4945270610078465, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067187989779461, "10S": 0.25271387987938276}} +- (4, 'centered'): skill 0.3531633226160329; group skills {"term": {"short": 0.3207293873053654, "medium": 0.3969450585806461, "long": 0.38964518179731034}, "domain": {"Econ/Fin": 0.12636396756466373, "Energy": 0.1800705780909143, "Healthcare": 0.3992839589819721, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45585497734478375, "Web/CloudOps": 0.5005422814848317}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19175192579993316, "M": 0.07909511983098594, "W-SUN": 0.042408325150654624, "D": 0.33302767036606196, "H": 0.37896395394765425, "15T": 0.19862358212653608, "W-FRI": -0.03667482636982777, "10T": 0.49458872561779677, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067600572208003, "10S": 0.43120160792893125}} +- (4, 'exponential'): skill 0.3506285650976836; group skills {"term": {"short": 0.31758444696147214, "medium": 0.39583120771209657, "long": 0.38712405721550214}, "domain": {"Econ/Fin": 0.11941316839573946, "Energy": 0.1820733009344513, "Healthcare": 0.39881728965443064, "Nature": 0.4063573767251085, "Sales": 0.3492900874450249, "Transport": 0.45600364485060096, "Web/CloudOps": 0.4900268042948257}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19155754727480623, "M": 0.08126365276376935, "W-SUN": 0.0395554234837493, "D": 0.3321922474298862, "H": 0.3798686284876259, "15T": 0.19972610305133176, "W-FRI": -0.036894372612062964, "10T": 0.49455551047271673, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.507021365412977, "10S": 0.38828731350299905}} + +backcast diagnostic, 15.0 CPU seconds total: +- (4, 'mean'): skill 0.3224855500998881; group skills {"term": {"short": 0.2849500928667269, "medium": 0.35106641415497664, "long": 0.3858074289185036}, "domain": {"Econ/Fin": 0.14231294402320693, "Energy": 0.22033739564654398, "Healthcare": 0.38413791496286065, "Nature": 0.34419561689971845, "Sales": 0.3968014140531252, "Transport": 0.35961999575754544, "Web/CloudOps": 0.43501924471773445}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21891811984740894, "M": 0.16812726492063224, "W-SUN": -0.010729530876487425, "D": 0.35222355718445886, "H": 0.3519096502404674, "15T": 0.2228803711964017, "W-FRI": 0.24958026063282224, "10T": 0.28160966000223076, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41752089397176684, "10S": 0.3420520567149261}} +- (2, 'mean'): skill 0.31641087380554034; group skills {"term": {"short": 0.2768742380592605, "medium": 0.34943272384716806, "long": 0.38006754913357355}, "domain": {"Econ/Fin": 0.1588024863579226, "Energy": 0.21997369353201524, "Healthcare": 0.371350308865825, "Nature": 0.34524192786763674, "Sales": 0.3968014140531252, "Transport": 0.3617399277122316, "Web/CloudOps": 0.4078808317401613}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21832950345882607, "M": 0.1660037727174999, "W-SUN": -0.006617407115359519, "D": 0.3510532765644364, "H": 0.35322947177285846, "15T": 0.2251426669096147, "W-FRI": 0.2495544318494044, "10T": 0.28154255982923526, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.417584870977882, "10S": 0.23197125321775225}} +- (1, 'mean'): skill 0.31723500000228033; group skills {"term": {"short": 0.28111182113787236, "medium": 0.34369676593720844, "long": 0.3794207668157681}, "domain": {"Econ/Fin": 0.16484876593565279, "Energy": 0.2163334841815111, "Healthcare": 0.34937996041769215, "Nature": 0.3461425603980003, "Sales": 0.3968014140531252, "Transport": 0.36432827783243815, "Web/CloudOps": 0.4170717985814322}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21811526606513132, "M": 0.17155750755784438, "W-SUN": -0.004083126467642861, "D": 0.34319459279654896, "H": 0.35193709208671076, "15T": 0.22385514627514524, "W-FRI": 0.249535867076202, "10T": 0.28142605167103807, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41764726501313276, "10S": 0.27470089184112967}} +- (4, 'centered'): skill 0.3219793532222529; group skills {"term": {"short": 0.28513766744425706, "medium": 0.34881946541915476, "long": 0.3853894132385529}, "domain": {"Econ/Fin": 0.15718749322076342, "Energy": 0.220305778786681, "Healthcare": 0.3623301744180454, "Nature": 0.34528108993797224, "Sales": 0.3968014140531252, "Transport": 0.3641900819387449, "Web/CloudOps": 0.4312095523303556}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21945119732749618, "M": 0.17114892410654747, "W-SUN": -0.005425657907346837, "D": 0.3478712397506638, "H": 0.3538545808265424, "15T": 0.22504062323947938, "W-FRI": 0.24955455634324242, "10T": 0.28170410454547445, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176757195719526, "10S": 0.32801909847059685}} +- (4, 'exponential'): skill 0.3212088988374776; group skills {"term": {"short": 0.282531844032045, "medium": 0.3501930275891618, "long": 0.386723067036399}, "domain": {"Econ/Fin": 0.15471014663681715, "Energy": 0.22088089450488246, "Healthcare": 0.3714910427574707, "Nature": 0.3450102784118355, "Sales": 0.3968014140531252, "Transport": 0.3619509561390626, "Web/CloudOps": 0.4275124121699033}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21855293965122158, "M": 0.16975398671452624, "W-SUN": -0.007489648663621784, "D": 0.3494275697398366, "H": 0.3534238823299253, "15T": 0.22624199923728783, "W-FRI": 0.24956090397954467, "10T": 0.28154140034619046, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176567607348064, "10S": 0.31322950674661665}} + +backcast2 diagnostic, 11.3 CPU seconds total: +- (4, 'mean'): skill 0.3455098962011296; group skills {"term": {"short": 0.3290580626564209, "medium": 0.3700339540817553, "long": 0.36380280474970406}, "domain": {"Econ/Fin": 0.08514981056677962, "Energy": 0.22004402556428637, "Healthcare": 0.34077993948093876, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.4089471064366391, "Web/CloudOps": 0.4235634025112891}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14846418792970395, "M": 0.1666731962215917, "W-SUN": 0.04822698344798482, "D": 0.4221052975732391, "H": 0.37954447462865715, "15T": 0.09066258444282005, "W-FRI": 0.10650868616967224, "10T": 0.4524242293365175, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45460956828782484, "10S": 0.2830610169711695}} +- (2, 'mean'): skill 0.34268288377692957; group skills {"term": {"short": 0.3260103214844039, "medium": 0.3650713522346687, "long": 0.36394907927583375}, "domain": {"Econ/Fin": 0.10626345560515471, "Energy": 0.21855508043330296, "Healthcare": 0.33494058443346464, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41262361590216645, "Web/CloudOps": 0.40733619806789245}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14853117890045908, "M": 0.15637649692786237, "W-SUN": 0.05109649829750129, "D": 0.4226979938774772, "H": 0.3810140667041473, "15T": 0.10084524164002151, "W-FRI": 0.10650868616967224, "10T": 0.4522402959584214, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45675628129488266, "10S": 0.20569731261667445}} +- (1, 'mean'): skill 0.3445039461555758; group skills {"term": {"short": 0.332077466515454, "medium": 0.3668808106296455, "long": 0.3542531601492346}, "domain": {"Econ/Fin": 0.10936035558443968, "Energy": 0.21764038800605967, "Healthcare": 0.3307656098951277, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41137296882664487, "Web/CloudOps": 0.4178001938815905}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14899214852623166, "M": 0.14771341656467907, "W-SUN": 0.05292218751297184, "D": 0.42303155789223856, "H": 0.3788342098211268, "15T": 0.10485120143271387, "W-FRI": 0.10650868616967224, "10T": 0.45177551404888616, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4576208051300459, "10S": 0.24855961647506852}} +- (4, 'centered'): skill 0.34598093527842033; group skills {"term": {"short": 0.3300325159298324, "medium": 0.3728154676891604, "long": 0.3603198134443867}, "domain": {"Econ/Fin": 0.10766883532595528, "Energy": 0.21948028584715717, "Healthcare": 0.3411805258187349, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41219265214646406, "Web/CloudOps": 0.4193348965687418}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14770244416717793, "M": 0.16665926477245963, "W-SUN": 0.05081321100071179, "D": 0.4226895384052014, "H": 0.3801908053318377, "15T": 0.10067740700220107, "W-FRI": 0.10650868616967224, "10T": 0.45281662963561176, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4517952090885672, "10S": 0.27767832330559383}} +- (4, 'exponential'): skill 0.3469706591030196; group skills {"term": {"short": 0.330791312305022, "medium": 0.3720978115862891, "long": 0.36385111952680094}, "domain": {"Econ/Fin": 0.1001234277395946, "Energy": 0.2202025077634595, "Healthcare": 0.336380045647639, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41155494383831315, "Web/CloudOps": 0.4258605737282435}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.1486686416475177, "M": 0.15834250660686766, "W-SUN": 0.05058427650785369, "D": 0.42264469285933903, "H": 0.38114337578655855, "15T": 0.10061532381315941, "W-FRI": 0.10650868616967224, "10T": 0.4522176935148189, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45594734272112136, "10S": 0.2839470264038111}} + +Centered four-cycle templates improve primary full validation and the second earlier diagnostic, while slightly reducing the first earlier diagnostic. They replace the joint adapter package: full validation 0.348797 versus adapter 0.348181, with better temporal stability. The joint adapter remains an archived experiment after worsening on both earlier cutoffs. + +## E24 centered seasonal template full validation +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.348797; relative MASE 0.771273; relative WQL 0.549826. +- term skill: long=0.3827, medium=0.3957, short=0.3161. +- domain skill: Econ/Fin=0.1051, Energy=0.1719, Healthcare=0.4042, Nature=0.4059, Sales=0.3592, Transport=0.4561, Web/CloudOps=0.4931. +- frequency skill: A=0.2818, D=0.3368, H=0.3739, M=0.0954, Q=0.1765, S=0.4312, T=0.3905, W=0.1880. +- variates skill: multivariate=0.3783, univariate=0.3243. +- Outcome: Published. Same 36,764,960 learned parameters as E17; fixed seasonal template now preserves four-cycle shape while aligning its mean to the latest cycle. Full validation 0.348797 with zero failures; screen 0.353163; earlier diagnostics 0.321979 and 0.345981. Full inference 79.6 seconds while three training processes shared the one H100. Repeated relocated examples bitwise identical, finite, monotone. + +## E27: quantile width calibration diagnostic +Hypothesis: the changed training objective and sign-averaged forecasts may change interval calibration relative to the early E3 width sweep. Hold current E24 medians fixed and compare global width multipliers 0.75, 1.0 and 1.25, preserving positivity and monotone deciles. No training or new random seed. Evaluate primary full validation and both earlier diagnostics; retain the same multiplier for every instance and horizon if adopted. Record per-configuration decile coverage to distinguish interval calibration from point-forecast errors. + +## E28: stronger seasonal-error scaling in the training loss +Hypothesis: the existing floor 0.25 and maximum weight 4 underweight highly predictable series, whose small seasonal-error denominators make small biases costly in MASE. Change only this loss factor to floor 0.05 and maximum weight 20. The weight is derived from training contexts only; no validation observations enter gradients. Same E17 parent, seed 59, batch 256, sampled windows, 8e-5 learning rate and 24,000-step schedule as E22 control. Assess at 3,000 and 6,000 steps before deciding whether to continue. No architecture or inference changes. All training processes use the same single H100. + +E27 completed: global interval-width calibration is unchanged. The 1.0 multiplier wins on all three cutoffs; 0.75 and 1.25 are rejected. Parent checkpoint SHA-256: 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. + +full, 21.961196422576904 CPU seconds: +- Width 0.75: skill 0.3452164549545038; group skills {"term": {"short": 0.313465550024141, "medium": 0.3915340298847654, "long": 0.37755696642578507}, "domain": {"Econ/Fin": 0.10580171688867446, "Energy": 0.16637482564763484, "Healthcare": 0.40914268073244664, "Nature": 0.4019524649941506, "Sales": 0.3530144630644825, "Transport": 0.4556672339606386, "Web/CloudOps": 0.4876214368641769}, "freq": {"A-DEC": 0.28725493449470174, "Q-DEC": 0.1801084712445944, "M": 0.11175276948966328, "W-SUN": 0.0323370845377442, "D": 0.3312199981338694, "H": 0.3695069715804825, "15T": 0.18168253390246492, "W-FRI": -0.056487631535321325, "10T": 0.49352637886384465, "W-TUE": 0.5378585205934543, "W-THU": 0.18433827097062172, "W-WED": 0.31349093490925006, "5T": 0.49222999321979144, "10S": 0.42390324244202104}} +- Width 1.0: skill 0.3487966789303172; group skills {"term": {"short": 0.3161336626027256, "medium": 0.3956796502512826, "long": 0.38269594016340247}, "domain": {"Econ/Fin": 0.10510484967413847, "Energy": 0.171919600185363, "Healthcare": 0.4042072222593659, "Nature": 0.40589812140398485, "Sales": 0.3591878025853771, "Transport": 0.4560779320618533, "Web/CloudOps": 0.4931146707071308}, "freq": {"A-DEC": 0.2818339423423022, "Q-DEC": 0.17653014662394806, "M": 0.09542703722254098, "W-SUN": 0.028486795465021086, "D": 0.336759380183841, "H": 0.3739148859162613, "15T": 0.18778774397400844, "W-FRI": -0.055524607369072276, "10T": 0.49458872561912703, "W-TUE": 0.552193186183172, "W-THU": 0.16944597281618878, "W-WED": 0.3192454710115562, "5T": 0.4977061545271937, "10S": 0.431201607928979}} +- Width 1.25: skill 0.34610650213535965; group skills {"term": {"short": 0.31181715347067873, "medium": 0.39425414652966917, "long": 0.3825681229603841}, "domain": {"Econ/Fin": 0.09501414185590251, "Energy": 0.17012785606235192, "Healthcare": 0.3929707629727902, "Nature": 0.4039288459201795, "Sales": 0.3578978997303499, "Transport": 0.4512528387663022, "Web/CloudOps": 0.49362461046923467}, "freq": {"A-DEC": 0.2690929347470029, "Q-DEC": 0.16432266959209074, "M": 0.07072014222773326, "W-SUN": 0.01173769854460438, "D": 0.3347121204957273, "H": 0.37299271990393135, "15T": 0.18526873151735845, "W-FRI": -0.07163417179692866, "10T": 0.49168735086319126, "W-TUE": 0.562370097705067, "W-THU": 0.14458649403408286, "W-WED": 0.32018515385552937, "5T": 0.4992200637780666, "10S": 0.43174911263031324}} + +backcast, 8.311058759689331 CPU seconds: +- Width 0.75: skill 0.31957721298205577; group skills {"term": {"short": 0.2849135227503923, "medium": 0.3430617259135954, "long": 0.3812505435660858}, "domain": {"Econ/Fin": 0.16020201234615272, "Energy": 0.21754177729190793, "Healthcare": 0.3694068614617043, "Nature": 0.3429441402339167, "Sales": 0.39134717268523767, "Transport": 0.36216325202164235, "Web/CloudOps": 0.42635659392097536}, "freq": {"A-DEC": 0.3052930254291859, "Q-DEC": 0.22988988761857532, "M": 0.17459013453754524, "W-SUN": 0.007398260950902569, "D": 0.3450062706602839, "H": 0.3480315684129901, "15T": 0.22233620685464417, "W-FRI": 0.30096387619142784, "10T": 0.27185481492835484, "W-TUE": 0.5329255178801061, "W-THU": 0.18370602390723068, "W-WED": 0.33814381573585706, "5T": 0.40916267988319677, "10S": 0.3313031636056427}} +- Width 1.0: skill 0.3219793532184254; group skills {"term": {"short": 0.28513766744059266, "medium": 0.34881946541549136, "long": 0.3853894132342357}, "domain": {"Econ/Fin": 0.15718749322715975, "Energy": 0.22030577879293345, "Healthcare": 0.3623301744205766, "Nature": 0.34528108990726747, "Sales": 0.39680141405427904, "Transport": 0.36419008193684854, "Web/CloudOps": 0.431209552326686}, "freq": {"A-DEC": 0.30258726544387415, "Q-DEC": 0.2194511972962907, "M": 0.1711489239900802, "W-SUN": -0.005425657920283156, "D": 0.3478712397620801, "H": 0.35385458082566135, "15T": 0.22504062321275653, "W-FRI": 0.24955455634173984, "10T": 0.2817041045341433, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316324492524, "W-WED": 0.3400228795175667, "5T": 0.41767571957575267, "10S": 0.32801909847013033}} +- Width 1.25: skill 0.31790201775956073; group skills {"term": {"short": 0.2784084543186459, "medium": 0.34919365386981416, "long": 0.38309258280714664}, "domain": {"Econ/Fin": 0.14485063305112178, "Energy": 0.2160406174537144, "Healthcare": 0.34843021568184673, "Nature": 0.3414042631923321, "Sales": 0.3949701602051685, "Transport": 0.36064559654919026, "Web/CloudOps": 0.43041506837139865}, "freq": {"A-DEC": 0.289217486212048, "Q-DEC": 0.20086669955100855, "M": 0.15692994437261798, "W-SUN": -0.02840754711998872, "D": 0.34384490006115054, "H": 0.35403896763656184, "15T": 0.21854779190662021, "W-FRI": 0.19508006514698906, "10T": 0.2864956555409153, "W-TUE": 0.4740288982750931, "W-THU": 0.15896541765809558, "W-WED": 0.3390816757566152, "5T": 0.42177642249121394, "10S": 0.3165112734495428}} + +backcast2, 8.009549379348755 CPU seconds: +- Width 0.75: skill 0.34409820450993134; group skills {"term": {"short": 0.3290162458924437, "medium": 0.3688383955368778, "long": 0.3584446274583232}, "domain": {"Econ/Fin": 0.1059670159637679, "Energy": 0.2168683811981844, "Healthcare": 0.3413880194250112, "Nature": 0.45062953387079285, "Sales": 0.5547232267111362, "Transport": 0.4100430663915112, "Web/CloudOps": 0.41729590695067253}, "freq": {"A-DEC": 0.34005157942217423, "Q-DEC": 0.1412869592685284, "M": 0.16881189749680703, "W-SUN": 0.047625092062016594, "D": 0.4231522928214516, "H": 0.37698957063440086, "15T": 0.0904235813541534, "W-FRI": 0.11812283700385673, "10T": 0.44881967454327965, "W-TUE": 0.07442882063540968, "W-THU": 0.2788710322691663, "W-WED": 0.5437864115591705, "5T": 0.444848784038935, "10S": 0.2913075712082248}} +- Width 1.0: skill 0.34598093529199403; group skills {"term": {"short": 0.33003251595401095, "medium": 0.3728154676872124, "long": 0.3603198134466531}, "domain": {"Econ/Fin": 0.10766883533558247, "Energy": 0.2194802858514432, "Healthcare": 0.34118052581938385, "Nature": 0.4518189405691444, "Sales": 0.5552026877071643, "Transport": 0.4121926521487488, "Web/CloudOps": 0.41933489656663536}, "freq": {"A-DEC": 0.33512027884784024, "Q-DEC": 0.14770244414049571, "M": 0.16665926486843274, "W-SUN": 0.05081321100210512, "D": 0.42268953844805357, "H": 0.3801908053296258, "15T": 0.10067740700216166, "W-FRI": 0.10650868616810949, "10T": 0.45281662963431724, "W-TUE": 0.0831470254212826, "W-THU": 0.2681259389949434, "W-WED": 0.5394413576971099, "5T": 0.45179520908580906, "10S": 0.2776783233055614}} +- Width 1.25: skill 0.3413902485820186; group skills {"term": {"short": 0.32419069585401805, "medium": 0.37023913422459476, "long": 0.35685627734091574}, "domain": {"Econ/Fin": 0.09962820431101826, "Energy": 0.21472017584206793, "Healthcare": 0.3337184668053308, "Nature": 0.44788650255350915, "Sales": 0.5519703061689909, "Transport": 0.4091113202517557, "Web/CloudOps": 0.41471225075769447}, "freq": {"A-DEC": 0.3220090566072281, "Q-DEC": 0.14689640454759956, "M": 0.15748943073554222, "W-SUN": 0.043428818988100804, "D": 0.4159786673838306, "H": 0.3773278172245832, "15T": 0.1020767647441726, "W-FRI": 0.08603022609757915, "10T": 0.45227993224331775, "W-TUE": 0.07815927778447074, "W-THU": 0.25035502046342106, "W-WED": 0.53163473233605, "5T": 0.4537783408350755, "10S": 0.2545513618912605}} + +Decile coverage uses <=, so ties at zero contribute excess lower-tail coverage on intermittent nonnegative series. Coverage alone is not evidence for changing intervals; the proper quantile loss favors the existing widths. + +## E22 control 3000-step checkpoint +- Checkpoint SHA-256: `8fcb7dd923c415a0a93261be09f4b29a73674bc6188f33afb50130d615643715`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 16.52501678466797 seconds. +- Overall skill 0.350784; relative MASE 0.771331; relative WQL 0.546434. +- term skill: long=0.3855, medium=0.3992, short=0.3171. +- domain skill: Econ/Fin=0.1025, Energy=0.1770, Healthcare=0.3901, Nature=0.4076, Sales=0.3484, Transport=0.4531, Web/CloudOps=0.5016. +- frequency skill: A=0.3699, D=0.3270, H=0.3752, M=0.0777, Q=0.1894, S=0.4382, T=0.3953, W=0.1970. +- variates skill: multivariate=0.3839, univariate=0.3232. +- Outcome: Matched continuation control; primary screen 0.350784. Continuing training. + +## E22 control 6000-step checkpoint +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.943427324295044 seconds. +- Overall skill 0.352399; relative MASE 0.769997; relative WQL 0.544661. +- term skill: long=0.3861, medium=0.4001, short=0.3195. +- domain skill: Econ/Fin=0.1064, Energy=0.1818, Healthcare=0.3888, Nature=0.4095, Sales=0.3482, Transport=0.4533, Web/CloudOps=0.5013. +- frequency skill: A=0.3691, D=0.3297, H=0.3767, M=0.0899, Q=0.1951, S=0.4372, T=0.3967, W=0.1945. +- variates skill: multivariate=0.3861, univariate=0.3242. +- Outcome: Screen 0.352399; 869.5 elapsed training-process seconds through this checkpoint on shared single H100. Continuing training. + +## E22 expanded depth 3000-step checkpoint +- Checkpoint SHA-256: `606808eaa8f41a4d8ffd7a336639c197cdb656b462d7b74cda0425a9c7b7ab88`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.74061632156372 seconds. +- Overall skill 0.349903; relative MASE 0.771470; relative WQL 0.547820. +- term skill: long=0.3846, medium=0.3995, short=0.3157. +- domain skill: Econ/Fin=0.1036, Energy=0.1753, Healthcare=0.3821, Nature=0.4103, Sales=0.3478, Transport=0.4524, Web/CloudOps=0.5003. +- frequency skill: A=0.3697, D=0.3271, H=0.3737, M=0.0851, Q=0.1912, S=0.4378, T=0.3939, W=0.1942. +- variates skill: multivariate=0.3823, univariate=0.3229. +- Outcome: Screen 0.349903 versus matched control 0.350784. 768.0 elapsed training-process seconds. Continuing to assess a longer run. + +## E25 learned recency 3000-step checkpoint +- Checkpoint SHA-256: `ff6465dac03192cfc5f8837d8c6ab9524b0fb81c1a73867ff6e08aaf83a53398`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.54782772064209 seconds. +- Overall skill 0.351702; relative MASE 0.770454; relative WQL 0.545509. +- term skill: long=0.3852, medium=0.3988, short=0.3191. +- domain skill: Econ/Fin=0.1014, Energy=0.1767, Healthcare=0.4078, Nature=0.4093, Sales=0.3476, Transport=0.4541, Web/CloudOps=0.5002. +- frequency skill: A=0.3707, D=0.3341, H=0.3745, M=0.0812, Q=0.1898, S=0.4360, T=0.3954, W=0.1980. +- variates skill: multivariate=0.3834, univariate=0.3253. +- Outcome: Screen 0.351702 versus matched control 0.350784. 510.3 elapsed training-process seconds. This is a modest early improvement; further checkpoints and temporal diagnostics remain. + +## E22 control 6000 with centered seasonal template, full validation +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.349953; relative MASE 0.770650; relative WQL 0.548317. +- term skill: long=0.3842, medium=0.3966, short=0.3172. +- domain skill: Econ/Fin=0.1065, Energy=0.1770, Healthcare=0.3987, Nature=0.4093, Sales=0.3570, Transport=0.4567, Web/CloudOps=0.4912. +- frequency skill: A=0.2855, D=0.3349, H=0.3766, M=0.1068, Q=0.1785, S=0.4296, T=0.3905, W=0.1906. +- variates skill: multivariate=0.3802, univariate=0.3248. +- Outcome: Published: full validation 0.349953 versus previous 0.348797, with zero failures. Earlier diagnostics improve to 0.322147 and 0.348634 from 0.321979 and 0.345981. Full inference took 98.8 seconds while four training processes shared the one H100. Repeated relocated example checks passed. Training continues beyond this milestone. + +## E22 control 6000 centered, earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.958669662475586 seconds. +- Overall skill 0.322147; relative MASE 0.812166; relative WQL 0.565752. +- term skill: long=0.3872, medium=0.3503, short=0.2840. +- domain skill: Econ/Fin=0.1531, Energy=0.2205, Healthcare=0.3579, Nature=0.3475, Sales=0.3966, Transport=0.3647, Web/CloudOps=0.4317. +- frequency skill: A=0.3153, D=0.3426, H=0.3545, M=0.1663, Q=0.2129, S=0.3286, T=0.3204, W=0.2542. +- variates skill: multivariate=0.3358, univariate=0.3111. +- Outcome: Small improvement over the preceding package. + +## E22 control 6000 centered, second earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.61665678024292 seconds. +- Overall skill 0.348634; relative MASE 0.779607; relative WQL 0.544220. +- term skill: long=0.3637, medium=0.3753, short=0.3325. +- domain skill: Econ/Fin=0.1024, Energy=0.2199, Healthcare=0.3508, Nature=0.4590, Sales=0.5576, Transport=0.4153, Web/CloudOps=0.4205. +- frequency skill: A=0.3380, D=0.4233, H=0.3833, M=0.1690, Q=0.1387, S=0.2800, T=0.3398, W=0.2426. +- variates skill: multivariate=0.3512, univariate=0.3465. +- Outcome: Improvement over the preceding package. + +## E29: coarse memory of older context (prepared) +Hypothesis: a separately trained memory can extract useful information from points 4,097–16,384 without changing the frozen backbone’s treatment of its recent 4,096 points. Older observations are normalized using the recent window and averaged in groups of four, then encoded by two extra blocks. A zero-output cross-attention projection adds this memory to recent encoder states. Initial function is preserved; recent seasonal and continuity rules remain unchanged. The added embedding and two encoder blocks start from copies of our own trained weights, and the cross-attention output starts at zero. No external weights. Total 44,401,952 parameters; 7,636,992 trainable. Eight-step batch-16 smoke run on allowed packed_sample with seed 67 produced finite weights and updated only the history module. Full training has not started. + +## E30: seasonal amplitude alignment +Hypothesis: four-cycle shape averaging also lags changes in seasonal amplitude. Starting from E24 centered templates, scale their deviations around the mean to the latest cycle standard deviation, correcting both variance estimates for observation noise inferred from seasonal differences. Scale ratio is clipped to [0.5,2], and amplitude alignment requires at least 75% finite observations in the latest cycle. All thresholds, intervals, learned weights and confidence gates remain fixed. Compare centered versus aligned templates on three diagnostic cutoffs using cached E17 raw forecasts; no training or new random seed. + +E30 initial amplitude-alignment results, parent checkpoint SHA-256 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3: + +screen, 7.7 CPU seconds total: +- (4, 'centered'): skill 0.3531633226160329; group skills {"term": {"short": 0.3207293873053654, "medium": 0.3969450585806461, "long": 0.38964518179731034}, "domain": {"Econ/Fin": 0.12636396756466373, "Energy": 0.1800705780909143, "Healthcare": 0.3992839589819721, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45585497734478375, "Web/CloudOps": 0.5005422814848317}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19175192579993316, "M": 0.07909511983098594, "W-SUN": 0.042408325150654624, "D": 0.33302767036606196, "H": 0.37896395394765425, "15T": 0.19862358212653608, "W-FRI": -0.03667482636982777, "10T": 0.49458872561779677, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067600572208003, "10S": 0.43120160792893125}} +- (4, 'aligned'): skill 0.35398462796791796; group skills {"term": {"short": 0.3217411363550048, "medium": 0.39832598201137914, "long": 0.3894451118078128}, "domain": {"Econ/Fin": 0.128986533479437, "Energy": 0.1846259909517678, "Healthcare": 0.3989632452392111, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45834957050423264, "Web/CloudOps": 0.4970505147956361}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.1913923357266032, "M": 0.07925704481777684, "W-SUN": 0.04248196090218248, "D": 0.332866037279251, "H": 0.38330094783509405, "15T": 0.20143473054459382, "W-FRI": -0.036466297970424444, "10T": 0.49454418004359824, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.506404214769247, "10S": 0.4192979394083295}} + +backcast, 8.3 CPU seconds total: +- (4, 'centered'): skill 0.3219793532222529; group skills {"term": {"short": 0.28513766744425706, "medium": 0.34881946541915476, "long": 0.3853894132385529}, "domain": {"Econ/Fin": 0.15718749322076342, "Energy": 0.220305778786681, "Healthcare": 0.3623301744180454, "Nature": 0.34528108993797224, "Sales": 0.3968014140531252, "Transport": 0.3641900819387449, "Web/CloudOps": 0.4312095523303556}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21945119732749618, "M": 0.17114892410654747, "W-SUN": -0.005425657907346837, "D": 0.3478712397506638, "H": 0.3538545808265424, "15T": 0.22504062323947938, "W-FRI": 0.24955455634324242, "10T": 0.28170410454547445, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176757195719526, "10S": 0.32801909847059685}} +- (4, 'aligned'): skill 0.32199923078598136; group skills {"term": {"short": 0.2839405542344856, "medium": 0.34882959423473925, "long": 0.38815021409803896}, "domain": {"Econ/Fin": 0.15740802100053652, "Energy": 0.21807242823144724, "Healthcare": 0.36213507616373974, "Nature": 0.3461350653810715, "Sales": 0.3968014140531252, "Transport": 0.3649195243648111, "Web/CloudOps": 0.4328434979914423}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.2183391142623865, "M": 0.1754893176389558, "W-SUN": -0.004377726385369485, "D": 0.3466775300728464, "H": 0.3524837610290207, "15T": 0.2254592175464284, "W-FRI": 0.24954835437149747, "10T": 0.2817431568124176, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41754999889925704, "10S": 0.3353593007357636}} + +backcast2, 9.4 CPU seconds total: +- (4, 'centered'): skill 0.34598093527842033; group skills {"term": {"short": 0.3300325159298324, "medium": 0.3728154676891604, "long": 0.3603198134443867}, "domain": {"Econ/Fin": 0.10766883532595528, "Energy": 0.21948028584715717, "Healthcare": 0.3411805258187349, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41219265214646406, "Web/CloudOps": 0.4193348965687418}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14770244416717793, "M": 0.16665926477245963, "W-SUN": 0.05081321100071179, "D": 0.4226895384052014, "H": 0.3801908053318377, "15T": 0.10067740700220107, "W-FRI": 0.10650868616967224, "10T": 0.45281662963561176, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4517952090885672, "10S": 0.27767832330559383}} +- (4, 'aligned'): skill 0.3467340001955017; group skills {"term": {"short": 0.3300823793890595, "medium": 0.3753689052243039, "long": 0.36094597324048516}, "domain": {"Econ/Fin": 0.10766542601267182, "Energy": 0.22063331078456605, "Healthcare": 0.33410091914860696, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.4141243473009397, "Web/CloudOps": 0.42142071217676347}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14888883016351762, "M": 0.15492673811864788, "W-SUN": 0.05041601533475526, "D": 0.4227650502464607, "H": 0.38160118363487416, "15T": 0.10559542335780892, "W-FRI": 0.10650868616967224, "10T": 0.4528840561650268, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45189525302575095, "10S": 0.2812440461970862}} + +The new rule improves all three aggregate diagnostics on the E17 weights. A complete package evaluation with the newer E22 control weights is in progress before adoption. + +E29 zero-initialization verification: all 97 screen configurations exactly reproduce the E17 centered runtime skill 0.3531633226160329. Evaluation 21.35 seconds on the shared H100. The eight-step smoke changed the history output projection by 1.4182e-5 maximum while all frozen backbone weights remained bitwise equal and all weights finite. + +## E25 learned recency 6000-step checkpoint +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.591322422027588 seconds. +- Overall skill 0.352851; relative MASE 0.769426; relative WQL 0.544305. +- term skill: long=0.3876, medium=0.3997, short=0.3198. +- domain skill: Econ/Fin=0.1086, Energy=0.1828, Healthcare=0.3943, Nature=0.4120, Sales=0.3475, Transport=0.4545, Web/CloudOps=0.4982. +- frequency skill: A=0.3715, D=0.3323, H=0.3775, M=0.0905, Q=0.1942, S=0.4343, T=0.3965, W=0.1950. +- variates skill: multivariate=0.3855, univariate=0.3256. +- Outcome: Screen 0.352851 versus matched control 0.352399; modest improvement persists. Temporal diagnostics and later checkpoints remain. + +## E30 amplitude aligned template, full validation +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.350837; relative MASE 0.770162; relative WQL 0.547174. +- term skill: long=0.3846, medium=0.3975, short=0.3183. +- domain skill: Econ/Fin=0.1090, Energy=0.1818, Healthcare=0.3984, Nature=0.4093, Sales=0.3570, Transport=0.4592, Web/CloudOps=0.4877. +- frequency skill: A=0.2855, D=0.3348, H=0.3812, M=0.1070, Q=0.1786, S=0.4173, T=0.3911, W=0.1906. +- variates skill: multivariate=0.3791, univariate=0.3274. +- Outcome: Published. With the E22 control 6000-step weights, full validation improves 0.349953 to 0.350837, first earlier diagnostic 0.322147 to 0.322219, and second earlier diagnostic 0.348634 to 0.349310. No failures; deterministic relocated example checks passed. Full inference 96.8 seconds while sharing the one H100 with four training processes. All template changes are fixed formulas; learned parameters remain unchanged. + +## E30 aligned template first earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 20.561070680618286 seconds. +- Overall skill 0.322219; relative MASE 0.811128; relative WQL 0.566355. +- term skill: long=0.3898, medium=0.3504, short=0.2830. +- domain skill: Econ/Fin=0.1533, Energy=0.2182, Healthcare=0.3588, Nature=0.3483, Sales=0.3966, Transport=0.3655, Web/CloudOps=0.4333. +- frequency skill: A=0.3153, D=0.3418, H=0.3532, M=0.1706, Q=0.2117, S=0.3358, T=0.3205, W=0.2543. +- variates skill: multivariate=0.3369, univariate=0.3103. +- Outcome: Small improvement over centered templates. + +## E30 aligned template second earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.08868408203125 seconds. +- Overall skill 0.349310; relative MASE 0.778190; relative WQL 0.544080. +- term skill: long=0.3643, medium=0.3777, short=0.3325. +- domain skill: Econ/Fin=0.1024, Energy=0.2210, Healthcare=0.3434, Nature=0.4590, Sales=0.5576, Transport=0.4172, Web/CloudOps=0.4224. +- frequency skill: A=0.3380, D=0.4234, H=0.3847, M=0.1568, Q=0.1399, S=0.2828, T=0.3413, W=0.2426. +- variates skill: multivariate=0.3522, univariate=0.3470. +- Outcome: Improvement over centered templates. + +## E28 stronger seasonal loss 3000-step checkpoint +- Checkpoint SHA-256: `a514371332282d8ff1cf42e0c2127683e6bb95bfb98c1a6df6332c604d72c865`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.41924524307251 seconds. +- Overall skill 0.350569; relative MASE 0.771378; relative WQL 0.546763. +- term skill: long=0.3829, medium=0.3988, short=0.3180. +- domain skill: Econ/Fin=0.1028, Energy=0.1748, Healthcare=0.4041, Nature=0.4086, Sales=0.3488, Transport=0.4526, Web/CloudOps=0.4996. +- frequency skill: A=0.3725, D=0.3288, H=0.3734, M=0.0932, Q=0.1901, S=0.4387, T=0.3933, W=0.1988. +- variates skill: multivariate=0.3818, univariate=0.3246. +- Outcome: Screen 0.350569 versus matched control 0.350784. No gain at this checkpoint; continue to 6000 steps before deciding. + +E29 full trial started from the E22 control 6000-step backbone, seed 67, batch 64, 6,000 steps, learning rate 2e-4 with 200-step warmup and cosine decay. Only the 7.64M history-memory parameters train. Batch size is reduced to fit concurrent experiments on the one H100. Context lengths 8,192/16,384 with probabilities 0.4/0.6; horizon mixture remains 32/128/512/1024. Inference uses the current amplitude-aligned seasonal rule on the recent 4,096 points, so the additional history affects only the learned memory. The parent differs from the newly published E25 branch; zero-step evaluation supplies the exact matched control. + +## E25 learned recency 6000 with aligned templates, full validation +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.351407; relative MASE 0.769733; relative WQL 0.546517. +- term skill: long=0.3860, medium=0.3973, short=0.3189. +- domain skill: Econ/Fin=0.1113, Energy=0.1828, Healthcare=0.4050, Nature=0.4118, Sales=0.3571, Transport=0.4604, Web/CloudOps=0.4845. +- frequency skill: A=0.2870, D=0.3384, H=0.3819, M=0.1083, Q=0.1800, S=0.4144, T=0.3909, W=0.1904. +- variates skill: multivariate=0.3786, univariate=0.3289. +- Outcome: Published. Full validation 0.351407 versus preceding 0.350837; earlier diagnostics 0.323269 and 0.350071 versus 0.322219 and 0.349310. No failures; repeated relocated examples are bitwise identical, finite and monotone. Total 36,797,728 parameters. Full inference 96.7 seconds while the one H100 was shared with training. Training continues. + +## E25 recency 6000 aligned first earlier diagnostic +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 20.321524143218994 seconds. +- Overall skill 0.323269; relative MASE 0.809492; relative WQL 0.565744. +- term skill: long=0.3896, medium=0.3509, short=0.2848. +- domain skill: Econ/Fin=0.1588, Energy=0.2200, Healthcare=0.3660, Nature=0.3488, Sales=0.3987, Transport=0.3659, Web/CloudOps=0.4318. +- frequency skill: A=0.3196, D=0.3433, H=0.3536, M=0.1780, Q=0.2165, S=0.3305, T=0.3218, W=0.2570. +- variates skill: multivariate=0.3369, univariate=0.3122. +- Outcome: Improves the matched continued model with the same aligned-template runtime. + +## E25 recency 6000 aligned second earlier diagnostic +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.002116203308105 seconds. +- Overall skill 0.350071; relative MASE 0.777410; relative WQL 0.543353. +- term skill: long=0.3631, medium=0.3788, short=0.3338. +- domain skill: Econ/Fin=0.1067, Energy=0.2234, Healthcare=0.3529, Nature=0.4590, Sales=0.5596, Transport=0.4165, Web/CloudOps=0.4198. +- frequency skill: A=0.3409, D=0.4269, H=0.3856, M=0.1584, Q=0.1427, S=0.2730, T=0.3428, W=0.2398. +- variates skill: multivariate=0.3525, univariate=0.3481. +- Outcome: Improves the matched continued model with the same aligned-template runtime. + +E22 depth trial pruned after two matched comparisons: 3000-step skill 0.349903 versus control 0.350784, and 6000-step skill 0.351873 versus control 0.352399. The 6000-step checkpoint cost 1961.8 elapsed training-process seconds, versus 869.5 for the control under different shared-GPU contention. The planned 24,000 steps were not completed. This establishes no benefit at the tested budgets, not that greater depth can never help. Saved checkpoints remain available. Stop receipt: [{"pid": 4519, "kind": "training", "elapsed_seconds": 2108}, {"pid": 4914, "kind": "watcher", "elapsed_seconds": 1723}]. + +## E22 expanded depth 6000-step checkpoint +- Checkpoint SHA-256: `a1efd06cff13f7f47559d83d37ea63f6bc65692df49fd2bfe039502d33978632`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.713934898376465 seconds. +- Overall skill 0.351873; relative MASE 0.770476; relative WQL 0.545206. +- term skill: long=0.3864, medium=0.4005, short=0.3182. +- domain skill: Econ/Fin=0.1070, Energy=0.1815, Healthcare=0.3779, Nature=0.4133, Sales=0.3487, Transport=0.4524, Web/CloudOps=0.4999. +- frequency skill: A=0.3690, D=0.3292, H=0.3764, M=0.0873, Q=0.1951, S=0.4370, T=0.3963, W=0.1928. +- variates skill: multivariate=0.3859, univariate=0.3234. +- Outcome: Below the matched 36.8M control for the second comparison. Stop this trial and retain its checkpoints; prioritize the smaller learned-feature and history-memory experiments on one H100. + +## E31: stochastic seasonal amplitude in synthetic pretraining (prepared) +Hypothesis: the original generator has constant Fourier amplitudes, whereas the added recency features describe changing amplitudes. Modulate the seasonal component in half of synthetic draws by a positive AR log-amplitude with time constant 100–10,000, stationary log standard deviation 0.05–0.4 and log-value clipping [-2,2]. The modulation is applied before trends, observation noise, missing values and intermittence. A separate RNG seed = main seed + 100003 preserves all source selection, corpus windows, horizon/context choices and original generator random draws relative to E25. Planned seed 59 and E17 initialization allow comparison with existing E25 checkpoints without retraining a control. No training started yet. + +## E29 history memory 1000-step checkpoint +- Checkpoint SHA-256: `a3bdc3a7525ed869d48fc1ce2b54785bb82aa64573e3b3d8a0de98df10680af3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.969539165496826 seconds. +- Overall skill 0.355846; relative MASE 0.766420; relative WQL 0.541393. +- term skill: long=0.3920, medium=0.3994, short=0.3237. +- domain skill: Econ/Fin=0.1304, Energy=0.1908, Healthcare=0.3939, Nature=0.4095, Sales=0.3479, Transport=0.4592, Web/CloudOps=0.4963. +- frequency skill: A=0.3691, D=0.3317, H=0.3867, M=0.0892, Q=0.1952, S=0.4178, T=0.4001, W=0.1953. +- variates skill: multivariate=0.3846, univariate=0.3320. +- Outcome: Improves the matched zero-step screen score 0.354979. Elapsed training-process time 104.3 seconds on the shared single H100. Temporal diagnostics determine whether the gain transfers across cutoffs. + +## E29 history memory 3000-step checkpoint +- Checkpoint SHA-256: `81b1e8dfae60e87a20a2f0ff6d3464a608c8b86624cfc3383ca29441e9f1fd92`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.785941123962402 seconds. +- Overall skill 0.356376; relative MASE 0.765914; relative WQL 0.540860. +- term skill: long=0.3932, medium=0.3995, short=0.3240. +- domain skill: Econ/Fin=0.1306, Energy=0.1923, Healthcare=0.3934, Nature=0.4102, Sales=0.3479, Transport=0.4591, Web/CloudOps=0.4965. +- frequency skill: A=0.3691, D=0.3318, H=0.3878, M=0.0892, Q=0.1952, S=0.4179, T=0.4005, W=0.1953. +- variates skill: multivariate=0.3854, univariate=0.3323. +- Outcome: Improves the matched zero-step screen score 0.354979. Elapsed training-process time 283.3 seconds on the shared single H100. Temporal diagnostics determine whether the gain transfers across cutoffs. + +E31 training started: seed 59, batch 256, 24,000-step schedule, learning rate 8e-5, E17 initialization, same query-feature architecture as E25. Tests verified that all corpus-only rows are identical to E25 and that the main RNG states remain identical after both corpus-only and synthetic-only batches; 11 of 32 synthetic test rows changed. The independent modulation stream is seed 100062. Evaluate at 3000/6000 steps before extending this trial. + +## E22 control 12000 with aligned templates, full validation +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.355096; relative MASE 0.766848; relative WQL 0.542351. +- term skill: long=0.3891, medium=0.3999, short=0.3233. +- domain skill: Econ/Fin=0.1147, Energy=0.1853, Healthcare=0.3958, Nature=0.4163, Sales=0.3582, Transport=0.4612, Web/CloudOps=0.4938. +- frequency skill: A=0.2887, D=0.3392, H=0.3848, M=0.1131, Q=0.1870, S=0.4202, T=0.3967, W=0.1906. +- variates skill: multivariate=0.3845, univariate=0.3307. +- Outcome: Published. Full validation 0.355096 versus preceding E25-6000 package 0.351407, first earlier diagnostic 0.325963 versus 0.323269, and second earlier diagnostic 0.352462 versus 0.350071. No failures; repeated relocated examples are bitwise identical, finite and monotone. Full inference 98.8 seconds under shared H100 contention. The matched E25-12000 checkpoint is still training. + +## E22 control12000 aligned first earlier diagnostic +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.49058723449707 seconds. +- Overall skill 0.325963; relative MASE 0.809373; relative WQL 0.561330. +- term skill: long=0.3895, medium=0.3521, short=0.2893. +- domain skill: Econ/Fin=0.1619, Energy=0.2209, Healthcare=0.3713, Nature=0.3541, Sales=0.3962, Transport=0.3666, Web/CloudOps=0.4365. +- frequency skill: A=0.3123, D=0.3490, H=0.3551, M=0.1691, Q=0.2293, S=0.3380, T=0.3258, W=0.2557. +- variates skill: multivariate=0.3406, univariate=0.3141. +- Outcome: Improves the preceding package. + +## E22 control12000 aligned second earlier diagnostic +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.788399934768677 seconds. +- Overall skill 0.352462; relative MASE 0.775936; relative WQL 0.540386. +- term skill: long=0.3649, medium=0.3793, short=0.3372. +- domain skill: Econ/Fin=0.1068, Energy=0.2227, Healthcare=0.3661, Nature=0.4623, Sales=0.5608, Transport=0.4167, Web/CloudOps=0.4248. +- frequency skill: A=0.3383, D=0.4276, H=0.3860, M=0.1616, Q=0.1520, S=0.2793, T=0.3458, W=0.2493. +- variates skill: multivariate=0.3545, univariate=0.3508. +- Outcome: Improves the preceding package. + +## E32: transfer the learned history memory to the improved backbone +Hypothesis: the frozen history memory learns useful features that remain compatible with a later continuation of the same backbone architecture. Combine E29 history-memory tensors at 6000 steps with every backbone tensor from E22 control at 12000 steps. This is a deterministic combination of our own trained assets, with no new training and no external weights. Both parent checkpoint hashes and full training lineages are retained. The publication utility now traverses both parent branches and declares all their sources and generator seeds. Compare to the E22-12000 aligned-template runtime across three cutoffs before adoption. + +## E29 history memory 6000-step screen +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 43.3264684677124 seconds. +- Overall skill 0.357127; relative MASE 0.765099; relative WQL 0.540174. +- term skill: long=0.3941, medium=0.3993, short=0.3251. +- domain skill: Econ/Fin=0.1303, Energy=0.1925, Healthcare=0.3999, Nature=0.4104, Sales=0.3479, Transport=0.4597, Web/CloudOps=0.4973. +- frequency skill: A=0.3691, D=0.3342, H=0.3893, M=0.0892, Q=0.1952, S=0.4179, T=0.4002, W=0.1953. +- variates skill: multivariate=0.3861, univariate=0.3331. +- Outcome: Screen 0.357127 versus zero-step 0.354979. Training completed in 531.4 process seconds on the shared single H100. First earlier diagnostic regresses while the second improves; do not publish standalone without broader evidence. + +## E29 history memory first earlier diagnostic +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.55209970474243 seconds. +- Overall skill 0.321189; relative MASE 0.812469; relative WQL 0.567141. +- term skill: long=0.3883, medium=0.3470, short=0.2831. +- domain skill: Econ/Fin=0.1541, Energy=0.2165, Healthcare=0.3555, Nature=0.3461, Sales=0.3966, Transport=0.3649, Web/CloudOps=0.4336. +- frequency skill: A=0.3153, D=0.3408, H=0.3550, M=0.1706, Q=0.2117, S=0.3336, T=0.3162, W=0.2543. +- variates skill: multivariate=0.3353, univariate=0.3098. +- Outcome: Regresses from the matched parent 0.322219 to 0.321189. + +## E29 history memory second earlier diagnostic +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.82407259941101 seconds. +- Overall skill 0.350315; relative MASE 0.776760; relative WQL 0.543398. +- term skill: long=0.3664, medium=0.3780, short=0.3334. +- domain skill: Econ/Fin=0.1037, Energy=0.2222, Healthcare=0.3446, Nature=0.4601, Sales=0.5576, Transport=0.4171, Web/CloudOps=0.4239. +- frequency skill: A=0.3380, D=0.4241, H=0.3857, M=0.1568, Q=0.1399, S=0.2820, T=0.3431, W=0.2426. +- variates skill: multivariate=0.3544, univariate=0.3470. +- Outcome: Improves from the matched parent 0.349310 to 0.350315. + +## E28 stronger seasonal loss 6000-step checkpoint +- Checkpoint SHA-256: `6208c74c3a6902d0410708741fd3ee609649e28732e5d5ee2696169685768e9b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.053489208221436 seconds. +- Overall skill 0.352533; relative MASE 0.769384; relative WQL 0.544869. +- term skill: long=0.3857, medium=0.3986, short=0.3205. +- domain skill: Econ/Fin=0.1093, Energy=0.1807, Healthcare=0.4083, Nature=0.4098, Sales=0.3497, Transport=0.4525, Web/CloudOps=0.4985. +- frequency skill: A=0.3742, D=0.3386, H=0.3743, M=0.0874, Q=0.1946, S=0.4388, T=0.3951, W=0.1953. +- variates skill: multivariate=0.3844, univariate=0.3260. +- Outcome: Screen 0.352533 versus matched control 0.352399; first earlier diagnostic 0.322419 versus control 0.322598. Differences are small and inconsistent; continue to the 12000-step comparison. Training time through 6000: 1375.1 process seconds. + +## E22 pruned depth model earlier diagnostic +- Checkpoint SHA-256: `a1efd06cff13f7f47559d83d37ea63f6bc65692df49fd2bfe039502d33978632`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 29.58867907524109 seconds. +- Overall skill 0.322537; relative MASE 0.811436; relative WQL 0.565609. +- term skill: long=0.3876, medium=0.3519, short=0.2839. +- domain skill: Econ/Fin=0.1430, Energy=0.2205, Healthcare=0.3835, Nature=0.3473, Sales=0.3985, Transport=0.3592, Web/CloudOps=0.4331. +- frequency skill: A=0.3156, D=0.3515, H=0.3521, M=0.1655, Q=0.2142, S=0.3417, T=0.3184, W=0.2490. +- variates skill: multivariate=0.3364, univariate=0.3113. +- Outcome: Score 0.322537 versus matched control 0.322598, confirming no useful advantage in the tested budgets. + +## E33: global quantile ensemble of the newer backbone and transferred memory +Hypothesis: averaging the unmodified E22-12000 forecasts with E32 reduces the history memory’s temporal instability. Compare fixed backbone weights 0.25/0.5/0.75, with the complementary weight on the memory model, across all three diagnostics. Both members must forecast every instance in any deployed package. This is a cached-output diagnostic first, with no training or per-dataset choice. Actual package inference and full validation remain required before publication. + +## E32 transferred history memory screen +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.279379844665527 seconds. +- Overall skill 0.361285; relative MASE 0.762270; relative WQL 0.535186. +- term skill: long=0.3979, medium=0.4009, short=0.3306. +- domain skill: Econ/Fin=0.1354, Energy=0.1960, Healthcare=0.4004, Nature=0.4175, Sales=0.3496, Transport=0.4614, Web/CloudOps=0.5026. +- frequency skill: A=0.3746, D=0.3390, H=0.3931, M=0.0951, Q=0.1983, S=0.4210, T=0.4049, W=0.1967. +- variates skill: multivariate=0.3911, univariate=0.3365. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +## E32 transferred history memory first earlier +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.01271629333496 seconds. +- Overall skill 0.324581; relative MASE 0.811091; relative WQL 0.562442. +- term skill: long=0.3866, medium=0.3491, short=0.2893. +- domain skill: Econ/Fin=0.1617, Energy=0.2185, Healthcare=0.3678, Nature=0.3513, Sales=0.3962, Transport=0.3659, Web/CloudOps=0.4368. +- frequency skill: A=0.3123, D=0.3475, H=0.3561, M=0.1691, Q=0.2293, S=0.3357, T=0.3214, W=0.2557. +- variates skill: multivariate=0.3385, univariate=0.3133. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +## E32 transferred history memory second earlier +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.5328631401062 seconds. +- Overall skill 0.352606; relative MASE 0.775583; relative WQL 0.540391. +- term skill: long=0.3677, medium=0.3779, short=0.3370. +- domain skill: Econ/Fin=0.1079, Energy=0.2224, Healthcare=0.3668, Nature=0.4615, Sales=0.5608, Transport=0.4165, Web/CloudOps=0.4263. +- frequency skill: A=0.3383, D=0.4283, H=0.3855, M=0.1616, Q=0.1520, S=0.2804, T=0.3462, W=0.2493. +- variates skill: multivariate=0.3553, univariate=0.3504. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +E33 cached ensemble results. Neither member required new training. Backbone weights 0.25/0.5/0.75 apply globally to every instance; complementary weight is on E32. All tested mixtures retain a small first-earlier-cutoff regression. No ensemble is published yet; the simpler backbone continuations are still improving. +- screen, base weight 0.25: skill 0.3609597107729168; elapsed 31.589441299438477 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7485062013261629, "rel_wql_gmean": 0.48497053192140965}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7187220659985801, "rel_wql_gmean": 0.49872959388387217}, "short": {"n_configs": 55, "rel_mase_gmean": 0.7854775479522941, "rel_wql_gmean": 0.5715754588019885}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8766794111084217, "rel_wql_gmean": 0.8521904674160014}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9458381742339477, "rel_wql_gmean": 0.6841214470602749}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6357518097122528, "rel_wql_gmean": 0.5708050606184818}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8296139742081163, "rel_wql_gmean": 0.40898901267743815}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.8283216000359614, "rel_wql_gmean": 0.510813353500822}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6491485866452709, "rel_wql_gmean": 0.4469444592152844}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.564775788716386, "rel_wql_gmean": 0.4386209893190716}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6092189862308618, "rel_wql_gmean": 0.6444119562488515}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7923969772018941, "rel_wql_gmean": 0.5529928138595462}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7344815207835862, "rel_wql_gmean": 0.502366984331498}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9818087731317099, "rel_wql_gmean": 0.8332936324629011}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7734447483921444, "rel_wql_gmean": 0.8291183442517216}, "S": {"n_configs": 6, "rel_mase_gmean": 0.662205210700223, "rel_wql_gmean": 0.5065947056042907}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7321702800096546, "rel_wql_gmean": 0.4836230433794967}, "W": {"n_configs": 8, "rel_mase_gmean": 0.9308497588724332, "rel_wql_gmean": 0.6931956959471695}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.7176036435313308, "rel_wql_gmean": 0.5172069567399432}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.800284652420953, "rel_wql_gmean": 0.5506355529979893}}} +- screen, base weight 0.5: skill 0.36051700538130327; elapsed 1.6923091411590576 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7491443694259866, "rel_wql_gmean": 0.48552116951145263}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.717943946501363, "rel_wql_gmean": 0.49885742655549165}, "short": {"n_configs": 55, "rel_mase_gmean": 0.7862261945539069, "rel_wql_gmean": 0.572174296426093}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8767314570553127, "rel_wql_gmean": 0.8518426772129285}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9464868100785462, "rel_wql_gmean": 0.6847020626617584}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6391927294627128, "rel_wql_gmean": 0.5728774819722747}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8288486290328975, "rel_wql_gmean": 0.4095777628918776}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.828359895013336, "rel_wql_gmean": 0.5108331535102516}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6492097960109925, "rel_wql_gmean": 0.44703510569395916}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.5650725913141991, "rel_wql_gmean": 0.43904253902223594}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6107048585981317, "rel_wql_gmean": 0.6453081988530746}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7937577174837149, "rel_wql_gmean": 0.5536527716998109}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7349129886012886, "rel_wql_gmean": 0.5033244078192418}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9816729369571708, "rel_wql_gmean": 0.83284954955612}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7729642350253297, "rel_wql_gmean": 0.8282079386900584}, "S": {"n_configs": 6, "rel_mase_gmean": 0.6624714487276662, "rel_wql_gmean": 0.5067064419332115}, "T": {"n_configs": 30, "rel_mase_gmean": 0.732172046143732, "rel_wql_gmean": 0.4837994768895142}, "W": {"n_configs": 8, "rel_mase_gmean": 0.930849298960232, "rel_wql_gmean": 0.6931955559830537}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.717793296521423, "rel_wql_gmean": 0.5179713349770367}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8008210552601016, "rel_wql_gmean": 0.5508732181941426}}} +- screen, base weight 0.75: skill 0.3599500839851063; elapsed 1.4231245517730713 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.750042489425022, "rel_wql_gmean": 0.48623104748726004}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7173897864210821, "rel_wql_gmean": 0.4991516788000004}, "short": {"n_configs": 55, "rel_mase_gmean": 0.78703598003334, "rel_wql_gmean": 0.5728330044823371}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8768876674480677, "rel_wql_gmean": 0.8515997053654789}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9473562016160542, "rel_wql_gmean": 0.6855548779843715}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.642561102977203, "rel_wql_gmean": 0.5749859696863521}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8285232450849535, "rel_wql_gmean": 0.4102456883415478}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.8284086809446388, "rel_wql_gmean": 0.5108547074028001}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6493066620546145, "rel_wql_gmean": 0.44715612803391697}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.5654188677782281, "rel_wql_gmean": 0.4395078746093791}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6122299433463864, "rel_wql_gmean": 0.6462324836335608}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7950974689907988, "rel_wql_gmean": 0.5543319910897211}, "H": {"n_configs": 31, "rel_mase_gmean": 0.735615332675693, "rel_wql_gmean": 0.5044620646385107}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9815783490405571, "rel_wql_gmean": 0.832453381029195}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7726561980040161, "rel_wql_gmean": 0.8274692503440843}, "S": {"n_configs": 6, "rel_mase_gmean": 0.6627478709382408, "rel_wql_gmean": 0.5068543440740843}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7323316854508894, "rel_wql_gmean": 0.4840907541003884}, "W": {"n_configs": 8, "rel_mase_gmean": 0.9308491431521891, "rel_wql_gmean": 0.6931954208513348}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.7182293746317306, "rel_wql_gmean": 0.5189159515589695}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8014062938450294, "rel_wql_gmean": 0.5511589238591919}}} +- backcast, base weight 0.25: skill 0.32516390659459127; elapsed 25.728330373764038 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7877573688004119, "rel_wql_gmean": 0.4757505244331779}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7777646324659491, "rel_wql_gmean": 0.5427449141803178}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8320626409877416, "rel_wql_gmean": 0.6069233027764227}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731645869233648, "rel_wql_gmean": 0.8046317212772931}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9000885899955989, "rel_wql_gmean": 0.6764463826118567}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6763673902063786, "rel_wql_gmean": 0.5893498915999001}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9498042213778831, "rel_wql_gmean": 0.44171639005646535}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.7449699119735571, "rel_wql_gmean": 0.5393127533664154}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755793289890412, "rel_wql_gmean": 0.4696226318380198}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8480816283629858, "rel_wql_gmean": 0.5013822816935581}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7872906478235149, "rel_wql_gmean": 0.5262643957494131}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8611665698543136, "rel_wql_gmean": 0.5114505986034271}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7774300159704559, "rel_wql_gmean": 0.5898942963102115}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8054278932888852, "rel_wql_gmean": 0.5417010935787644}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8142697614393413, "rel_wql_gmean": 0.5786920991268066}}} +- backcast, base weight 0.5: skill 0.3255906425540577; elapsed 7.025062561035156 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7868531100085023, "rel_wql_gmean": 0.47494194797983313}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7767176724724971, "rel_wql_gmean": 0.5419949281040547}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8318845792654018, "rel_wql_gmean": 0.606991975463184}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731690390439605, "rel_wql_gmean": 0.8045484945388448}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.8993476870381677, "rel_wql_gmean": 0.6755669234996251}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6753662260274707, "rel_wql_gmean": 0.5885861458424224}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9483032085189914, "rel_wql_gmean": 0.441350380267718}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.7446948865024733, "rel_wql_gmean": 0.5392154113246899}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755391890283506, "rel_wql_gmean": 0.469748030722515}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8475410369158077, "rel_wql_gmean": 0.5011421156521402}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7875436876281503, "rel_wql_gmean": 0.5262880067026078}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8607773505813321, "rel_wql_gmean": 0.5107840537486803}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7758285204666452, "rel_wql_gmean": 0.5890117516972101}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8047280897548712, "rel_wql_gmean": 0.5410867356076619}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8138657265706295, "rel_wql_gmean": 0.5785877053648649}}} +- backcast, base weight 0.75: skill 0.32585558132181525; elapsed 1.4801208972930908 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7864118030472989, "rel_wql_gmean": 0.47433966987370835}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7760856247602924, "rel_wql_gmean": 0.541419709057465}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8317549187410698, "rel_wql_gmean": 0.6071042148592315}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731809073153128, "rel_wql_gmean": 0.8044818649657144}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.8991776752660365, "rel_wql_gmean": 0.6750015559883032}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6743591342425898, "rel_wql_gmean": 0.5878184243392145}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9471433052106504, "rel_wql_gmean": 0.4410648488568812}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.744443044974495, "rel_wql_gmean": 0.5391442286013897}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755193180086204, "rel_wql_gmean": 0.46990600477296696}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8470002930114933, "rel_wql_gmean": 0.5009052086170435}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7882647172004155, "rel_wql_gmean": 0.5264910423859007}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8604064218762162, "rel_wql_gmean": 0.5101551146076984}, "T": {"n_configs": 30, "rel_mase_gmean": 0.774442079728573, "rel_wql_gmean": 0.5883004763096262}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8044577867215783, "rel_wql_gmean": 0.5406785466562373}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8135190933822734, "rel_wql_gmean": 0.5785199260327762}}} +- backcast2, base weight 0.25: skill 0.35287154434047796; elapsed 32.718568563461304 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.7953937401265897, "rel_wql_gmean": 0.5030106493089533}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7678643593783896, "rel_wql_gmean": 0.5028055430553253}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7711270557942318, "rel_wql_gmean": 0.5695813024863108}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8805482364783594, "rel_wql_gmean": 0.9042209924611244}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9117289903338895, "rel_wql_gmean": 0.6620020860753241}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6839866145665877, "rel_wql_gmean": 0.5864976160474622}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7748252117778318, "rel_wql_gmean": 0.3733068662798137}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.6725766506204502, "rel_wql_gmean": 0.5061420572217049}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6870083960785978, "rel_wql_gmean": 0.4794994231705838}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7299533930809837, "rel_wql_gmean": 0.4479740157977664}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7604275957811419, "rel_wql_gmean": 0.4953118153144008}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9122753788008492, "rel_wql_gmean": 0.5679295721865012}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7657639848982667, "rel_wql_gmean": 0.5579672183603664}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7902445203946336, "rel_wql_gmean": 0.5253027568920817}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7633236727962595, "rel_wql_gmean": 0.5525218103974238}}} +- backcast2, base weight 0.5: skill 0.35293362223391267; elapsed 1.2891087532043457 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.795490811324907, "rel_wql_gmean": 0.5038189345476245}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7674326315874551, "rel_wql_gmean": 0.5023119643797436}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7711829671563578, "rel_wql_gmean": 0.5693457082014003}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8808378054392396, "rel_wql_gmean": 0.9044589957290904}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9113735276107076, "rel_wql_gmean": 0.6617472008949459}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6842243004747667, "rel_wql_gmean": 0.5865985548061023}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7748130011917327, "rel_wql_gmean": 0.37282859138217267}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.6724189210776539, "rel_wql_gmean": 0.5061490326925873}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6872511298933153, "rel_wql_gmean": 0.47991505019019964}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7301681468376378, "rel_wql_gmean": 0.4481185117970856}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7599867700948899, "rel_wql_gmean": 0.49504239452481336}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9125454167444352, "rel_wql_gmean": 0.5681445429462755}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7659127026855528, "rel_wql_gmean": 0.5579048015053354}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7903908108689007, "rel_wql_gmean": 0.5252368408110905}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7631277150357363, "rel_wql_gmean": 0.5524454383766455}}} +- backcast2, base weight 0.75: skill 0.35279424558075034; elapsed 1.3640234470367432 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.7960013691972241, "rel_wql_gmean": 0.5048538794748333}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7673586435302413, "rel_wql_gmean": 0.5020153819167671}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7714553413789935, "rel_wql_gmean": 0.5691840862467166}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.881145657719554, "rel_wql_gmean": 0.9047199305925011}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9115950570456508, "rel_wql_gmean": 0.6618010993808187}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6844817312954508, "rel_wql_gmean": 0.5867080808867043}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7754005359113609, "rel_wql_gmean": 0.3724980616976047}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.672286131185056, "rel_wql_gmean": 0.506183419259456}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6875722190026725, "rel_wql_gmean": 0.48037847185063465}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.730395963063022, "rel_wql_gmean": 0.4482700955304752}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7602248518219639, "rel_wql_gmean": 0.4950255629831832}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9128726300303336, "rel_wql_gmean": 0.5684332751933325}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7662563237934747, "rel_wql_gmean": 0.5579847239947101}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7911061856256687, "rel_wql_gmean": 0.5254140703891469}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7629991415479856, "rel_wql_gmean": 0.5524144817860636}}} + +## E34: multivariate attention with end-to-end pretraining and univariate rehearsal +Hypothesis: E20’s frozen backbone could not fully learn how to interpret cross-channel signals. Start from E22 control at 12000, add the same zero-output cross-variable attention layer, and train all 37,816,096 parameters. Three quarters of batches use the original 95-source univariate sampler, batch 128; one quarter use synchronized multivariate records, 32 groups with 2/3/4/8 channels. Six thousand steps, learning rate 4e-5 with 200-step warmup and cosine decay; main seed 73, independent joint-sampler seed 10073. Use only packed_sample and packed_joint and their local generators. This changes the training mixture and trainable parameter set together; it is a candidate method comparison, not a claim that either factor alone causes any gain. Zero-step output is the matched inference control. No validation observations enter gradients. + +## E25 learned recency 12000 with aligned templates, full validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.355628; relative MASE 0.765858; relative WQL 0.542156. +- term skill: long=0.3899, medium=0.4001, short=0.3239. +- domain skill: Econ/Fin=0.1162, Energy=0.1854, Healthcare=0.4030, Nature=0.4169, Sales=0.3571, Transport=0.4622, Web/CloudOps=0.4930. +- frequency skill: A=0.2912, D=0.3393, H=0.3859, M=0.1107, Q=0.1840, S=0.4221, T=0.3964, W=0.1942. +- variates skill: multivariate=0.3851, univariate=0.3311. +- Outcome: Published. Full validation 0.355628 versus matched E22-12000 package 0.355096; earlier diagnostics 0.327844 and 0.354561 versus 0.325963 and 0.352462. No failures. Repeated relocated examples are bitwise identical, finite and monotone. This extends the recency-feature benefit to a third matched training checkpoint. + +## E25 recency12000 first earlier diagnostic +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.109707355499268 seconds. +- Overall skill 0.327844; relative MASE 0.806911; relative WQL 0.559904. +- term skill: long=0.3932, medium=0.3529, short=0.2909. +- domain skill: Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- frequency skill: A=0.3134, D=0.3502, H=0.3567, M=0.1636, Q=0.2250, S=0.3402, T=0.3276, W=0.2656. +- variates skill: multivariate=0.3437, univariate=0.3150. +- Outcome: Improves the matched control. + +## E25 recency12000 second earlier diagnostic +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.91800332069397 seconds. +- Overall skill 0.354561; relative MASE 0.773267; relative WQL 0.538742. +- term skill: long=0.3642, medium=0.3828, short=0.3397. +- domain skill: Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- frequency skill: A=0.3385, D=0.4319, H=0.3875, M=0.1660, Q=0.1478, S=0.2841, T=0.3480, W=0.2461. +- variates skill: multivariate=0.3588, univariate=0.3511. +- Outcome: Improves the matched control. + +Measured continuation compute (elapsed training-process seconds, shared single H100; these are not additive dedicated GPU-seconds): +- depth36_control, step 1000: 124.8 seconds. +- depth36_control, step 3000: 365.5 seconds. +- depth36_control, step 6000: 869.5 seconds. +- depth36_control, step 12000: 2211.3 seconds. +- recency_features, step 1000: 168.9 seconds. +- recency_features, step 3000: 510.3 seconds. +- recency_features, step 6000: 1158.7 seconds. +- recency_features, step 12000: 2481.6 seconds. +- strong_loss, step 1000: 224.1 seconds. +- strong_loss, step 3000: 672.8 seconds. +- strong_loss, step 6000: 1375.1 seconds. +- amplitude_synth, step 1000: 227.1 seconds. +- amplitude_synth, step 3000: 678.7 seconds. +- joint_rehearsal, step 1000: 172.6 seconds. + +## E35: explicit local trend increments in future queries (prepared) +Hypothesis: the original damped trend feature clips normalized slopes at 0.03 per step, suppressing trends in short annual and quarterly contexts. Add two zero-initialized query features from differences of adjacent 4-point and 16-point means, extrapolated to each future step and softly capped at 3 context standard deviations. Each mean needs at least half its observations and at least two finite values. This is a fixed context calculation, not a fitted per-instance model. A separate 16,384-parameter query projection preserves the existing recency projection and all pretrained-in-this-workspace tensors. Planned E17 initialization, seed 59, batch 256 and 24,000-step schedule match E25 exactly; no new synthetic generator. Training not yet started. + +E28 stopped after the 12000-step comparison. Screen 0.355930 is below matched control 0.356664; earlier checkpoints gave small inconsistent differences. Training through 12000 took 2731.8 process seconds on the shared H100. Checkpoints are retained, but the stronger seasonal-error weighting is not adopted. + +## E28 stronger seasonal loss 12000-step checkpoint +- Checkpoint SHA-256: `9f67f75960a568c9bc42fdb2ec99c8852bb5136ae869b7f63ac3fd6aeb359aab`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.34673237800598 seconds. +- Overall skill 0.355930; relative MASE 0.766619; relative WQL 0.541111. +- term skill: long=0.3886, medium=0.4019, short=0.3241. +- domain skill: Econ/Fin=0.1123, Energy=0.1843, Healthcare=0.4078, Nature=0.4143, Sales=0.3492, Transport=0.4532, Web/CloudOps=0.5040. +- frequency skill: A=0.3801, D=0.3350, H=0.3784, M=0.1213, Q=0.1929, S=0.4399, T=0.3989, W=0.1948. +- variates skill: multivariate=0.3880, univariate=0.3292. +- Outcome: Below matched control; stop this branch after three comparisons without a consistent advantage. + +E35 training started with the planned matched seed 59, batch 256, learning rate 8e-5 and 24000-step schedule, replacing E28 GPU work. A synthetic forward check verified bitwise equality at zero projection, and backward propagation produced finite nonzero gradients for the new trend projection. No additional training source or generator is introduced. + +## E31 synthetic amplitude 3000-step screen +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.430498361587524 seconds. +- Overall skill 0.352625; relative MASE 0.768870; relative WQL 0.545079. +- term skill: long=0.3854, medium=0.3995, short=0.3204. +- domain skill: Econ/Fin=0.1023, Energy=0.1772, Healthcare=0.4136, Nature=0.4097, Sales=0.3467, Transport=0.4530, Web/CloudOps=0.5025. +- frequency skill: A=0.3691, D=0.3356, H=0.3748, M=0.0875, Q=0.1887, S=0.4366, T=0.3965, W=0.1978. +- variates skill: multivariate=0.3840, univariate=0.3265. +- Outcome: Improves matched E25-3000 screen from 0.351702 to 0.352625. First earlier diagnostic improves 0.321665 to 0.322014. Keep training to assess persistence. + +## E34 joint rehearsal 1000-step screen +- Checkpoint SHA-256: `394f2003a6c00cdcb0f2b944d1e9cc8ae4f7aca9e513bf46dbb1f8a2489c8670`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.026655912399292 seconds. +- Overall skill 0.360583; relative MASE 0.762757; relative WQL 0.536022. +- term skill: long=0.3975, medium=0.4014, short=0.3292. +- domain skill: Econ/Fin=0.1394, Energy=0.1926, Healthcare=0.3956, Nature=0.4177, Sales=0.3466, Transport=0.4620, Web/CloudOps=0.5034. +- frequency skill: A=0.3785, D=0.3382, H=0.3903, M=0.0963, Q=0.1994, S=0.4210, T=0.4059, W=0.1960. +- variates skill: multivariate=0.3895, univariate=0.3366. +- Outcome: Improves matched zero-step control on main screen and both earlier diagnostics. Later checkpoints are needed before selecting a package. + +## E34 joint rehearsal 3000-step screen +- Checkpoint SHA-256: `6dd1560fb4d63eae0fa8d414252b55329371e397cee44dcff4c656ff3e2f3416`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.9136745929718 seconds. +- Overall skill 0.358556; relative MASE 0.764675; relative WQL 0.538072. +- term skill: long=0.3976, medium=0.4016, short=0.3253. +- domain skill: Econ/Fin=0.1364, Energy=0.1912, Healthcare=0.3737, Nature=0.4189, Sales=0.3465, Transport=0.4616, Web/CloudOps=0.5016. +- frequency skill: A=0.3793, D=0.3315, H=0.3904, M=0.0787, Q=0.2012, S=0.4202, T=0.4046, W=0.1966. +- variates skill: multivariate=0.3887, univariate=0.3335. +- Outcome: Screen falls below the zero-step control after the earlier gain; do not publish this checkpoint. Continue to the planned 6000-step endpoint to assess the lower learning rate. + +## E36: equal-weight control and recency ensemble +Hypothesis: averaging two strong continuations reduces differences across validation cutoffs. Compare a fixed 50/50 quantile average of E25 recency12000 and E22 control18000, each forecasting every instance with the aligned seasonal rule. No training or new data; no dataset-specific selection. Screen and both earlier diagnostics are computed from cached forecasts before constructing a runtime package. + +## E37: fixed zero-mass projection +Hypothesis: small positive forecasts on histories with an observed mass at exactly zero cause disproportionate median error. Diagnostic candidates snap nonnegative quantiles below 0, 0.001, 0.005 or 0.02 context standard deviations to zero, only when the recent4096 history is nonnegative and contains at least4 zeros comprising at least10% of observed points. All thresholds are fixed globally; no per-instance fitting. Test the same four candidates at all three validation cutoffs using E25 recency12000 aligned outputs. No training and no extra data. + +E37 initial sweep: threshold0.02 improved screen 0.359868→0.360509, first earlier0.327844→0.328180 and second earlier0.354561→0.354943. Smaller nonzero thresholds gave smaller gains. Build and fully evaluate the0.02 runtime. A separate follow-up will compare0.05 and0.1 to assess whether the original upper endpoint truncated the useful range; no additional fitted parameters. + +## E38: broader packed corpus for the 36.8M recency model (prepared) +Hypothesis: the earlier negative corpus-expansion result at6.7M parameters may not hold for the larger, more-trained model. Compare packed_sample (0.959B points) with packed_expanded (5.653B points), initializing both from E25 recency12000. Keep source mixture weights calculated from packed_sample in both arms, isolating broader series and crop coverage from source-reweighting. Seed79, batch256, learning rate5e-5, 12000-step schedule, saves every3000, same architecture/loss/window mixture/synthetic generator. Each arm uses two Torch CPU threads. Training will start after current jobs release GPU capacity. No new corpus directories or generators. + +E37 wider sweep: thresholds0.02/0.05/0.1 gave screen0.360509/0.362121/0.364736, earlier1 0.328180/0.328643/0.329276, earlier2 0.354943/0.355475/0.356263. All three improve with the larger threshold. A final bracket at0.1/0.2/0.4/0.8 will locate an interior useful range before full runtime selection. + +## E39: bounded quantiles during pretraining (prepared) +Hypothesis: the current continuous output head incurs small positive errors on genuinely zero-valued futures. Extend the existing nonnegativity heuristic symmetrically inside the training forward pass: histories entirely nonnegative clamp normalized output quantiles at standardized zero; entirely nonpositive histories clamp above at zero. This lets pinball loss learn exact boundary probability mass through negative latent quantiles, rather than requiring exact equality of a continuous prediction. No additional model parameters. Match E38 packed_sample control: own E25 recency12000 initialization, seed79, batch256, LR5e-5, 12000 steps, original source mixture and generator. Training not yet started; this is separate from the fixed E37 inference projection. + +E37 final bracket selected threshold0.4: screen/earlier1/earlier2 =0.370559/0.330696/0.357884, versus parent0.359868/0.327844/0.354561. Threshold0.8 regresses to0.364344/0.327637/0.350745, providing an interior optimum common to all three cutoffs. No finer sweep is planned. Assemble and fully evaluate threshold0.4 before publication. + +E36 equal-weight blend gives screen0.361191, earlier1 0.328179, earlier2 0.354067. The main screen remains below control18000 alone (0.361735), and second earlier remains below recency12000 (0.354561). Not selected; no ensemble runtime is published. + +E38 packed_sample control started with the planned seed79 and schedule after E34 completed. A sampler check confirmed bitwise equality with the original sampler and identical source probabilities for both packed corpora. The expanded arm remains prepared, awaiting GPU capacity. + +## E22 control18000 full validation with aligned seasonal rule +- Checkpoint SHA-256: `b7bbb7473a317145235c133492a0d743a90a01ff252577a4c8a4651db008a138`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.357537; relative MASE 0.764724; relative WQL 0.539749. +- term skill: long=0.3898, medium=0.4009, short=0.3270. +- domain skill: Econ/Fin=0.1117, Energy=0.1855, Healthcare=0.4146, Nature=0.4204, Sales=0.3566, Transport=0.4642, Web/CloudOps=0.4949. +- frequency skill: A=0.2833, D=0.3419, H=0.3872, M=0.1236, Q=0.1877, S=0.4206, T=0.3976, W=0.1997. +- variates skill: multivariate=0.3862, univariate=0.3338. +- Outcome: Improves full validation to0.357537; first and second earlier0.327746/0.352885 remain slightly below published recency12000. Candidate retained while matched recency18000 is evaluated. + +## E31 amplitude synthetic 6000-step screen +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.376917362213135 seconds. +- Overall skill 0.355543; relative MASE 0.766576; relative WQL 0.541792. +- term skill: long=0.3869, medium=0.3997, short=0.3251. +- domain skill: Econ/Fin=0.1054, Energy=0.1826, Healthcare=0.4173, Nature=0.4166, Sales=0.3471, Transport=0.4535, Web/CloudOps=0.5020. +- frequency skill: A=0.3700, D=0.3444, H=0.3777, M=0.0986, Q=0.1941, S=0.4367, T=0.3980, W=0.1929. +- variates skill: multivariate=0.3869, univariate=0.3294. +- Outcome: Screen0.355543 improves matched E25-6000 0.352851. First earlier0.324002 is effectively tied with matched0.324008; second earlier0.349572 improves matched0.349098. Continue to12000. + +## E34 joint rehearsal 6000-step screen +- Checkpoint SHA-256: `44aa5f702a58845a427ad76818631e808362b7dc236a3648232db47d621db219`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.278470993041992 seconds. +- Overall skill 0.360025; relative MASE 0.763498; relative WQL 0.536437. +- term skill: long=0.3986, medium=0.4027, short=0.3272. +- domain skill: Econ/Fin=0.1375, Energy=0.1934, Healthcare=0.3748, Nature=0.4209, Sales=0.3465, Transport=0.4619, Web/CloudOps=0.5031. +- frequency skill: A=0.3720, D=0.3320, H=0.3916, M=0.0873, Q=0.1998, S=0.4184, T=0.4071, W=0.1973. +- variates skill: multivariate=0.3917, univariate=0.3337. +- Outcome: Final screen0.360025 improves parent0.359242 but is below the1000-step peak0.360583. Evaluate both earlier cutoffs; do not publish solely from the small screen gain. + +E34 completed6000 steps in1049.5 training-process seconds. Earlier1/earlier2 =0.326344/0.350746: first improves parent0.325963, second regresses from0.352462. The1000-step checkpoint remains the better joint candidate, but neither is selected over the stronger recency model. All weights are archived. + +## E37 threshold0.02 full package validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.356254; relative MASE 0.764978; relative WQL 0.541726. +- term skill: long=0.3904, medium=0.4005, short=0.3246. +- domain skill: Econ/Fin=0.1162, Energy=0.1871, Healthcare=0.4030, Nature=0.4175, Sales=0.3571, Transport=0.4622, Web/CloudOps=0.4933. +- frequency skill: A=0.2912, D=0.3393, H=0.3863, M=0.1108, Q=0.1840, S=0.4221, T=0.3979, W=0.1942. +- variates skill: multivariate=0.3855, univariate=0.3320. +- Outcome: Full skill0.356254 improves parent0.355628 with zero failed configurations. Repeated relocated examples are bitwise identical, finite and monotone. Temporarily published while the larger, consistently better threshold0.4 completes full validation. + +## E40: zero-mass projection with empirical phase probability +E37 helps solar and several zero-heavy channels but slightly hurts some sales and cloud series. Hypothesis: a quantile should be snapped only when the observed zero probability supports its level. Keep threshold0.4 fixed; compare unrestricted E37, global observed zero fraction, and phase-specific zero frequencies from the last4 or8 primary seasonal cycles. For phase estimates with at least3 observations use (zero_count+0.5)/(count+1), otherwise the global fraction. Only levels at or below that zero probability are eligible. All rules are fixed context formulas, applied independently per variate. Compare cached E25 recency12000 forecasts on all three cutoffs; no training. + +E37 final selection: use the18,000-step recency checkpoint with threshold0.4. Full validation0.370171 exceeds12,000-step+0.4 at0.366390; earlier1 improves0.330696→0.332400, while earlier2 decreases0.357884→0.356697. The three-cutoff mean improves, and all three exceed the previously published12,000-step+0.02 package. Prefer the newer checkpoint for its full-validation and first-earlier gains; retain the second-earlier regression as a limitation. Both candidate packages passed repeated relocated example inference, with exact equality, finite outputs and monotone quantiles. +- Measured depth36_control step18000: 3529.7 elapsed training-process seconds on the shared single H100. +- Measured recency_features step18000: 4008.8 elapsed training-process seconds on the shared single H100. +- Measured amplitude_synth step6000: 1498.1 elapsed training-process seconds on the shared single H100. +- Measured joint_rehearsal step6000: 1049.5 elapsed training-process seconds on the shared single H100. + +## E37 threshold0.4 on recency12000 full validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.366390; relative MASE 0.754640; relative WQL 0.531990. +- term skill: long=0.3917, medium=0.4037, short=0.3414. +- domain skill: Econ/Fin=0.1162, Energy=0.2258, Healthcare=0.4030, Nature=0.4203, Sales=0.3559, Transport=0.4622, Web/CloudOps=0.4911. +- frequency skill: A=0.2912, D=0.3374, H=0.3884, M=0.1159, Q=0.1840, S=0.4221, T=0.4262, W=0.1943. +- variates skill: multivariate=0.3853, univariate=0.3509. +- Outcome: Full0.366390, earlier1 0.330696, earlier2 0.357884. Clear improvement over the same checkpoint without zero projection. Superseded by the18000-step candidate on full validation and average across cutoffs. + +## E25 plus E37 recency18000 threshold0.4 full validation +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.370171; relative MASE 0.750532; relative WQL 0.528537. +- term skill: long=0.3932, medium=0.4057, short=0.3469. +- domain skill: Econ/Fin=0.1099, Energy=0.2275, Healthcare=0.4340, Nature=0.4253, Sales=0.3541, Transport=0.4653, Web/CloudOps=0.4932. +- frequency skill: A=0.2819, D=0.3468, H=0.3906, M=0.1220, Q=0.1866, S=0.4218, T=0.4285, W=0.2054. +- variates skill: multivariate=0.3878, univariate=0.3558. +- Outcome: Published atomically. Full skill0.370171; earlier1 0.332400 and earlier2 0.356697. All97 configurations and151170 instances scored, zero failures. Actual package repeated examples are bitwise deterministic, finite and monotone; full inference118.1 seconds under concurrent training. + +## Published recency18000 zero0.4 first earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.86830711364746 seconds. +- Overall skill 0.332400; relative MASE 0.801955; relative WQL 0.555755. +- term skill: long=0.3980, medium=0.3574, short=0.2953. +- domain skill: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472. +- frequency skill: A=0.2996, D=0.3516, H=0.3643, M=0.1721, Q=0.2330, S=0.3397, T=0.3325, W=0.2660. +- variates skill: multivariate=0.3492, univariate=0.3187. +- Outcome: Improves the previous published package and the12000-step zero0.4 candidate. + +## Published recency18000 zero0.4 second earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.40335988998413 seconds. +- Overall skill 0.356697; relative MASE 0.773731; relative WQL 0.534862. +- term skill: long=0.3657, medium=0.3874, short=0.3411. +- domain skill: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303. +- frequency skill: A=0.3474, D=0.4275, H=0.3891, M=0.1599, Q=0.1548, S=0.2798, T=0.3574, W=0.2434. +- variates skill: multivariate=0.3611, univariate=0.3531. +- Outcome: Improves the previous published package; slightly below the12000-step zero0.4 candidate. + +## E37 complete diagnostic sweep receipts +All use the own recency12000 checkpoint SHA-256 `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`; no training, fixed inference seed0. Compute below is CPU diagnostic elapsed time, not GPU training time. + +zero_mass, screen: 4.03 seconds. +- Setting 0.0: skill 0.359868; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.001: skill 0.359874; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.005: skill 0.359953; term short=0.3285, medium=0.4017, long=0.3961; domain Econ/Fin=0.1374, Energy=0.1933, Healthcare=0.3970, Nature=0.4171, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5006. +- Setting 0.02: skill 0.360509; term short=0.3292, medium=0.4020, long=0.3966; domain Econ/Fin=0.1374, Energy=0.1948, Healthcare=0.3970, Nature=0.4176, Sales=0.3480, Transport=0.4621, Web/CloudOps=0.5008. + +zero_mass, backcast: 3.65 seconds. +- Setting 0.0: skill 0.327844; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.001: skill 0.327849; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.005: skill 0.327890; term short=0.2909, medium=0.3529, long=0.3933; domain Econ/Fin=0.1636, Energy=0.2225, Healthcare=0.3816, Nature=0.3534, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.02: skill 0.328180; term short=0.2912, medium=0.3532, long=0.3937; domain Econ/Fin=0.1636, Energy=0.2229, Healthcare=0.3816, Nature=0.3537, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4409. + +zero_mass, backcast2: 3.62 seconds. +- Setting 0.0: skill 0.354561; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- Setting 0.001: skill 0.354567; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4282. +- Setting 0.005: skill 0.354631; term short=0.3398, medium=0.3829, long=0.3643; domain Econ/Fin=0.1095, Energy=0.2260, Healthcare=0.3738, Nature=0.4622, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4282. +- Setting 0.02: skill 0.354943; term short=0.3400, medium=0.3834, long=0.3646; domain Econ/Fin=0.1095, Energy=0.2266, Healthcare=0.3738, Nature=0.4627, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4283. + +zero_mass_wide, screen: 3.91 seconds. +- Setting 0.0: skill 0.359868; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.02: skill 0.360509; term short=0.3292, medium=0.4020, long=0.3966; domain Econ/Fin=0.1374, Energy=0.1948, Healthcare=0.3970, Nature=0.4176, Sales=0.3480, Transport=0.4621, Web/CloudOps=0.5008. +- Setting 0.05: skill 0.362121; term short=0.3316, medium=0.4026, long=0.3972; domain Econ/Fin=0.1374, Energy=0.1998, Healthcare=0.3970, Nature=0.4186, Sales=0.3483, Transport=0.4621, Web/CloudOps=0.5012. +- Setting 0.1: skill 0.364736; term short=0.3357, medium=0.4036, long=0.3981; domain Econ/Fin=0.1374, Energy=0.2086, Healthcare=0.3970, Nature=0.4195, Sales=0.3487, Transport=0.4621, Web/CloudOps=0.5017. + +zero_mass_wide, backcast: 3.55 seconds. +- Setting 0.0: skill 0.327844; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.02: skill 0.328180; term short=0.2912, medium=0.3532, long=0.3937; domain Econ/Fin=0.1636, Energy=0.2229, Healthcare=0.3816, Nature=0.3537, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4409. +- Setting 0.05: skill 0.328643; term short=0.2914, medium=0.3540, long=0.3942; domain Econ/Fin=0.1636, Energy=0.2235, Healthcare=0.3816, Nature=0.3546, Sales=0.3957, Transport=0.3666, Web/CloudOps=0.4415. +- Setting 0.1: skill 0.329276; term short=0.2917, medium=0.3550, long=0.3953; domain Econ/Fin=0.1636, Energy=0.2243, Healthcare=0.3816, Nature=0.3553, Sales=0.3959, Transport=0.3666, Web/CloudOps=0.4426. + +zero_mass_wide, backcast2: 3.53 seconds. +- Setting 0.0: skill 0.354561; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- Setting 0.02: skill 0.354943; term short=0.3400, medium=0.3834, long=0.3646; domain Econ/Fin=0.1095, Energy=0.2266, Healthcare=0.3738, Nature=0.4627, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4283. +- Setting 0.05: skill 0.355475; term short=0.3406, medium=0.3840, long=0.3651; domain Econ/Fin=0.1095, Energy=0.2278, Healthcare=0.3738, Nature=0.4637, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4284. +- Setting 0.1: skill 0.356263; term short=0.3413, medium=0.3849, long=0.3660; domain Econ/Fin=0.1095, Energy=0.2295, Healthcare=0.3738, Nature=0.4650, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4287. + +zero_mass_range, screen: 3.63 seconds. +- Setting 0.1: skill 0.364736; term short=0.3357, medium=0.4036, long=0.3981; domain Econ/Fin=0.1374, Energy=0.2086, Healthcare=0.3970, Nature=0.4195, Sales=0.3487, Transport=0.4621, Web/CloudOps=0.5017. +- Setting 0.2: skill 0.368575; term short=0.3420, medium=0.4046, long=0.3988; domain Econ/Fin=0.1374, Energy=0.2225, Healthcare=0.3970, Nature=0.4210, Sales=0.3475, Transport=0.4621, Web/CloudOps=0.5015. +- Setting 0.4: skill 0.370559; term short=0.3458, medium=0.4052, long=0.3979; domain Econ/Fin=0.1374, Energy=0.2332, Healthcare=0.3970, Nature=0.4205, Sales=0.3463, Transport=0.4621, Web/CloudOps=0.4986. +- Setting 0.8: skill 0.364344; term short=0.3385, medium=0.4008, long=0.3925; domain Econ/Fin=0.1374, Energy=0.2220, Healthcare=0.3970, Nature=0.4198, Sales=0.3444, Transport=0.4621, Web/CloudOps=0.4869. + +zero_mass_range, backcast: 3.50 seconds. +- Setting 0.1: skill 0.329276; term short=0.2917, medium=0.3550, long=0.3953; domain Econ/Fin=0.1636, Energy=0.2243, Healthcare=0.3816, Nature=0.3553, Sales=0.3959, Transport=0.3666, Web/CloudOps=0.4426. +- Setting 0.2: skill 0.330173; term short=0.2923, medium=0.3563, long=0.3966; domain Econ/Fin=0.1636, Energy=0.2253, Healthcare=0.3816, Nature=0.3560, Sales=0.3970, Transport=0.3666, Web/CloudOps=0.4444. +- Setting 0.4: skill 0.330696; term short=0.2928, medium=0.3550, long=0.3988; domain Econ/Fin=0.1636, Energy=0.2247, Healthcare=0.3816, Nature=0.3559, Sales=0.3972, Transport=0.3666, Web/CloudOps=0.4472. +- Setting 0.8: skill 0.327637; term short=0.2916, medium=0.3471, long=0.3961; domain Econ/Fin=0.1636, Energy=0.2180, Healthcare=0.3815, Nature=0.3525, Sales=0.3939, Transport=0.3666, Web/CloudOps=0.4454. + +zero_mass_range, backcast2: 3.39 seconds. +- Setting 0.1: skill 0.356263; term short=0.3413, medium=0.3849, long=0.3660; domain Econ/Fin=0.1095, Energy=0.2295, Healthcare=0.3738, Nature=0.4650, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4287. +- Setting 0.2: skill 0.357389; term short=0.3423, medium=0.3862, long=0.3671; domain Econ/Fin=0.1095, Energy=0.2319, Healthcare=0.3738, Nature=0.4665, Sales=0.5592, Transport=0.4168, Web/CloudOps=0.4293. +- Setting 0.4: skill 0.357884; term short=0.3425, medium=0.3883, long=0.3665; domain Econ/Fin=0.1095, Energy=0.2327, Healthcare=0.3738, Nature=0.4661, Sales=0.5573, Transport=0.4168, Web/CloudOps=0.4312. +- Setting 0.8: skill 0.350745; term short=0.3358, medium=0.3808, long=0.3588; domain Econ/Fin=0.1095, Energy=0.2213, Healthcare=0.3737, Nature=0.4523, Sales=0.5499, Transport=0.4168, Web/CloudOps=0.4272. + +zero_phase, screen: 4.24 seconds. +- Setting None: skill 0.370559; term short=0.3458, medium=0.4052, long=0.3979; domain Econ/Fin=0.1374, Energy=0.2332, Healthcare=0.3970, Nature=0.4205, Sales=0.3463, Transport=0.4621, Web/CloudOps=0.4986. +- Setting 0: skill 0.367375; term short=0.3412, medium=0.4029, long=0.3972; domain Econ/Fin=0.1374, Energy=0.2196, Healthcare=0.3970, Nature=0.4183, Sales=0.3529, Transport=0.4621, Web/CloudOps=0.5008. +- Setting 4: skill 0.369637; term short=0.3443, medium=0.4040, long=0.3986; domain Econ/Fin=0.1374, Energy=0.2277, Healthcare=0.3970, Nature=0.4202, Sales=0.3515, Transport=0.4621, Web/CloudOps=0.5001. +- Setting 8: skill 0.369822; term short=0.3448, medium=0.4037, long=0.3986; domain Econ/Fin=0.1374, Energy=0.2278, Healthcare=0.3970, Nature=0.4202, Sales=0.3518, Transport=0.4621, Web/CloudOps=0.5007. + +zero_phase, backcast: 4.22 seconds. +- Setting None: skill 0.330696; term short=0.2928, medium=0.3550, long=0.3988; domain Econ/Fin=0.1636, Energy=0.2247, Healthcare=0.3816, Nature=0.3559, Sales=0.3972, Transport=0.3666, Web/CloudOps=0.4472. +- Setting 0: skill 0.328679; term short=0.2917, medium=0.3538, long=0.3940; domain Econ/Fin=0.1636, Energy=0.2231, Healthcare=0.3816, Nature=0.3547, Sales=0.4001, Transport=0.3666, Web/CloudOps=0.4412. +- Setting 4: skill 0.329503; term short=0.2920, medium=0.3549, long=0.3957; domain Econ/Fin=0.1636, Energy=0.2254, Healthcare=0.3816, Nature=0.3555, Sales=0.3995, Transport=0.3666, Web/CloudOps=0.4415. +- Setting 8: skill 0.329633; term short=0.2921, medium=0.3549, long=0.3960; domain Econ/Fin=0.1636, Energy=0.2252, Healthcare=0.3816, Nature=0.3555, Sales=0.4003, Transport=0.3666, Web/CloudOps=0.4420. + +zero_phase, backcast2: 3.98 seconds. +- Setting None: skill 0.357884; term short=0.3425, medium=0.3883, long=0.3665; domain Econ/Fin=0.1095, Energy=0.2327, Healthcare=0.3738, Nature=0.4661, Sales=0.5573, Transport=0.4168, Web/CloudOps=0.4312. +- Setting 0: skill 0.355941; term short=0.3416, medium=0.3833, long=0.3653; domain Econ/Fin=0.1095, Energy=0.2288, Healthcare=0.3738, Nature=0.4641, Sales=0.5605, Transport=0.4168, Web/CloudOps=0.4286. +- Setting 4: skill 0.357313; term short=0.3424, medium=0.3856, long=0.3670; domain Econ/Fin=0.1095, Energy=0.2321, Healthcare=0.3738, Nature=0.4661, Sales=0.5605, Transport=0.4168, Web/CloudOps=0.4289. +- Setting 8: skill 0.357230; term short=0.3422, medium=0.3858, long=0.3672; domain Econ/Fin=0.1095, Energy=0.2314, Healthcare=0.3738, Nature=0.4664, Sales=0.5608, Transport=0.4168, Web/CloudOps=0.4291. + +E40 outcome: unrestricted E37 threshold0.4 beats all global/phase-probability guards on every cutoff. Phase4 gives0.369637/0.329503/0.357313; phase8 gives0.369822/0.329633/0.357230; unrestricted gives0.370559/0.330696/0.357884. Do not add the probability guard. + +E36 component checkpoint hashes: recency12000 `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`; control18000 `b7bbb7473a317145235c133492a0d743a90a01ff252577a4c8a4651db008a138`. These were cached diagnostic blends only, without additional training. + +## E41: learned zero-probability classifier with a frozen backbone +Hypothesis: a classifier trained on allowed windows can make the zero projection conditional on future zero probability more accurately than the empirical guards rejected in E40. Freeze E25 recency18000 and train only a small MLP on decoder representations, global zero fraction, two four-cycle phase zero frequencies and absolute normalized median forecast. The classifier receives BCE loss for exact-zero futures only on sign-homogeneous contexts containing at least4 zeros and10% zeros. At inference, average probabilities from both sign orientations and allow the existing threshold0.4 projection only for quantile levels at or below that probability. Every instance passes through the same backbone and classifier. Bias5 initialization makes probability0.993 and preserves E37 forecasts. Own packed_sample and unchanged synthetic generator; seed83, batch128, LR2e-4, 6000-step schedule, one Torch CPU thread. This adds no external data and trains no backbone parameters. + +## E35 explicit trend inputs 3000-step screen +- Checkpoint SHA-256: `17d346dde232341672545210839ea10fc6e147d6e1d65d2457497d790fc652f6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.317448616027832 seconds. +- Overall skill 0.351994; relative MASE 0.770114; relative WQL 0.545259. +- term skill: long=0.3848, medium=0.3991, short=0.3197. +- domain skill: Econ/Fin=0.1029, Energy=0.1770, Healthcare=0.4091, Nature=0.4082, Sales=0.3492, Transport=0.4538, Web/CloudOps=0.5011. +- frequency skill: A=0.3685, D=0.3335, H=0.3745, M=0.0901, Q=0.1894, S=0.4379, T=0.3955, W=0.1971. +- variates skill: multivariate=0.3833, univariate=0.3260. +- Outcome: Small improvement over matched E25: screen0.351994 versus0.351702, first earlier0.321829 versus0.321665. Continue to6000 to determine whether this persists. + +E35 training through3000 took850.6 elapsed process seconds on the shared H100. + +## E42: match training decoder horizons to available labels (prepared) +Hypothesis: short pretraining series supply fewer finite future labels than the requested32/128/512/1024 horizon, yet the current decoder sees every requested future token and receives that larger horizon in its metadata. During training only, infer each row's available horizon as its last finite target position, rounded up to the patch boundary; use that length for horizon metadata and mask unused future tokens as self-attention keys in every decoder layer. The label mask and loss remain unchanged. At inference the full requested horizon is used exactly as before, with no new inputs or fitting. Match E38 packed_sample control: own recency12000 initialization, seed79, batch256, LR5e-5, 12000 steps, unchanged sampler. No new model parameters or data. Planned to begin after the small frozen classifier releases memory; GPU evaluations are serialized to bound peak memory. + +E38 expanded corpus arm training started at 2026-10-22T04:02:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E41 initialization check: all original backbone tensors match the parent bitwise. With identical screen batches, every quantile in all97 configurations is bitwise equal to the parent; maximum difference0. The parent direct-screen score is0.374499664. The cached subset of full-validation predictions scores0.374469795 because batch composition and padding differ slightly; matched direct evaluations are used for E41 comparisons. The classifier has75,920 trainable parameters; total36,873,648. At1000/3000 steps, screen0.373402/0.374243 remains below the unchanged parent. Continue to the planned6000-step endpoint. + +E42 data diagnostic (only packed pretraining data, seed79, 640 windows per requested horizon): H32: 6.4% partial futures, mean available31.0; H128: 14.5% partial futures, mean available117.9; H512: 16.7% partial futures, mean available456.8; H1024: 19.2% partial futures, mean available886.4. CPU elapsed 0.93 seconds. A forward check verified bitwise unchanged ordinary inference and agreement within5.4e-7 between a padded masked short target and an actual short-horizon call. + +E35 first three cutoff comparisons at3000 steps: screen0.351994 versus matched0.351702; earlier1 0.321829 versus0.321665; earlier2 0.346465 versus0.346396. All gains are small; keep the6000-step comparison before drawing an architectural conclusion. + +## E22 depth36 control final24000-step screen +- Checkpoint SHA-256: `d60cdc55e693df0caf601ded61031be859ee027b0da46585586a3c6a3b5276ba`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.044859170913696 seconds. +- Overall skill 0.359867; relative MASE 0.762956; relative WQL 0.537082. +- term skill: long=0.3922, medium=0.4034, short=0.3293. +- domain skill: Econ/Fin=0.1126, Energy=0.1866, Healthcare=0.4038, Nature=0.4208, Sales=0.3464, Transport=0.4583, Web/CloudOps=0.5101. +- frequency skill: A=0.3718, D=0.3396, H=0.3822, M=0.0911, Q=0.1974, S=0.4422, T=0.4054, W=0.2072. +- variates skill: multivariate=0.3956, univariate=0.3299. +- Outcome: Final mean-template screen0.359867 improves its18000-step0.359224 but remains below E25 recency18000 at0.361265. Finished5206.4 elapsed training-process seconds; no new package selected. GPU capacity transferred to E38 expanded corpus arm. + +E42 partial target horizons training started at 2026-10-22T04:06:37Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E43: recheck fixed prior strengths on the stronger backbone +Hypothesis: the seasonal and continuity corrections selected on earlier models may be too strong after continued pretraining. Cache uncorrected symmetric neural forecasts from E25 recency18000, then compare all nine combinations of seasonal blend strength0/0.5/1 and continuity blend strength0/0.5/1. The candidate seasonal forecast is the existing aligned rule; partial strength interpolates it with the neural forecast. Continuity strength similarly interpolates the existing tau24 correction with its input. Keep the selected zero-mass threshold0.4 fixed and apply it last. Use the same global settings on all three cutoffs. No training or new data; inference seed0. + +## E41 frozen zero classifier3000-step screen +- Checkpoint SHA-256: `08b5cc376746c87331cee4628ec56126adf48076aa08ffd2f2bd3f74427d4d96`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.868639707565308 seconds. +- Overall skill 0.374243; relative MASE 0.746287; relative WQL 0.524694. +- term skill: long=0.3998, medium=0.4060, short=0.3515. +- domain skill: Econ/Fin=0.1332, Energy=0.2307, Healthcare=0.4319, Nature=0.4244, Sales=0.3502, Transport=0.4650, Web/CloudOps=0.5035. +- frequency skill: A=0.3692, D=0.3463, H=0.3950, M=0.1023, Q=0.2006, S=0.4218, T=0.4344, W=0.2127. +- variates skill: multivariate=0.3931, univariate=0.3588. +- Outcome: Screen0.374243 is below unchanged parent0.374500. Earlier1 0.331330 versus0.332400; earlier2 0.356106 versus0.356697. The classifier repairs some sales and cloud errors but gives back more solar improvement; no package change. + +## E44: training-consistent trend summary on short contexts +Code review found that the original trend basis chooses its averaging width from padded tensor width: min(128,max(4,c//4)). Training always pads to at least512, making this width128, whereas short inference batches often select smaller widths. This also makes the fixed trend summary sensitive to batch padding. Test a globally fixed128-point width at inference, preserving the exact formula used throughout training. It uses only each row's observed values; other features and all selected corrections remain unchanged. No new parameters, training or data. Compare the recency18000 checkpoint on the screen and both earlier windows before selecting a package. + +E44 first diagnostic launch failed before producing a forecast: a source-edit comment accidentally hid the adjacent recent-mean assignment. Corrected the assignment and restarted all three diagnostics; no failed output was scored or published. + +## E41 frozen zero classifier final6000-step screen +- Checkpoint SHA-256: `9dcf4fa821ca636b648447e0516258a3da7056b5e98ec944d0251c73e5ae3006`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.14689803123474 seconds. +- Overall skill 0.374576; relative MASE 0.746312; relative WQL 0.524117. +- term skill: long=0.3999, medium=0.4061, short=0.3520. +- domain skill: Econ/Fin=0.1332, Energy=0.2315, Healthcare=0.4319, Nature=0.4249, Sales=0.3502, Transport=0.4650, Web/CloudOps=0.5037. +- frequency skill: A=0.3692, D=0.3465, H=0.3951, M=0.1017, Q=0.2006, S=0.4218, T=0.4353, W=0.2127. +- variates skill: multivariate=0.3934, univariate=0.3592. +- Outcome: Final screen0.374576 versus unchanged parent0.374500 is nearly tied. Both earlier cutoffs regress:0.331200 versus0.332400 and0.356162 versus0.356697. Do not select this classifier; retain fixed zero projection. Training took559.8 process seconds; backbone stayed frozen. + +## E43 complete prior-strength comparison +Checkpoint SHA-256 `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`; fixed inference seed0; no training. + +screen: 10.68 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.352854; term short=0.3372, medium=0.3820, long=0.3635; domain Econ/Fin=0.0649, Energy=0.2249, Healthcare=0.3918, Nature=0.4305, Sales=0.3458, Transport=0.4676, Web/CloudOps=0.4394. +- Seasonal0.0, continuity0.5: skill0.358015; term short=0.3463, medium=0.3820, long=0.3639; domain Econ/Fin=0.1059, Energy=0.2325, Healthcare=0.4145, Nature=0.4284, Sales=0.3457, Transport=0.4662, Web/CloudOps=0.4421. +- Seasonal0.0, continuity1.0: skill0.358419; term short=0.3472, medium=0.3814, long=0.3642; domain Econ/Fin=0.1280, Energy=0.2289, Healthcare=0.4280, Nature=0.4258, Sales=0.3457, Transport=0.4637, Web/CloudOps=0.4444. +- Seasonal0.5, continuity0.0: skill0.361594; term short=0.3390, medium=0.3982, long=0.3816; domain Econ/Fin=0.0723, Energy=0.2304, Healthcare=0.3951, Nature=0.4304, Sales=0.3450, Transport=0.4683, Web/CloudOps=0.4668. +- Seasonal0.5, continuity0.5: skill0.367185; term short=0.3491, medium=0.3978, long=0.3823; domain Econ/Fin=0.1132, Energy=0.2381, Healthcare=0.4171, Nature=0.4282, Sales=0.3449, Transport=0.4670, Web/CloudOps=0.4713. +- Seasonal0.5, continuity1.0: skill0.367831; term short=0.3505, medium=0.3970, long=0.3826; domain Econ/Fin=0.1347, Energy=0.2340, Healthcare=0.4301, Nature=0.4256, Sales=0.3449, Transport=0.4647, Web/CloudOps=0.4751. +- Seasonal1.0, continuity0.0: skill0.366912; term short=0.3385, medium=0.4065, long=0.3980; domain Econ/Fin=0.0640, Energy=0.2315, Healthcare=0.3974, Nature=0.4301, Sales=0.3440, Transport=0.4682, Web/CloudOps=0.4881. +- Seasonal1.0, continuity0.5: skill0.373401; term short=0.3497, medium=0.4072, long=0.3989; domain Econ/Fin=0.1094, Energy=0.2393, Healthcare=0.4192, Nature=0.4280, Sales=0.3439, Transport=0.4672, Web/CloudOps=0.4952. +- Seasonal1.0, continuity1.0: skill0.374500; term short=0.3517, medium=0.4069, long=0.3994; domain Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007. + +backcast: 11.26 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.307142; term short=0.2826, medium=0.3351, long=0.3410; domain Econ/Fin=0.1076, Energy=0.2255, Healthcare=0.3430, Nature=0.3552, Sales=0.3986, Transport=0.3768, Web/CloudOps=0.3599. +- Seasonal0.0, continuity0.5: skill0.312170; term short=0.2916, medium=0.3354, long=0.3411; domain Econ/Fin=0.1400, Energy=0.2277, Healthcare=0.3844, Nature=0.3556, Sales=0.3986, Transport=0.3764, Web/CloudOps=0.3620. +- Seasonal0.0, continuity1.0: skill0.314938; term short=0.2967, medium=0.3353, long=0.3409; domain Econ/Fin=0.1539, Energy=0.2269, Healthcare=0.4209, Nature=0.3555, Sales=0.3986, Transport=0.3753, Web/CloudOps=0.3636. +- Seasonal0.5, continuity0.0: skill0.318715; term short=0.2868, medium=0.3483, long=0.3683; domain Econ/Fin=0.1210, Energy=0.2277, Healthcare=0.3359, Nature=0.3556, Sales=0.3986, Transport=0.3747, Web/CloudOps=0.4076. +- Seasonal0.5, continuity0.5: skill0.323130; term short=0.2948, medium=0.3486, long=0.3682; domain Econ/Fin=0.1519, Energy=0.2300, Healthcare=0.3781, Nature=0.3560, Sales=0.3986, Transport=0.3744, Web/CloudOps=0.4072. +- Seasonal0.5, continuity1.0: skill0.325194; term short=0.2988, medium=0.3485, long=0.3679; domain Econ/Fin=0.1645, Energy=0.2291, Healthcare=0.4163, Nature=0.3559, Sales=0.3986, Transport=0.3733, Web/CloudOps=0.4059. +- Seasonal1.0, continuity0.0: skill0.326613; term short=0.2844, medium=0.3570, long=0.3986; domain Econ/Fin=0.1011, Energy=0.2252, Healthcare=0.3156, Nature=0.3558, Sales=0.3986, Transport=0.3713, Web/CloudOps=0.4530. +- Seasonal1.0, continuity0.5: skill0.330837; term short=0.2922, medium=0.3575, long=0.3984; domain Econ/Fin=0.1366, Energy=0.2277, Healthcare=0.3596, Nature=0.3563, Sales=0.3986, Transport=0.3710, Web/CloudOps=0.4510. +- Seasonal1.0, continuity1.0: skill0.332400; term short=0.2953, medium=0.3574, long=0.3980; domain Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472. + +backcast2: 10.77 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.342833; term short=0.3444, medium=0.3372, long=0.3447; domain Econ/Fin=0.0850, Energy=0.2421, Healthcare=0.3909, Nature=0.4651, Sales=0.5517, Transport=0.4200, Web/CloudOps=0.3492. +- Seasonal0.0, continuity0.5: skill0.343238; term short=0.3448, medium=0.3374, long=0.3451; domain Econ/Fin=0.1046, Energy=0.2395, Healthcare=0.3778, Nature=0.4655, Sales=0.5516, Transport=0.4195, Web/CloudOps=0.3541. +- Seasonal0.0, continuity1.0: skill0.341670; term short=0.3421, medium=0.3372, long=0.3453; domain Econ/Fin=0.1096, Energy=0.2345, Healthcare=0.3641, Nature=0.4656, Sales=0.5516, Transport=0.4183, Web/CloudOps=0.3571. +- Seasonal0.5, continuity0.0: skill0.353176; term short=0.3476, medium=0.3630, long=0.3580; domain Econ/Fin=0.0889, Energy=0.2454, Healthcare=0.3896, Nature=0.4651, Sales=0.5517, Transport=0.4202, Web/CloudOps=0.3933. +- Seasonal0.5, continuity0.5: skill0.353075; term short=0.3473, medium=0.3630, long=0.3584; domain Econ/Fin=0.1076, Energy=0.2421, Healthcare=0.3764, Nature=0.4655, Sales=0.5516, Transport=0.4198, Web/CloudOps=0.3966. +- Seasonal0.5, continuity1.0: skill0.350860; term short=0.3435, medium=0.3626, long=0.3584; domain Econ/Fin=0.1107, Energy=0.2362, Healthcare=0.3627, Nature=0.4656, Sales=0.5516, Transport=0.4185, Web/CloudOps=0.3980. +- Seasonal1.0, continuity0.0: skill0.359824; term short=0.3464, medium=0.3881, long=0.3655; domain Econ/Fin=0.0796, Energy=0.2431, Healthcare=0.3878, Nature=0.4651, Sales=0.5517, Transport=0.4196, Web/CloudOps=0.4291. +- Seasonal1.0, continuity0.5: skill0.359396; term short=0.3456, medium=0.3880, long=0.3658; domain Econ/Fin=0.1008, Energy=0.2396, Healthcare=0.3747, Nature=0.4655, Sales=0.5516, Transport=0.4192, Web/CloudOps=0.4307. +- Seasonal1.0, continuity1.0: skill0.356697; term short=0.3411, medium=0.3874, long=0.3657; domain Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303. + +E43 outcome: retain both corrections at full strength. Seasonal full strength wins at every cutoff. Full continuity wins the main screen and first earlier cutoff; removing or weakening it helps the second earlier cutoff. Half continuity has essentially the same three-cutoff average but lowers the main screen, so the current rule is retained. This confirms that the fixed corrections still contribute after additional pretraining. + +E39 pre-launch correction: require at least one strictly positive or negative observed value before imposing the corresponding training bound. All-zero contexts otherwise satisfy both signs and would force every quantile to zero. Such contexts retain the original unconstrained training forward pass; the existing final nonnegative inference projection remains unchanged. This correction was made before E39 training started. + +E44 selected: full validation0.371267 versus previous0.370171; matched direct screen0.375386 versus0.374500; earlier1 0.333401 versus0.332400; earlier2 0.357015 versus0.356697. All improve. Full package inference took116.2 seconds under concurrent training, with97 configurations and151170 instances, zero failures and no quantile crossings. Repeated relocated examples are bitwise identical. With the actual trained model, adding left padding to histories of lengths8/16/40 changes raw forecasts by at most3.82e-6 in float32, consistent with numerical reduction differences. The averaging width is now independent of batch padding and matches all pretraining context lengths. No training or parameter changes were needed. + +## E44 fixed128 trend summary full package validation +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371267; relative MASE 0.749824; relative WQL 0.527198. +- term skill: long=0.3932, medium=0.4057, short=0.3489. +- domain skill: Econ/Fin=0.1097, Energy=0.2283, Healthcare=0.4445, Nature=0.4270, Sales=0.3536, Transport=0.4653, Web/CloudOps=0.4932. +- frequency skill: A=0.2900, D=0.3545, H=0.3906, M=0.1144, Q=0.1842, S=0.4218, T=0.4285, W=0.2081. +- variates skill: multivariate=0.3889, univariate=0.3569. +- Outcome: Published atomically. Full0.371267, screen0.375386, first earlier0.333401, second earlier0.357015. All improve over the previous package; repeated relocated inference is bitwise deterministic and all151170 instances score successfully. + +## E44 first earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.190837860107422 seconds. +- Overall skill 0.333401; relative MASE 0.800857; relative WQL 0.554849. +- term skill: long=0.3980, medium=0.3574, short=0.2971. +- domain skill: Econ/Fin=0.1546, Energy=0.2269, Healthcare=0.4152, Nature=0.3561, Sales=0.3982, Transport=0.3697, Web/CloudOps=0.4472. +- frequency skill: A=0.3057, D=0.3535, H=0.3642, M=0.1858, Q=0.2322, S=0.3397, T=0.3325, W=0.2671. +- variates skill: multivariate=0.3493, univariate=0.3205. +- Outcome: Improves the preceding published package. + +## E44 second earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.125259160995483 seconds. +- Overall skill 0.357015; relative MASE 0.773709; relative WQL 0.534347. +- term skill: long=0.3657, medium=0.3874, short=0.3417. +- domain skill: Econ/Fin=0.1037, Energy=0.2341, Healthcare=0.3586, Nature=0.4669, Sales=0.5519, Transport=0.4175, Web/CloudOps=0.4304. +- frequency skill: A=0.3474, D=0.4297, H=0.3890, M=0.1482, Q=0.1491, S=0.2798, T=0.3574, W=0.2484. +- variates skill: multivariate=0.3619, univariate=0.3530. +- Outcome: Improves the preceding published package. + +E35 follow-up: compare both6000-step models again with the now-selected E44 fixed128 basis and E37 zero0.4 rule. The old adaptive-width basis may interact with the new learned short-trend features, so this paired diagnostic will check whether their small gain changes once training/inference formulas agree. No retraining or new thresholds. + +## E31 amplitude synthetic12000-step screen +- Checkpoint SHA-256: `88d6ebecc5342e428b803fcb60af38cafa8f94383976621f3f200abee9b2eb0e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.205806970596313 seconds. +- Overall skill 0.358165; relative MASE 0.764973; relative WQL 0.538519. +- term skill: long=0.3902, medium=0.4022, short=0.3275. +- domain skill: Econ/Fin=0.1122, Energy=0.1848, Healthcare=0.3959, Nature=0.4185, Sales=0.3479, Transport=0.4568, Web/CloudOps=0.5094. +- frequency skill: A=0.3775, D=0.3345, H=0.3814, M=0.0974, Q=0.1993, S=0.4416, T=0.4040, W=0.1998. +- variates skill: multivariate=0.3933, univariate=0.3287. +- Outcome: Mean-template screen0.358165 remains above matched E25-12000 0.357241, after gains at3000 and6000. The advantage is smaller than at6000; continue to18000 and24000 before selecting a new package. + +## E35 explicit trend6000-step screen +- Checkpoint SHA-256: `2ad3f9148954d7b3a16365ec529767cc3a0803b4488c7a475838725497c13565`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.423240423202515 seconds. +- Overall skill 0.353152; relative MASE 0.769279; relative WQL 0.543902. +- term skill: long=0.3873, medium=0.3990, short=0.3208. +- domain skill: Econ/Fin=0.1103, Energy=0.1816, Healthcare=0.3998, Nature=0.4115, Sales=0.3496, Transport=0.4548, Web/CloudOps=0.4989. +- frequency skill: A=0.3705, D=0.3396, H=0.3769, M=0.0764, Q=0.1986, S=0.4369, T=0.3960, W=0.1933. +- variates skill: multivariate=0.3851, univariate=0.3265. +- Outcome: Mean-template screen0.353152 versus matched E25 0.352851; earlier1 0.323894 versus0.324008; earlier2 0.349429 versus0.349098. With all selected fixed rules, screen0.366300 versus matched0.366032. The effect remains small; retain checkpoints and compare at12000. + +amplitude_synth through12000: 3311.5 elapsed training-process seconds on the shared H100. + +trend_features through6000: 1795.6 elapsed training-process seconds on the shared H100. + +E39 bounded quantiles training started at 2026-10-22T04:19:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E25 recency final24000-step matched mean-template screen +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.549001216888428 seconds. +- Overall skill 0.361808; relative MASE 0.760201; relative WQL 0.535765. +- term skill: long=0.3930, medium=0.4043, short=0.3321. +- domain skill: Econ/Fin=0.1144, Energy=0.1875, Healthcare=0.4304, Nature=0.4242, Sales=0.3432, Transport=0.4595, Web/CloudOps=0.5080. +- frequency skill: A=0.3731, D=0.3487, H=0.3832, M=0.0957, Q=0.1965, S=0.4423, T=0.4054, W=0.2079. +- variates skill: multivariate=0.3953, univariate=0.3338. +- Outcome: Final screen0.361808 versus matched E22-24000 0.359867. The learned recency features improve the matched comparison at every evaluated checkpoint. Completed5879.4 elapsed training-process seconds; full validation with selected fixed rules is pending. + +## E38 expanded corpus3000-step screen +- Checkpoint SHA-256: `13cb3d2a222cd09f622eff3fe1657c4aebe2b1f2ca22a226462ecd0bb2c94026`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.664713144302368 seconds. +- Overall skill 0.358667; relative MASE 0.763557; relative WQL 0.538674. +- term skill: long=0.3925, medium=0.4038, short=0.3268. +- domain skill: Econ/Fin=0.1145, Energy=0.1852, Healthcare=0.4021, Nature=0.4196, Sales=0.3470, Transport=0.4576, Web/CloudOps=0.5080. +- frequency skill: A=0.3749, D=0.3373, H=0.3835, M=0.0979, Q=0.1983, S=0.4405, T=0.4029, W=0.1974. +- variates skill: multivariate=0.3933, univariate=0.3297. +- Outcome: Screen0.358667 versus matched packed_sample control0.358802: nearly tied. Broader corpus coverage has not yet provided a clear advantage. Continue to6000 and12000; source probabilities remain fixed to the original mixture. + +## E38 packed_sample control6000-step screen +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.290119647979736 seconds. +- Overall skill 0.358628; relative MASE 0.763471; relative WQL 0.538799. +- term skill: long=0.3894, medium=0.4025, short=0.3286. +- domain skill: Econ/Fin=0.1093, Energy=0.1839, Healthcare=0.4157, Nature=0.4245, Sales=0.3451, Transport=0.4579, Web/CloudOps=0.5041. +- frequency skill: A=0.3762, D=0.3427, H=0.3805, M=0.1014, Q=0.1966, S=0.4404, T=0.4018, W=0.2035. +- variates skill: multivariate=0.3910, univariate=0.3316. +- Outcome: Screen0.358628 versus this restart at3000 0.358802. This restart has not surpassed uninterrupted E25 continuation. Retain as the matched control for corpus coverage, bounded quantiles and partial target horizons; assess after learning-rate decay. + +## E45: average late recency checkpoints +Hypothesis: uniform parameter averaging of the same training trajectory can reduce checkpoint variation without adding inference cost. Average own E25 EMA checkpoints at18000/21000/24000 in FP32, retaining their shared configuration. This is one model with fixed averaged weights; every parent was trained here from the same random-initialization lineage, seed59. No additional data or gradient updates. Use the selected aligned seasonal rule, continuity, zero0.4 and fixed128 trend basis. Evaluate all three cutoffs before building a full candidate. The averaging script and every parent hash are preserved. + +E25 final24000-step package selected: full0.371479 versus18000-step0.371267; direct screen0.375502 versus0.375386; first earlier0.334180 versus0.333401; second earlier0.358275 versus0.357015. All improve. Full inference126.1 seconds under concurrent training;97 configurations,151170 instances, zero failures and no quantile crossings. Repeated relocated examples are bitwise identical, finite and monotone. Fixed rules are unchanged from E44. + +E45 outcome: the uniform18000/21000/24000 EMA average scores0.375408/0.333912/0.358081 on the three cutoffs, below the final24000 checkpoint at0.375502/0.334180/0.358275 on every cutoff. Not selected; no full package evaluation. No training compute; parameter averaging was not separately timed, and individual diagnostic evaluation times are recorded below. + +## E25 final24000-step package with selected fixed rules +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371479; relative MASE 0.748783; relative WQL 0.527575. +- term skill: long=0.3935, medium=0.4057, short=0.3491. +- domain skill: Econ/Fin=0.1165, Energy=0.2279, Healthcare=0.4442, Nature=0.4287, Sales=0.3521, Transport=0.4652, Web/CloudOps=0.4925. +- frequency skill: A=0.2919, D=0.3570, H=0.3902, M=0.1164, Q=0.1836, S=0.4232, T=0.4289, W=0.2028. +- variates skill: multivariate=0.3893, univariate=0.3569. +- Outcome: Published atomically. Full0.371479, screen0.375502, earlier1 0.334180, earlier2 0.358275. All improve over the preceding18000-step package. All151170 instances score; repeated relocated examples are bitwise deterministic, finite and monotone. + +## Published recency24000 first earlier diagnostic +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.669825792312622 seconds. +- Overall skill 0.334180; relative MASE 0.799611; relative WQL 0.554415. +- term skill: long=0.3968, medium=0.3571, short=0.2993. +- domain skill: Econ/Fin=0.1593, Energy=0.2277, Healthcare=0.4063, Nature=0.3608, Sales=0.3980, Transport=0.3712, Web/CloudOps=0.4466. +- frequency skill: A=0.3097, D=0.3512, H=0.3634, M=0.1820, Q=0.2352, S=0.3426, T=0.3343, W=0.2771. +- variates skill: multivariate=0.3511, univariate=0.3204. +- Outcome: Improves the preceding package. + +## Published recency24000 second earlier diagnostic +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.378834009170532 seconds. +- Overall skill 0.358275; relative MASE 0.771140; relative WQL 0.534029. +- term skill: long=0.3653, medium=0.3854, short=0.3449. +- domain skill: Econ/Fin=0.1098, Energy=0.2362, Healthcare=0.3503, Nature=0.4701, Sales=0.5516, Transport=0.4194, Web/CloudOps=0.4299. +- frequency skill: A=0.3501, D=0.4315, H=0.3891, M=0.1569, Q=0.1519, S=0.2833, T=0.3571, W=0.2551. +- variates skill: multivariate=0.3625, univariate=0.3548. +- Outcome: Improves the preceding package. + +## E45 averaged late EMA screen +- Checkpoint SHA-256: `9b3541cfc195324574d22e27a8e3ac38edf7408712372933c645c892f39fa746`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.790673971176147 seconds. +- Overall skill 0.375408; relative MASE 0.746595; relative WQL 0.522527. +- term skill: long=0.3999, medium=0.4064, short=0.3534. +- domain skill: Econ/Fin=0.1379, Energy=0.2352, Healthcare=0.4383, Nature=0.4274, Sales=0.3404, Transport=0.4653, Web/CloudOps=0.5004. +- frequency skill: A=0.3761, D=0.3516, H=0.3953, M=0.0934, Q=0.2004, S=0.4222, T=0.4355, W=0.2141. +- variates skill: multivariate=0.3931, univariate=0.3610. +- Outcome: Below the final24000 checkpoint on all three cutoffs; not selected. + +## E42 partial target horizons3000-step screen +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.083299160003662 seconds. +- Overall skill 0.358812; relative MASE 0.763592; relative WQL 0.538405. +- term skill: long=0.3907, medium=0.4016, short=0.3287. +- domain skill: Econ/Fin=0.1123, Energy=0.1842, Healthcare=0.4163, Nature=0.4220, Sales=0.3469, Transport=0.4589, Web/CloudOps=0.5047. +- frequency skill: A=0.3754, D=0.3440, H=0.3817, M=0.1026, Q=0.1980, S=0.4409, T=0.3995, W=0.2076. +- variates skill: multivariate=0.3908, univariate=0.3321. +- Outcome: Screen0.358812 versus matched control0.358802 is effectively tied. Gains in annual, quarterly, monthly and weekly groups are offset by minute-frequency losses. Continue to6000 and12000 to assess persistence. + +## E46: use forecast slopes for the fixed continuity correction +A per-channel diagnostic found that several ETT2 short-horizon forecasts underreact to a rebound after the latest trough: truth rises about1.1–1.9 context standard deviations in multiple channels, while the model rises only0.6–0.9. The current continuity anchor extrapolates the previous eight differences and may continue the old direction across a turn. Keep the smoothness gate, tau24, seasonal rule and zero0.4 fixed; compare past8 (current), zero slope, first forecast difference, and median of the first eight forecast differences. These are fixed transformations, with no fitting. Reuse the E25-18000 raw forecast caches for a paired diagnostic on all three cutoffs; their old short-context trend basis is unchanged within this comparison. Any selected variant must transfer to the latest fixed128 package before publication. + +## E47: frozen-backbone confidence-query projection (prepared) +Hypothesis: fixed lag-difference statistics provide information about local noise and seasonal repeatability that the decoder may otherwise infer inefficiently from raw patches. Add a zero-initialized linear projection of six log-scaled normalized statistics: MAE and RMS difference at lag1 over512 points, and at each of the two frequency-derived periods over at most8 cycles. Fewer than8 valid pairs use neutral defaults1 and sqrt(2). The3072 new parameters affect decoder queries; freeze the complete E25 recency24000 backbone. Train with the original weighted quantile/median loss after averaging both sign orientations, matching inference. Own packed_sample and unchanged local generator, seed89, planned6000 steps atLR2e-4. Choose batch64 or32 after measuring maximum-shape memory, keeping the six existing trainers and serialized evaluations within the one H100. No new training data. + +E47 memory check at batch64 (paired batch128), context4096 and horizon1024 used1134.4 MiB peak allocated and1160.0 MiB peak reserved Torch memory. Gradients were finite; no optimizer update or checkpoint was made from the random fixture. Start the planned6000-step run at batch64 with only3072 trainable parameters. + +## E46 complete slope comparison +No training; checkpoint SHA-256 `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`; fixed inference seed0. + +screen: 9.50 CPU diagnostic seconds. +- past8: skill0.374500; term short=0.3517, medium=0.4069, long=0.3994; domain Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- none: skill0.370718; term short=0.3457, medium=0.4054, long=0.3986; domain Econ/Fin=0.1111, Energy=0.2246, Healthcare=0.4321, Nature=0.4266, Sales=0.3438, Transport=0.4648, Web/CloudOps=0.4996; freq A-DEC=0.3202, Q-DEC=0.1821, M=0.1025, W-SUN=0.0486, D=0.3438, H=0.3946, 15T=0.2087, W-FRI=0.0306, 10T=0.5876, W-TUE=0.5831, W-THU=0.1779, W-WED=0.3133, 5T=0.5117, 10S=0.4176. +- future1: skill0.374205; term short=0.3511, medium=0.4072, long=0.3991; domain Econ/Fin=0.1137, Energy=0.2347, Healthcare=0.4268, Nature=0.4274, Sales=0.3439, Transport=0.4665, Web/CloudOps=0.5017; freq A-DEC=0.3598, Q-DEC=0.1662, M=0.1001, W-SUN=0.0181, D=0.3420, H=0.3984, 15T=0.2072, W-FRI=0.0122, 10T=0.6164, W-TUE=0.5675, W-THU=0.1755, W-WED=0.3133, 5T=0.5109, 10S=0.4256. +- future8: skill0.373161; term short=0.3495, medium=0.4067, long=0.3990; domain Econ/Fin=0.1251, Energy=0.2298, Healthcare=0.4305, Nature=0.4272, Sales=0.3439, Transport=0.4643, Web/CloudOps=0.5016; freq A-DEC=0.3602, Q-DEC=0.1852, M=0.1008, W-SUN=0.0383, D=0.3439, H=0.3960, 15T=0.2096, W-FRI=-0.0017, 10T=0.6059, W-TUE=0.5789, W-THU=0.1738, W-WED=0.3133, 5T=0.5112, 10S=0.4252. + +backcast: 9.40 CPU diagnostic seconds. +- past8: skill0.332400; term short=0.2953, medium=0.3574, long=0.3980; domain Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- none: skill0.329297; term short=0.2895, medium=0.3574, long=0.3980; domain Econ/Fin=0.1286, Energy=0.2253, Healthcare=0.3653, Nature=0.3586, Sales=0.3986, Transport=0.3702, Web/CloudOps=0.4470; freq A-DEC=0.2562, Q-DEC=0.2285, M=0.1591, W-SUN=-0.0090, D=0.3530, H=0.3630, 15T=0.2276, W-FRI=0.2653, 10T=0.3102, W-TUE=0.4340, W-THU=0.1790, W-WED=0.3474, 5T=0.4328, 10S=0.3392. +- future1: skill0.331443; term short=0.2936, medium=0.3572, long=0.3981; domain Econ/Fin=0.1560, Energy=0.2259, Healthcare=0.3803, Nature=0.3573, Sales=0.3986, Transport=0.3708, Web/CloudOps=0.4467; freq A-DEC=0.2946, Q-DEC=0.2075, M=0.1779, W-SUN=-0.0420, D=0.3531, H=0.3699, 15T=0.2218, W-FRI=0.2626, 10T=0.3062, W-TUE=0.4321, W-THU=0.1844, W-WED=0.3474, 5T=0.4320, 10S=0.3387. +- future8: skill0.330724; term short=0.2923, medium=0.3572, long=0.3980; domain Econ/Fin=0.1495, Energy=0.2260, Healthcare=0.3767, Nature=0.3568, Sales=0.3986, Transport=0.3706, Web/CloudOps=0.4462; freq A-DEC=0.2971, Q-DEC=0.2312, M=0.1706, W-SUN=-0.0239, D=0.3528, H=0.3662, 15T=0.2272, W-FRI=0.2646, 10T=0.3066, W-TUE=0.4419, W-THU=0.1812, W-WED=0.3474, 5T=0.4320, 10S=0.3363. + +backcast2: 9.16 CPU diagnostic seconds. +- past8: skill0.356697; term short=0.3411, medium=0.3874, long=0.3657; domain Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- none: skill0.356132; term short=0.3406, medium=0.3873, long=0.3643; domain Econ/Fin=0.0852, Energy=0.2311, Healthcare=0.3675, Nature=0.4661, Sales=0.5516, Transport=0.4189, Web/CloudOps=0.4316; freq A-DEC=0.3237, Q-DEC=0.1547, M=0.1618, W-SUN=0.0515, D=0.4258, H=0.3870, 15T=0.1053, W-FRI=0.1317, 10T=0.4935, W-TUE=0.1348, W-THU=0.2945, W-WED=0.5352, 5T=0.4648, 10S=0.2854. +- future1: skill0.355261; term short=0.3386, medium=0.3872, long=0.3657; domain Econ/Fin=0.1174, Energy=0.2356, Healthcare=0.3303, Nature=0.4652, Sales=0.5516, Transport=0.4184, Web/CloudOps=0.4253; freq A-DEC=0.3497, Q-DEC=0.1386, M=0.1530, W-SUN=0.0379, D=0.4238, H=0.3954, 15T=0.1038, W-FRI=0.1264, 10T=0.4929, W-TUE=-0.1191, W-THU=0.2956, W-WED=0.5352, 5T=0.4644, 10S=0.2668. +- future8: skill0.355137; term short=0.3386, medium=0.3873, long=0.3650; domain Econ/Fin=0.1032, Energy=0.2310, Healthcare=0.3342, Nature=0.4659, Sales=0.5516, Transport=0.4189, Web/CloudOps=0.4316; freq A-DEC=0.3492, Q-DEC=0.1479, M=0.1571, W-SUN=0.0462, D=0.4251, H=0.3890, 15T=0.1053, W-FRI=0.1264, 10T=0.4931, W-TUE=-0.1021, W-THU=0.2982, W-WED=0.5352, 5T=0.4643, 10S=0.2886. + +E46 outcome: retain the existing past-eight-difference slope. It beats zero slope and both forecast-derived slopes on every cutoff. The local turning-point explanation does not justify changing the global correction. + +## E48: phase diffusion in synthetic seasonal series (queued) +Hypothesis: varying seasonal phase teaches the model when distant cycles should lose confidence, complementing E31's amplitude variation. Keep E31 unchanged except that half of synthetic calls add a Brownian phase to each Fourier period, shared across its harmonics. Draw one-cycle fundamental correlation log-uniformly from 0.90 to 0.999, with increment standard deviation sqrt(-2 log(correlation) / period). Phase RNG seed is 200062, independent of sampler seed 59 and amplitude seed 100062. Real corpus windows, frequency choices, all original generator draws, and amplitude draws remain matched to E31. A data-only check of 256 rows at each synthetic fraction 0, 0.2 and 1 verified equal original and amplitude RNG states; all corpus-only arrays were bitwise equal, and every finite output stayed finite (8.30 CPU seconds). No validation labels are used in this generator or training. + +Initialize from our E17 patch16 EMA6000; same E25 architecture, batch 256, LR 8e-5, 24000-step cosine schedule, seed 59, save every 3000. Compare to cached E31 at matched checkpoints and three cutoffs before publication. Queue after E38 control completes 12000, retaining at most six heavy trainers on the one H100. Directory phase_synth contains code and sampler_check.json; generator must be declared separately in sources_used if selected. + +## E49: uncertainty shape in the fixed seasonal correction +Hypothesis: rare seasonal jumps inflate Gaussian RMS intervals in otherwise regular series. Keep the selected seasonal median, confidence gate, continuity correction and zero projection fixed; compare Gaussian RMS intervals with centered empirical seasonal-difference quantiles and Gaussian MAD intervals. All widths use the same sqrt((1+1/cycles)/2) averaging correction. Empirical residual median is subtracted so the median forecast is unchanged. These are fixed context formulas, with no optimization. Reuse E25-18000 raw caches for an inexpensive paired test across three cutoffs; transfer any consistent improvement to the current E25-24000 fixed128 runtime before publication. No training and no new sources. + +## E38 expanded-corpus 6000-step screen +- Checkpoint SHA-256: `6f0068b79fbc501fb1ec9a76c88d91ceb9ffca46096900c18f5157a19784678f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.27088236808777 seconds. +- Overall skill 0.358532; relative MASE 0.764393; relative WQL 0.538311. +- term skill: long=0.3918, medium=0.4028, short=0.3272. +- domain skill: Econ/Fin=0.1142, Energy=0.1855, Healthcare=0.3972, Nature=0.4197, Sales=0.3475, Transport=0.4581, Web/CloudOps=0.5080. +- frequency skill: A=0.3713, D=0.3310, H=0.3829, M=0.1077, Q=0.2043, S=0.4384, T=0.4038, W=0.2044. +- variates skill: multivariate=0.3933, univariate=0.3295. +- Outcome: Skill 0.358532 versus matched control 0.358628: near tie, with no demonstrated benefit from the larger packed corpus. Continue to 12000. + +## E39 bounded quantiles 3000-step screen +- Checkpoint SHA-256: `3932f19e396a2ec597a047116ad2e4b680a0e7c9638472434388843bd358b4c7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.178418159484863 seconds. +- Overall skill 0.358466; relative MASE 0.764176; relative WQL 0.538575. +- term skill: long=0.3917, medium=0.4021, short=0.3274. +- domain skill: Econ/Fin=0.1098, Energy=0.1842, Healthcare=0.4143, Nature=0.4191, Sales=0.3505, Transport=0.4583, Web/CloudOps=0.5059. +- frequency skill: A=0.3753, D=0.3428, H=0.3828, M=0.0891, Q=0.1957, S=0.4411, T=0.4011, W=0.1992. +- variates skill: multivariate=0.3924, univariate=0.3301. +- Outcome: Skill 0.358466 versus control 0.358802: a small regression. Continue to 6000 before selection. + +## E35 trend-query features 12000-step screen +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.890631914138794 seconds. +- Overall skill 0.357547; relative MASE 0.765787; relative WQL 0.538983. +- term skill: long=0.3905, medium=0.4007, short=0.3268. +- domain skill: Econ/Fin=0.1107, Energy=0.1852, Healthcare=0.4068, Nature=0.4159, Sales=0.3502, Transport=0.4572, Web/CloudOps=0.5058. +- frequency skill: A=0.3786, D=0.3384, H=0.3803, M=0.0973, Q=0.2012, S=0.4413, T=0.4010, W=0.2023. +- variates skill: multivariate=0.3916, univariate=0.3291. +- Outcome: Skill 0.357547 versus recency control 0.357241: another small gain. Matched earlier-cutoff checks are running. + +## E31 amplitude variation 18000-step screen +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.11006808280945 seconds. +- Overall skill 0.361640; relative MASE 0.761418; relative WQL 0.535190. +- term skill: long=0.3939, medium=0.4045, short=0.3314. +- domain skill: Econ/Fin=0.1093, Energy=0.1877, Healthcare=0.4199, Nature=0.4206, Sales=0.3451, Transport=0.4594, Web/CloudOps=0.5124. +- frequency skill: A=0.3693, D=0.3400, H=0.3834, M=0.0980, Q=0.2014, S=0.4419, T=0.4075, W=0.2126. +- variates skill: multivariate=0.3966, univariate=0.3324. +- Outcome: Skill 0.361640 versus recency control 0.361265: a small gain persists. Transfer to the current fixed inference rules on three cutoffs before selection. + +## E42 paired comparison: large_corpus_control 6000, screen +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.290119647979736 seconds. +- Overall skill 0.358628; relative MASE 0.763471; relative WQL 0.538799. +- term skill: long=0.3894, medium=0.4025, short=0.3286. +- domain skill: Econ/Fin=0.1093, Energy=0.1839, Healthcare=0.4157, Nature=0.4245, Sales=0.3451, Transport=0.4579, Web/CloudOps=0.5041. +- frequency skill: A=0.3762, D=0.3427, H=0.3805, M=0.1014, Q=0.1966, S=0.4404, T=0.4018, W=0.2035. +- variates skill: multivariate=0.3910, univariate=0.3316. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, screen +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.865007400512695 seconds. +- Overall skill 0.359222; relative MASE 0.762879; relative WQL 0.538220. +- term skill: long=0.3896, medium=0.4026, short=0.3295. +- domain skill: Econ/Fin=0.1138, Energy=0.1865, Healthcare=0.4140, Nature=0.4258, Sales=0.3420, Transport=0.4581, Web/CloudOps=0.5030. +- frequency skill: A=0.3767, D=0.3422, H=0.3805, M=0.1063, Q=0.1975, S=0.4407, T=0.4017, W=0.2108. +- variates skill: multivariate=0.3906, univariate=0.3331. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: large_corpus_control 6000, backcast +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.584256172180176 seconds. +- Overall skill 0.329632; relative MASE 0.806661; relative WQL 0.557102. +- term skill: long=0.3889, medium=0.3561, short=0.2948. +- domain skill: Econ/Fin=0.1442, Energy=0.2289, Healthcare=0.4117, Nature=0.3487, Sales=0.3954, Transport=0.3632, Web/CloudOps=0.4421. +- frequency skill: A=0.3117, D=0.3564, H=0.3572, M=0.1570, Q=0.2265, S=0.3417, T=0.3299, W=0.2668. +- variates skill: multivariate=0.3466, univariate=0.3158. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, backcast +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.306365728378296 seconds. +- Overall skill 0.330300; relative MASE 0.806062; relative WQL 0.556406. +- term skill: long=0.3903, medium=0.3564, short=0.2953. +- domain skill: Econ/Fin=0.1490, Energy=0.2297, Healthcare=0.4089, Nature=0.3480, Sales=0.3970, Transport=0.3635, Web/CloudOps=0.4436. +- frequency skill: A=0.3192, D=0.3533, H=0.3582, M=0.1614, Q=0.2265, S=0.3433, T=0.3300, W=0.2726. +- variates skill: multivariate=0.3477, univariate=0.3161. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: large_corpus_control 6000, backcast2 +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.882598161697388 seconds. +- Overall skill 0.352570; relative MASE 0.776245; relative WQL 0.539992. +- term skill: long=0.3679, medium=0.3749, short=0.3381. +- domain skill: Econ/Fin=0.0867, Energy=0.2280, Healthcare=0.3674, Nature=0.4604, Sales=0.5586, Transport=0.4130, Web/CloudOps=0.4272. +- frequency skill: A=0.3401, D=0.4293, H=0.3864, M=0.1768, Q=0.1515, S=0.2810, T=0.3448, W=0.2406. +- variates skill: multivariate=0.3588, univariate=0.3475. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, backcast2 +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.302276849746704 seconds. +- Overall skill 0.352901; relative MASE 0.775671; relative WQL 0.539838. +- term skill: long=0.3689, medium=0.3760, short=0.3379. +- domain skill: Econ/Fin=0.0894, Energy=0.2294, Healthcare=0.3710, Nature=0.4595, Sales=0.5574, Transport=0.4132, Web/CloudOps=0.4264. +- frequency skill: A=0.3430, D=0.4260, H=0.3868, M=0.1778, Q=0.1500, S=0.2820, T=0.3450, W=0.2490. +- variates skill: multivariate=0.3587, univariate=0.3482. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E49 complete seasonal interval comparison +No training; inference seed 0. Own E25-18000 checkpoint SHA-256 f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd. + +screen: 12.53 CPU diagnostic seconds. +- gaussian: skill 0.374500; term: short=0.3517, medium=0.4069, long=0.3994; domain: Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- empirical: skill 0.374034; term: short=0.3515, medium=0.4062, long=0.3984; domain: Econ/Fin=0.1322, Energy=0.2332, Healthcare=0.4326, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5005; freq: A-DEC=0.3692, Q-DEC=0.2007, M=0.1029, W-SUN=0.0515, D=0.3443, H=0.3941, 15T=0.2120, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4208. +- mad: skill 0.373768; term: short=0.3513, medium=0.4061, long=0.3979; domain: Econ/Fin=0.1328, Energy=0.2325, Healthcare=0.4325, Nature=0.4254, Sales=0.3438, Transport=0.4649, Web/CloudOps=0.5001; freq: A-DEC=0.3692, Q-DEC=0.2007, M=0.1027, W-SUN=0.0515, D=0.3444, H=0.3938, 15T=0.2115, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4194. + +backcast: 12.04 CPU diagnostic seconds. +- gaussian: skill 0.332400; term: short=0.2953, medium=0.3574, long=0.3980; domain: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- empirical: skill 0.332227; term: short=0.2954, medium=0.3563, long=0.3981; domain: Econ/Fin=0.1521, Energy=0.2257, Healthcare=0.3995, Nature=0.3558, Sales=0.3986, Transport=0.3697, Web/CloudOps=0.4482; freq: A-DEC=0.2996, Q-DEC=0.2331, M=0.1717, W-SUN=-0.0053, D=0.3516, H=0.3630, 15T=0.2257, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4330, 10S=0.3436. +- mad: skill 0.331760; term: short=0.2949, medium=0.3559, long=0.3977; domain: Econ/Fin=0.1517, Energy=0.2248, Healthcare=0.3984, Nature=0.3554, Sales=0.3986, Transport=0.3696, Web/CloudOps=0.4480; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1720, W-SUN=-0.0052, D=0.3511, H=0.3620, 15T=0.2253, W-FRI=0.2597, 10T=0.3129, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4330, 10S=0.3430. + +backcast2: 10.81 CPU diagnostic seconds. +- gaussian: skill 0.356697; term: short=0.3411, medium=0.3874, long=0.3657; domain: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq: A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- empirical: skill 0.356537; term: short=0.3408, medium=0.3876, long=0.3655; domain: Econ/Fin=0.1035, Energy=0.2316, Healthcare=0.3619, Nature=0.4656, Sales=0.5516, Transport=0.4178, Web/CloudOps=0.4315; freq: A-DEC=0.3474, Q-DEC=0.1549, M=0.1602, W-SUN=0.0311, D=0.4277, H=0.3876, 15T=0.1075, W-FRI=0.1243, 10T=0.4929, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2846. +- mad: skill 0.356717; term: short=0.3409, medium=0.3871, long=0.3665; domain: Econ/Fin=0.1039, Energy=0.2307, Healthcare=0.3619, Nature=0.4656, Sales=0.5516, Transport=0.4176, Web/CloudOps=0.4335; freq: A-DEC=0.3474, Q-DEC=0.1549, M=0.1602, W-SUN=0.0312, D=0.4278, H=0.3869, 15T=0.1072, W-FRI=0.1243, 10T=0.4929, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2923. + +Outcome: retain Gaussian RMS intervals. Centered empirical intervals lose at all three cutoffs. MAD loses on the main and first earlier cutoff, with only a negligible second-earlier gain. Median MASE is exactly unchanged for every setting as intended. No transfer or package change. + +## E35 matched 12000 comparison: recency_features, screen +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.589985609054565 seconds. +- Overall skill 0.357241; relative MASE 0.765658; relative WQL 0.539588. +- term skill: long=0.3912, medium=0.4026, short=0.3252. +- domain skill: Econ/Fin=0.1133, Energy=0.1855, Healthcare=0.3939, Nature=0.4171, Sales=0.3483, Transport=0.4566, Web/CloudOps=0.5065. +- frequency skill: A=0.3781, D=0.3343, H=0.3817, M=0.0906, Q=0.1961, S=0.4411, T=0.4020, W=0.1998. +- variates skill: multivariate=0.3920, univariate=0.3281. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, screen +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.890631914138794 seconds. +- Overall skill 0.357547; relative MASE 0.765787; relative WQL 0.538983. +- term skill: long=0.3905, medium=0.4007, short=0.3268. +- domain skill: Econ/Fin=0.1107, Energy=0.1852, Healthcare=0.4068, Nature=0.4159, Sales=0.3502, Transport=0.4572, Web/CloudOps=0.5058. +- frequency skill: A=0.3786, D=0.3384, H=0.3803, M=0.0973, Q=0.2012, S=0.4413, T=0.4010, W=0.2023. +- variates skill: multivariate=0.3916, univariate=0.3291. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: recency_features, backcast +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.742298364639282 seconds. +- Overall skill 0.328112; relative MASE 0.807765; relative WQL 0.558868. +- term skill: long=0.3899, medium=0.3548, short=0.2920. +- domain skill: Econ/Fin=0.1488, Energy=0.2248, Healthcare=0.4036, Nature=0.3514, Sales=0.3955, Transport=0.3613, Web/CloudOps=0.4413. +- frequency skill: A=0.3134, D=0.3558, H=0.3562, M=0.1567, Q=0.2256, S=0.3420, T=0.3267, W=0.2651. +- variates skill: multivariate=0.3435, univariate=0.3156. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, backcast +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.06494641304016 seconds. +- Overall skill 0.327724; relative MASE 0.808759; relative WQL 0.558826. +- term skill: long=0.3886, medium=0.3555, short=0.2916. +- domain skill: Econ/Fin=0.1436, Energy=0.2247, Healthcare=0.3984, Nature=0.3522, Sales=0.3952, Transport=0.3621, Web/CloudOps=0.4411. +- frequency skill: A=0.3149, D=0.3546, H=0.3559, M=0.1602, Q=0.2281, S=0.3419, T=0.3284, W=0.2545. +- variates skill: multivariate=0.3441, univariate=0.3144. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: recency_features, backcast2 +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.009191036224365 seconds. +- Overall skill 0.353202; relative MASE 0.774939; relative WQL 0.539846. +- term skill: long=0.3671, medium=0.3766, short=0.3388. +- domain skill: Econ/Fin=0.0874, Energy=0.2254, Healthcare=0.3808, Nature=0.4621, Sales=0.5594, Transport=0.4116, Web/CloudOps=0.4293. +- frequency skill: A=0.3385, D=0.4312, H=0.3856, M=0.1786, Q=0.1474, S=0.2819, T=0.3451, W=0.2459. +- variates skill: multivariate=0.3594, univariate=0.3481. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, backcast2 +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.192188262939453 seconds. +- Overall skill 0.353075; relative MASE 0.775525; relative WQL 0.539650. +- term skill: long=0.3664, medium=0.3761, short=0.3391. +- domain skill: Econ/Fin=0.0837, Energy=0.2262, Healthcare=0.3801, Nature=0.4640, Sales=0.5598, Transport=0.4112, Web/CloudOps=0.4272. +- frequency skill: A=0.3402, D=0.4277, H=0.3854, M=0.1847, Q=0.1490, S=0.2774, T=0.3477, W=0.2433. +- variates skill: multivariate=0.3593, univariate=0.3480. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E50: paired-sign loss for a frozen-backbone output head +Hypothesis: training against the averaged positive/negative forecasts used at inference can improve calibration over separately scoring the two orientations. Both arms initialize from our selected E25-24000 checkpoint with fixed128 trend features and freeze every parameter except the existing 147744-parameter output head. Both forward the same context and its sign reflection, consuming identical seed97 data windows. Control scores each orientation independently; candidate averages the two normalized forecasts before the original weighted quantile/median loss. This isolates the loss rather than data augmentation or forward compute. Same packed_sample, original local generator and independent sign augmentation, batch64, LR5e-5, 6000-step cosine schedule, save1000. No new data, no validation training, no parameter additions. + +A maximum-shape random fixture (paired batch128, context4096, horizon1024) verified finite gradients and measured peak Torch allocation697 MiB for the individual-loss control and729 MiB for the paired-loss candidate, with822 MiB reserved in each. No optimizer update or checkpoint was made from the fixture. Start the control after the rejected E35 trainer exits; start the paired arm after E47 finishes, keeping to one H100. The same fixed runtime evaluates both. + +E50 head_control training started at 2026-10-22T04:52:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E50 head_paired training started at 2026-10-22T04:53:18Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E35 stopped cleanly at step 13309, with 4327.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `be7cce34037750ef56be8a183b68af46dc2deec184ad228cd4c60ab91b51eb48`. The last validation was the paired 12000-step comparison above; the stop checkpoint was saved for provenance, not selected. + +## E31 amplitude 18000 with selected fixed rules, screen +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.18380904197693 seconds. +- Overall skill 0.375271; relative MASE 0.747344; relative WQL 0.522231. +- term skill: long=0.4000, medium=0.4069, short=0.3529. +- domain skill: Econ/Fin=0.1337, Energy=0.2361, Healthcare=0.4224, Nature=0.4258, Sales=0.3419, Transport=0.4649, Web/CloudOps=0.5043. +- frequency skill: A=0.3721, D=0.3448, H=0.3951, M=0.0876, Q=0.2019, S=0.4223, T=0.4386, W=0.2158. +- variates skill: multivariate=0.3950, univariate=0.3591. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E31 amplitude 18000 with selected fixed rules, backcast +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.348726511001587 seconds. +- Overall skill 0.333200; relative MASE 0.800924; relative WQL 0.555137. +- term skill: long=0.3941, medium=0.3576, short=0.2985. +- domain skill: Econ/Fin=0.1568, Energy=0.2260, Healthcare=0.4100, Nature=0.3583, Sales=0.3987, Transport=0.3697, Web/CloudOps=0.4467. +- frequency skill: A=0.3095, D=0.3534, H=0.3637, M=0.1993, Q=0.2273, S=0.3378, T=0.3326, W=0.2601. +- variates skill: multivariate=0.3488, univariate=0.3205. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E31 amplitude 18000 with selected fixed rules, backcast2 +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.135295629501343 seconds. +- Overall skill 0.356896; relative MASE 0.774845; relative WQL 0.533762. +- term skill: long=0.3678, medium=0.3811, short=0.3433. +- domain skill: Econ/Fin=0.1063, Energy=0.2350, Healthcare=0.3543, Nature=0.4630, Sales=0.5538, Transport=0.4181, Web/CloudOps=0.4317. +- frequency skill: A=0.3487, D=0.4308, H=0.3887, M=0.1298, Q=0.1454, S=0.2825, T=0.3581, W=0.2487. +- variates skill: multivariate=0.3617, univariate=0.3530. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E51: last optimizer weights versus EMA weights +The late E25 EMA checkpoints continue to improve, and averaging older EMA checkpoints regressed in E45. Check whether the final optimizer iterate is ahead of its lagging EMA or instead suffers from update noise. No training or inference-rule change: evaluate step024000 against the selected ema024000 with the identical fixed128/aligned/zero0.4 runtime. Only transfer to earlier cutoffs and full validation if the main screen improves. Both candidates have the same seed59 training lineage. + +## E47 confidence projection 1000-step screen +- Checkpoint SHA-256: `b2df8695413e53c7d62ec8f265affc31a43ca26e7b99b50e0a75f47782b95bfe`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.31796908378601 seconds. +- Overall skill 0.375491; relative MASE 0.746025; relative WQL 0.522786. +- term skill: long=0.3994, medium=0.4067, short=0.3536. +- domain skill: Econ/Fin=0.1396, Energy=0.2349, Healthcare=0.4370, Nature=0.4288, Sales=0.3397, Transport=0.4653, Web/CloudOps=0.5002. +- frequency skill: A=0.3765, D=0.3531, H=0.3948, M=0.0934, Q=0.1985, S=0.4235, T=0.4361, W=0.2100. +- variates skill: multivariate=0.3936, univariate=0.3607. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +## E47 confidence projection 3000-step screen +- Checkpoint SHA-256: `653081261875b023a5d8dea02c999762fa8a2a4601ce7b6ad3b55559172290ab`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.364450693130493 seconds. +- Overall skill 0.375482; relative MASE 0.745987; relative WQL 0.522828. +- term skill: long=0.3995, medium=0.4066, short=0.3536. +- domain skill: Econ/Fin=0.1394, Energy=0.2348, Healthcare=0.4379, Nature=0.4283, Sales=0.3403, Transport=0.4653, Web/CloudOps=0.5004. +- frequency skill: A=0.3762, D=0.3534, H=0.3949, M=0.0912, Q=0.1983, S=0.4238, T=0.4362, W=0.2092. +- variates skill: multivariate=0.3937, univariate=0.3606. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +## E47 confidence projection 6000-step screen +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.593000650405884 seconds. +- Overall skill 0.375793; relative MASE 0.745649; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4406, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0954, Q=0.1982, S=0.4239, T=0.4362, W=0.2090. +- variates skill: multivariate=0.3937, univariate=0.3611. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +E47 completed 6000 steps in 818.8 elapsed training-loop seconds on the shared H100. Every original model tensor is bitwise equal to the frozen E25-24000 parent; only the 3072 confidence-projection parameters changed. + +E48 phase_synth training started at 2026-10-22T04:54:48Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E51 final optimizer iterate, screen +- Checkpoint SHA-256: `32b70d0e88532fb98746ea032c10be587383d80ed7b0951b41f778a39c9dc68b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.315549850463867 seconds. +- Overall skill 0.374536; relative MASE 0.746570; relative WQL 0.524003. +- term skill: long=0.3980, medium=0.4073, short=0.3522. +- domain skill: Econ/Fin=0.1389, Energy=0.2328, Healthcare=0.4348, Nature=0.4279, Sales=0.3409, Transport=0.4652, Web/CloudOps=0.4998. +- frequency skill: A=0.3701, D=0.3497, H=0.3936, M=0.0914, Q=0.1977, S=0.4222, T=0.4369, W=0.2087. +- variates skill: multivariate=0.3931, univariate=0.3594. +- Outcome: Skill 0.374536 is below the selected EMA24000 skill 0.375502. Retain EMA weights; no earlier-window or full evaluation is needed. + +## E39 bounded quantiles 6000-step screen +- Checkpoint SHA-256: `4af38aa561df4d38c1f6df090f8a5dc364c38786eb2ab38933646d827cbe7669`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.320833683013916 seconds. +- Overall skill 0.357854; relative MASE 0.764623; relative WQL 0.539287. +- term skill: long=0.3907, medium=0.4019, short=0.3268. +- domain skill: Econ/Fin=0.1103, Energy=0.1849, Healthcare=0.4072, Nature=0.4203, Sales=0.3470, Transport=0.4571, Web/CloudOps=0.5050. +- frequency skill: A=0.3756, D=0.3402, H=0.3810, M=0.0920, Q=0.1957, S=0.4423, T=0.4023, W=0.1961. +- variates skill: multivariate=0.3917, univariate=0.3295. +- Outcome: Skill 0.357854 is below matched control 0.358628, following a smaller 3000-step regression. Stop this branch; retain the current inference-only positivity projection. + +## E52: varied requested horizons during partial-target training +E42's correct per-row horizon conditioning improves all three cutoffs at 6000 steps. Hypothesis: exposing the decoder to intermediate requested horizons will also reduce mismatch between four fixed training horizon lengths and arbitrary inference lengths. Match E42's parent E25-12000, seed79, packed_sample, source probabilities, batch256, LR5e-5 and 12000-step schedule. Keep half the sampled target windows unchanged; for the other half, independently choose a prefix length uniformly from one-quarter to the full batch horizon, rounded upward to a 16-step patch boundary. Mask only later training labels. The existing E42 loss masks unused future tokens and sets each row's horizon metadata. Corpus contexts and periods, original generator and sampler random draws remain unchanged. Independent horizon RNG seed300082. + +A data-only check at all four horizon sizes verified identical context/period arrays and exact preservation of every retained target value (0.66 CPU seconds). No validation labels enter training. No new model parameters or inference behavior; this is a training-window augmentation. Start after rejected E39 exits and compare against cached E42 at 3000/6000/12000. + +E52 horizon_jitter training started at 2026-10-22T04:56:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E47 confidence projection 6000, backcast +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.725136041641235 seconds. +- Overall skill 0.334126; relative MASE 0.799732; relative WQL 0.554420. +- term skill: long=0.3968, medium=0.3571, short=0.2992. +- domain skill: Econ/Fin=0.1592, Energy=0.2275, Healthcare=0.4065, Nature=0.3605, Sales=0.3971, Transport=0.3716, Web/CloudOps=0.4467. +- frequency skill: A=0.3079, D=0.3510, H=0.3635, M=0.1810, Q=0.2346, S=0.3430, T=0.3344, W=0.2764. +- variates skill: multivariate=0.3510, univariate=0.3204. +- Outcome: Main screen gains 0.000291; first earlier cutoff loses only 0.000054; second earlier cutoff gains 0.000224. Proceed to full validation before deciding whether to replace the package. + +## E47 confidence projection 6000, backcast2 +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.6521155834198 seconds. +- Overall skill 0.358499; relative MASE 0.770987; relative WQL 0.533762. +- term skill: long=0.3652, medium=0.3856, short=0.3452. +- domain skill: Econ/Fin=0.1095, Energy=0.2361, Healthcare=0.3507, Nature=0.4706, Sales=0.5514, Transport=0.4202, Web/CloudOps=0.4300. +- frequency skill: A=0.3495, D=0.4316, H=0.3891, M=0.1571, Q=0.1507, S=0.2825, T=0.3576, W=0.2564. +- variates skill: multivariate=0.3624, univariate=0.3553. +- Outcome: Main screen gains 0.000291; first earlier cutoff loses only 0.000054; second earlier cutoff gains 0.000224. Proceed to full validation before deciding whether to replace the package. + +E39 stopped cleanly at step 6298, with 2199.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `d1018a12abdb14c369ba55a561c3091bbc7dc4b25337345a0af68aa15e9afec2`. This stop checkpoint was retained for provenance and was not selected. + +## E53: within-cycle variance for seasonal confidence +Hypothesis: total variance over up to eight cycles can be dominated by a long trend, artificially lowering the seasonal-difference/variance ratio and assigning high seasonal confidence even to a nonseasonal ramp. Change only the gate denominator to pooled within-cycle variance, subtracting each cycle's finite-observation mean before pooling squared deviations. Compare the existing global variance and this within-cycle variance, with the selected aligned template, Gaussian RMS intervals, continuity and zero0.4 unchanged. Use cached E25-18000 forecasts across three cutoffs; no training, optimization or new source data. A selected formula must transfer to the current checkpoint and fixed128 runtime before publication. + +## E47 confidence projection 6000, exact full package validation +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371766; relative MASE 0.748576; relative WQL 0.527239. +- term skill: long=0.3937, medium=0.4056, short=0.3496. +- domain skill: Econ/Fin=0.1167, Energy=0.2278, Healthcare=0.4464, Nature=0.4283, Sales=0.3521, Transport=0.4660, Web/CloudOps=0.4929. +- frequency skill: A=0.2915, D=0.3581, H=0.3903, M=0.1171, Q=0.1834, S=0.4239, T=0.4292, W=0.2017. +- variates skill: multivariate=0.3895, univariate=0.3573. +- Outcome: Selected for publication: skill 0.371766 versus 0.371479 for the previous package; relative MASE 0.748576 and WQL 0.527239. All 97 configurations and 151170 instances passed, with no quantile crossings. Actual package inference took 140.57 seconds on the one H100 while five heavy training runs and two head-only runs shared it. Relocation/determinism checks precede the atomic replacement. + +## E53 complete seasonal variance comparison +No training; inference seed 0. E25-18000 checkpoint SHA-256 f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd. + +screen: 8.50 CPU diagnostic seconds. +- global: skill 0.374500; term: short=0.3517, medium=0.4069, long=0.3994; domain: Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- within_cycle: skill 0.374386; term: short=0.3515, medium=0.4068, long=0.3994; domain: Econ/Fin=0.1320, Energy=0.2346, Healthcare=0.4305, Nature=0.4254, Sales=0.3450, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2024, M=0.1005, W-SUN=0.0487, D=0.3444, H=0.3951, 15T=0.2124, W-FRI=-0.0050, 10T=0.6139, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. + +backcast: 8.12 CPU diagnostic seconds. +- global: skill 0.332400; term: short=0.2953, medium=0.3574, long=0.3980; domain: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- within_cycle: skill 0.332143; term: short=0.2948, medium=0.3575, long=0.3979; domain: Econ/Fin=0.1529, Energy=0.2266, Healthcare=0.3952, Nature=0.3561, Sales=0.3986, Transport=0.3704, Web/CloudOps=0.4471; freq: A-DEC=0.2996, Q-DEC=0.2353, M=0.1665, W-SUN=-0.0082, D=0.3519, H=0.3640, 15T=0.2255, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3396. + +backcast2: 7.99 CPU diagnostic seconds. +- global: skill 0.356697; term: short=0.3411, medium=0.3874, long=0.3657; domain: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq: A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- within_cycle: skill 0.356794; term: short=0.3414, medium=0.3873, long=0.3654; domain: Econ/Fin=0.1040, Energy=0.2329, Healthcare=0.3653, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4301; freq: A-DEC=0.3474, Q-DEC=0.1544, M=0.1677, W-SUN=0.0298, D=0.4273, H=0.3891, 15T=0.1064, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4647, 10S=0.2791. + +Outcome: retain total history variance. Within-cycle variance loses on the main and first earlier cutoff, with only a small second-earlier gain. The trend-related failure mode does not justify changing the global formula. + +E47 relocation and determinism passed: the candidate and a separately copied package in a fresh /tmp directory produced bitwise identical, finite, monotone quantiles for univariate daily, univariate hourly and multivariate medium-horizon examples. Both ran with /tmp as the working directory. Publish the complete candidate atomically after these checks. + +## E54: train the full model with longer raw context +E21's untrained extension and E29's frozen, coarsened history memory did not provide consistent gains. Hypothesis: adapting all existing parameters to raw 8192-point histories can use older cycles without the mismatch of an untrained extension or lossy extra memory. Two matched arms initialize from our E25-24000 EMA, with identical model size, original loss, seed101, packed_sample, source probabilities, batch128, LR3e-5 and 12000-step schedule. The sampler draws context sizes512/1024/2048/8192 with probabilities0.1/0.15/0.35/0.4 in both arms. The control then keeps only the last4096 points; the candidate keeps8192. Future labels and sampler RNG are matched exactly, including synthetic draws and aggregation. Both train every model parameter. This comparison changes only the retained raw history. + +At inference, positivity and the fixed seasonal rule continue to inspect only the recent4096 observations; continuity and zero projection retain their existing lookbacks. The candidate's neural encoder and normalization use up to8192. No external weights or new source data are introduced; the parameter count is unchanged. New generator/sign-augmentation seed101 must be declared if selected. Maximum-shape batch128/context8192/horizon1024 memory check, including allocated placeholders for Adam moments and EMA, measured9960 MiB peak allocated and10530 MiB reserved, with finite gradients in4.37 seconds. No optimizer update or checkpoint came from this random fixture. Queue the control after E50 head_control completes; queue the longer-context arm after E38 expanded corpus completes, preserving the one-H100 allocation. + +E54 data check passed in3.26 CPU seconds: all four sampled context sizes produced identical future labels, period metadata, overlapping recent history and sampler RNG states between the two arms. + +E54 long_context_control training started at 2026-10-22T05:04:35Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E55: transfer the matched partial-target training difference +E42's 6000-step checkpoint improves all three cutoffs over its exact seed/data/initialization-matched E38 control, but both restarted trajectories began from an older E25 checkpoint. Hypothesis: the parameter difference between these matched runs isolates a useful training correction that can transfer to the selected later model. Form one fixed model with weights = current E47 confidence6000 + E42 partial6000 - E38 control6000 for their common backbone tensors, leaving the confidence projection unchanged. Use coefficient1 with no grid search. This is a deterministic composition of our own trained weights, with all three parent hashes recorded. No new training or data, and one model forecasts every instance. Evaluate the main screen first; if promising, require earlier-cutoff and exact full-package checks. + +## E50 head_control 1000-step screen +- Checkpoint SHA-256: `a88f59494b256bf95addea9f00fa7b631cd67dc762228f523d95eec8047a05d8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.136118412017822 seconds. +- Overall skill 0.375630; relative MASE 0.745780; relative WQL 0.522726. +- term skill: long=0.3996, medium=0.4068, short=0.3537. +- domain skill: Econ/Fin=0.1403, Energy=0.2347, Healthcare=0.4405, Nature=0.4291, Sales=0.3396, Transport=0.4656, Web/CloudOps=0.4997. +- frequency skill: A=0.3779, D=0.3539, H=0.3951, M=0.0943, Q=0.1980, S=0.4231, T=0.4359, W=0.2102. +- variates skill: multivariate=0.3935, univariate=0.3610. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_control 3000-step screen +- Checkpoint SHA-256: `75b9f4860e4c4345f2cedb6eb2f9ffe5c9e65aede03a314c72b20b1e8a1f7aaf`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.069400310516357 seconds. +- Overall skill 0.375411; relative MASE 0.746024; relative WQL 0.522921. +- term skill: long=0.3996, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1387, Energy=0.2345, Healthcare=0.4401, Nature=0.4293, Sales=0.3399, Transport=0.4650, Web/CloudOps=0.4996. +- frequency skill: A=0.3759, D=0.3533, H=0.3949, M=0.0963, Q=0.1980, S=0.4231, T=0.4355, W=0.2102. +- variates skill: multivariate=0.3933, univariate=0.3608. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_control 6000-step screen +- Checkpoint SHA-256: `dd8fc459f097a0bc0c7cb133473130aa32e1dc520fd7f03ff50dc26366d1122e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.82920217514038 seconds. +- Overall skill 0.375304; relative MASE 0.746102; relative WQL 0.523045. +- term skill: long=0.3996, medium=0.4065, short=0.3532. +- domain skill: Econ/Fin=0.1404, Energy=0.2343, Healthcare=0.4375, Nature=0.4291, Sales=0.3402, Transport=0.4652, Web/CloudOps=0.4997. +- frequency skill: A=0.3770, D=0.3531, H=0.3950, M=0.0965, Q=0.1987, S=0.4230, T=0.4355, W=0.2086. +- variates skill: multivariate=0.3931, univariate=0.3607. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +E50 head_control completed6000 steps in 685.6 elapsed training-loop seconds. Every non-head tensor remains bitwise equal to the E25-24000 parent. + +## E50 head_paired 1000-step screen +- Checkpoint SHA-256: `337e19aac481543a8ba78bd837f00c8a714315313e665b1b5a038d009a905a2a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.40800166130066 seconds. +- Overall skill 0.375721; relative MASE 0.745631; relative WQL 0.522677. +- term skill: long=0.3997, medium=0.4067, short=0.3539. +- domain skill: Econ/Fin=0.1403, Energy=0.2344, Healthcare=0.4425, Nature=0.4292, Sales=0.3396, Transport=0.4658, Web/CloudOps=0.4998. +- frequency skill: A=0.3786, D=0.3544, H=0.3951, M=0.0952, Q=0.1978, S=0.4234, T=0.4358, W=0.2099. +- variates skill: multivariate=0.3935, univariate=0.3612. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_paired 3000-step screen +- Checkpoint SHA-256: `1043bbd666890cb730f2931875860ed661f54bae5236a7c93bbbe03764487222`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.516828536987305 seconds. +- Overall skill 0.375342; relative MASE 0.746117; relative WQL 0.522970. +- term skill: long=0.3997, medium=0.4065, short=0.3533. +- domain skill: Econ/Fin=0.1387, Energy=0.2340, Healthcare=0.4415, Nature=0.4295, Sales=0.3399, Transport=0.4651, Web/CloudOps=0.4994. +- frequency skill: A=0.3750, D=0.3534, H=0.3947, M=0.0981, Q=0.1978, S=0.4235, T=0.4353, W=0.2097. +- variates skill: multivariate=0.3930, univariate=0.3609. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_paired 6000-step screen +- Checkpoint SHA-256: `8aacc5fadfa1a9d214aeba0cd1f39bde9aaf038b9ee2a487dafa57b9e904479e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.942206621170044 seconds. +- Overall skill 0.375234; relative MASE 0.746235; relative WQL 0.523068. +- term skill: long=0.3997, medium=0.4064, short=0.3531. +- domain skill: Econ/Fin=0.1405, Energy=0.2337, Healthcare=0.4385, Nature=0.4294, Sales=0.3403, Transport=0.4654, Web/CloudOps=0.4995. +- frequency skill: A=0.3760, D=0.3533, H=0.3947, M=0.0981, Q=0.1988, S=0.4234, T=0.4354, W=0.2077. +- variates skill: multivariate=0.3928, univariate=0.3609. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +E50 head_paired completed6000 steps in 687.3 elapsed training-loop seconds. Every non-head tensor remains bitwise equal to the E25-24000 parent. + +## E38 original corpus control12000, matched screening +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.037413597106934 seconds. +- Overall skill 0.360533; relative MASE 0.761352; relative WQL 0.537094. +- term skill: long=0.3910, medium=0.4047, short=0.3305. +- domain skill: Econ/Fin=0.1118, Energy=0.1871, Healthcare=0.4084, Nature=0.4251, Sales=0.3445, Transport=0.4588, Web/CloudOps=0.5084. +- frequency skill: A=0.3744, D=0.3432, H=0.3820, M=0.0997, Q=0.1999, S=0.4419, T=0.4062, W=0.2010. +- variates skill: multivariate=0.3952, univariate=0.3315. +- Outcome: The restarted control improves over its12000-step parent but remains below uninterrupted E25-24000. Retain as the paired reference for corpus expansion and partial-target training. + +## E38 original corpus control12000, selected fixed inference rules +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.83461022377014 seconds. +- Overall skill 0.373819; relative MASE 0.747477; relative WQL 0.524569. +- term skill: long=0.3971, medium=0.4072, short=0.3512. +- domain skill: Econ/Fin=0.1366, Energy=0.2343, Healthcare=0.4105, Nature=0.4297, Sales=0.3412, Transport=0.4642, Web/CloudOps=0.5006. +- frequency skill: A=0.3777, D=0.3471, H=0.3939, M=0.0915, Q=0.2002, S=0.4231, T=0.4362, W=0.2036. +- variates skill: multivariate=0.3936, univariate=0.3576. +- Outcome: The restarted control improves over its12000-step parent but remains below uninterrupted E25-24000. Retain as the paired reference for corpus expansion and partial-target training. + +E38 original-corpus control completed12000 steps in 3967.3 elapsed training-loop seconds. E48 phase_synth replaced it on the same H100 after completion. + +## E55 matched partial-target weight difference, screen +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.02963423728943 seconds. +- Overall skill 0.375848; relative MASE 0.745876; relative WQL 0.522292. +- term skill: long=0.3998, medium=0.4069, short=0.3540. +- domain skill: Econ/Fin=0.1449, Energy=0.2367, Healthcare=0.4308, Nature=0.4298, Sales=0.3356, Transport=0.4655, Web/CloudOps=0.5000. +- frequency skill: A=0.3786, D=0.3503, H=0.3960, M=0.1012, Q=0.2008, S=0.4236, T=0.4351, W=0.2163. +- variates skill: multivariate=0.3939, univariate=0.3611. +- Outcome: Skill 0.375848 is only 0.000056 above the selected E47 model. Check both earlier cutoffs before a full-package evaluation; no replacement yet. + +## E56: bounded influence of difficult training windows +Hypothesis: a linear average of normalized window losses gives unusually difficult or abruptly changing futures too much influence, while the benchmark aggregates relative configuration errors geometrically. Keep the original per-window weighted quantile/median loss and context-only seasonal weights, but replace each window loss L by 0.25*log1p(L/0.25) before averaging. The derivative is bounded by1 and declines for difficult windows; this is a robust surrogate, not a claim to exactly optimize benchmark skill. The scale0.25 is fixed in advance, with no sweep. + +Match E38 original-corpus control exactly: parent E25-12000, seed79, packed_sample, source weights, batch256, LR5e-5, 12000-step schedule and save3000. No new source data, architecture or inference rule. Queue after E42 completes12000, then compare against cached control checkpoints and earlier cutoffs. The loss scale is saved in training arguments. + +## E55 transferred partial-target update, backcast +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.927225589752197 seconds. +- Overall skill 0.335000; relative MASE 0.798832; relative WQL 0.553589. +- term skill: long=0.3978, medium=0.3567, short=0.3005. +- domain skill: Econ/Fin=0.1675, Energy=0.2279, Healthcare=0.4021, Nature=0.3600, Sales=0.3983, Transport=0.3718, Web/CloudOps=0.4491. +- frequency skill: A=0.3286, D=0.3484, H=0.3640, M=0.1855, Q=0.2333, S=0.3447, T=0.3347, W=0.2831. +- variates skill: multivariate=0.3522, univariate=0.3210. +- Outcome: Mixed transfer: main +0.000056, first earlier +0.000874, second earlier -0.000595 versus E47. Keep the published package. Revisit the same coefficient with the final12000-step matched checkpoints; no full-package test of this6000-step composition. + +## E55 transferred partial-target update, backcast2 +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.91679048538208 seconds. +- Overall skill 0.357904; relative MASE 0.771656; relative WQL 0.534289. +- term skill: long=0.3649, medium=0.3860, short=0.3441. +- domain skill: Econ/Fin=0.1130, Energy=0.2354, Healthcare=0.3520, Nature=0.4680, Sales=0.5482, Transport=0.4200, Web/CloudOps=0.4303. +- frequency skill: A=0.3535, D=0.4265, H=0.3897, M=0.1535, Q=0.1485, S=0.2805, T=0.3574, W=0.2617. +- variates skill: multivariate=0.3618, univariate=0.3547. +- Outcome: Mixed transfer: main +0.000056, first earlier +0.000874, second earlier -0.000595 versus E47. Keep the published package. Revisit the same coefficient with the final12000-step matched checkpoints; no full-package test of this6000-step composition. + +E54 long_context_8192 training started at 2026-10-22T05:11:31Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E38 expanded corpus final12000, matched screen +- Checkpoint SHA-256: `8aa07643add22cc1f8e45c069d19ff54bda8c0853c8e7076eb5923467942327b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.707714796066284 seconds. +- Overall skill 0.359331; relative MASE 0.763140; relative WQL 0.537852. +- term skill: long=0.3931, medium=0.4039, short=0.3277. +- domain skill: Econ/Fin=0.1164, Energy=0.1854, Healthcare=0.3936, Nature=0.4242, Sales=0.3431, Transport=0.4578, Web/CloudOps=0.5093. +- frequency skill: A=0.3748, D=0.3312, H=0.3834, M=0.1029, Q=0.2013, S=0.4405, T=0.4056, W=0.2056. +- variates skill: multivariate=0.3951, univariate=0.3293. +- Outcome: Skill 0.359331 versus matched original-corpus control0.360533. The early near tie becomes a final regression. Do not select the expanded corpus for the current model; retain all packed data and receipts for future experiments. + +E38 expanded-corpus arm completed12000 steps in 4098.4 elapsed training-loop seconds. E54 long_context_8192 started after its process exited on the same H100. + +## E48 synthetic phase diffusion3000, matched screen +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.34250235557556 seconds. +- Overall skill 0.353459; relative MASE 0.767933; relative WQL 0.544338. +- term skill: long=0.3849, medium=0.3994, short=0.3222. +- domain skill: Econ/Fin=0.1025, Energy=0.1767, Healthcare=0.4158, Nature=0.4111, Sales=0.3476, Transport=0.4532, Web/CloudOps=0.5044. +- frequency skill: A=0.3736, D=0.3385, H=0.3748, M=0.0857, Q=0.1907, S=0.4365, T=0.3973, W=0.1999. +- variates skill: multivariate=0.3856, univariate=0.3267. +- Outcome: Skill0.353459 versus amplitude-only E31 score0.352625 at the same step/seed/data stream. Earlier-cutoff checks are pending; continue the trial. + +E56 log_window_loss training started at 2026-10-22T05:14:05Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E57: period-relative phase projections with a frozen backbone +Hypothesis: encoder and future-query attention can use seasonal history more efficiently when supplied explicit relative phase for each frequency-derived period, rather than having to reconstruct it from generic position embeddings and scalar period metadata. Add zero-initialized linear projections of per-point sine/cosine phase for the two periods to context patches and future-query patches. Positions are relative to the forecast origin; periods below2 yield zero features, and missing context positions are masked. There are65536 new parameters, with no calendar dates or dataset identifiers. + +Initialize from the selected E47 confidence6000 package; freeze every existing parameter, including the confidence projection. Train only the two phase projections on packed_sample and the unchanged local synthetic/sign generator, seed107, paired-sign weighted quantile/median loss, batch64, LR2e-4, 6000-step cosine schedule, save1000. Confirm zero-initialization equivalence and maximum-shape memory before starting alongside the six existing trainers on the one H100. No new source data. + +E57 checks passed: the zero-initialized model is bitwise equal to the parent on mixed-frequency, partially missing CPU contexts. Maximum-shape paired batch128/context4096/horizon1024 used3647 MiB peak allocated and3920 MiB reserved, including EMA and optimizer-state placeholders, with finite gradients in1.20 seconds. No optimizer update or checkpoint came from these fixtures. Start batch64 as planned; train only65536 projection parameters. + +## E52 varied requested horizons3000, matched screen +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.744144678115845 seconds. +- Overall skill 0.359510; relative MASE 0.763513; relative WQL 0.537290. +- term skill: long=0.3912, medium=0.4026, short=0.3294. +- domain skill: Econ/Fin=0.1112, Energy=0.1841, Healthcare=0.4177, Nature=0.4232, Sales=0.3464, Transport=0.4589, Web/CloudOps=0.5065. +- frequency skill: A=0.3765, D=0.3429, H=0.3831, M=0.1035, Q=0.1995, S=0.4418, T=0.4003, W=0.2081. +- variates skill: multivariate=0.3922, univariate=0.3323. +- Outcome: Skill0.359510 versus E42 partial-target control0.358812. The gain is promising; matched earlier-cutoff evaluations are queued. + +## E48 matched3000 comparison: amplitude_synth, backcast +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.832332372665405 seconds. +- Overall skill 0.322014; relative MASE 0.811414; relative WQL 0.566499. +- term skill: long=0.3860, medium=0.3513, short=0.2839. +- domain skill: Econ/Fin=0.1393, Energy=0.2195, Healthcare=0.3717, Nature=0.3475, Sales=0.3988, Transport=0.3598, Web/CloudOps=0.4348. +- frequency skill: A=0.3171, D=0.3485, H=0.3526, M=0.1707, Q=0.2099, S=0.3414, T=0.3170, W=0.2493. +- variates skill: multivariate=0.3360, univariate=0.3107. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: phase_synth, backcast +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.44191288948059 seconds. +- Overall skill 0.322626; relative MASE 0.811284; relative WQL 0.565567. +- term skill: long=0.3871, medium=0.3526, short=0.2840. +- domain skill: Econ/Fin=0.1401, Energy=0.2216, Healthcare=0.3676, Nature=0.3459, Sales=0.3983, Transport=0.3597, Web/CloudOps=0.4368. +- frequency skill: A=0.3175, D=0.3449, H=0.3527, M=0.1680, Q=0.2099, S=0.3428, T=0.3207, W=0.2496. +- variates skill: multivariate=0.3385, univariate=0.3097. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: amplitude_synth, backcast2 +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.063983917236328 seconds. +- Overall skill 0.346071; relative MASE 0.781652; relative WQL 0.547076. +- term skill: long=0.3649, medium=0.3705, short=0.3294. +- domain skill: Econ/Fin=0.0773, Energy=0.2205, Healthcare=0.3375, Nature=0.4551, Sales=0.5561, Transport=0.4102, Web/CloudOps=0.4240. +- frequency skill: A=0.3378, D=0.4197, H=0.3812, M=0.1601, Q=0.1370, S=0.2856, T=0.3361, W=0.2413. +- variates skill: multivariate=0.3528, univariate=0.3406. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: phase_synth, backcast2 +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.462491750717163 seconds. +- Overall skill 0.346572; relative MASE 0.781891; relative WQL 0.546071. +- term skill: long=0.3645, medium=0.3710, short=0.3303. +- domain skill: Econ/Fin=0.0768, Energy=0.2203, Healthcare=0.3341, Nature=0.4562, Sales=0.5562, Transport=0.4104, Web/CloudOps=0.4261. +- frequency skill: A=0.3370, D=0.4191, H=0.3813, M=0.1474, Q=0.1380, S=0.2827, T=0.3397, W=0.2426. +- variates skill: multivariate=0.3544, univariate=0.3402. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E42 final12000, matched mean-template screen +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.56895399093628 seconds. +- Overall skill 0.361108; relative MASE 0.761463; relative WQL 0.536050. +- term skill: long=0.3906, medium=0.4043, short=0.3319. +- domain skill: Econ/Fin=0.1096, Energy=0.1895, Healthcare=0.4193, Nature=0.4256, Sales=0.3404, Transport=0.4593, Web/CloudOps=0.5063. +- frequency skill: A=0.3721, D=0.3420, H=0.3825, M=0.1108, Q=0.1995, S=0.4420, T=0.4045, W=0.2122. +- variates skill: multivariate=0.3937, univariate=0.3339. +- Outcome: The partial-target change still improves over its matched original-corpus control. The direct model remains below the published later E25/E47 lineage. Earlier-cutoff checks and the prespecified final-checkpoint weight-difference transfer are pending. + +## E42 final12000, selected fixed inference rules +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.01974844932556 seconds. +- Overall skill 0.374349; relative MASE 0.747467; relative WQL 0.523688. +- term skill: long=0.3969, medium=0.4067, short=0.3525. +- domain skill: Econ/Fin=0.1345, Energy=0.2359, Healthcare=0.4230, Nature=0.4302, Sales=0.3371, Transport=0.4647, Web/CloudOps=0.4986. +- frequency skill: A=0.3753, D=0.3458, H=0.3943, M=0.1064, Q=0.1999, S=0.4233, T=0.4344, W=0.2143. +- variates skill: multivariate=0.3921, univariate=0.3599. +- Outcome: The partial-target change still improves over its matched original-corpus control. The direct model remains below the published later E25/E47 lineage. Earlier-cutoff checks and the prespecified final-checkpoint weight-difference transfer are pending. + +E42 completed12000 steps in 4034.2 elapsed training-loop seconds. E56 replaced it on the same H100. + +## E52 matched3000 comparison: partial_targets, backcast +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.31913948059082 seconds. +- Overall skill 0.329377; relative MASE 0.806571; relative WQL 0.557590. +- term skill: long=0.3896, medium=0.3560, short=0.2940. +- domain skill: Econ/Fin=0.1487, Energy=0.2246, Healthcare=0.4210, Nature=0.3485, Sales=0.3987, Transport=0.3621, Web/CloudOps=0.4433. +- frequency skill: A=0.3183, D=0.3586, H=0.3563, M=0.1681, Q=0.2258, S=0.3434, T=0.3271, W=0.2657. +- variates skill: multivariate=0.3451, univariate=0.3166. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: horizon_jitter, backcast +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.87836766242981 seconds. +- Overall skill 0.329077; relative MASE 0.807099; relative WQL 0.557723. +- term skill: long=0.3896, medium=0.3557, short=0.2936. +- domain skill: Econ/Fin=0.1451, Energy=0.2244, Healthcare=0.4181, Nature=0.3490, Sales=0.3989, Transport=0.3628, Web/CloudOps=0.4429. +- frequency skill: A=0.3192, D=0.3567, H=0.3569, M=0.1660, Q=0.2272, S=0.3431, T=0.3263, W=0.2674. +- variates skill: multivariate=0.3446, univariate=0.3165. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: partial_targets, backcast2 +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.110735416412354 seconds. +- Overall skill 0.352022; relative MASE 0.776423; relative WQL 0.540782. +- term skill: long=0.3678, medium=0.3760, short=0.3367. +- domain skill: Econ/Fin=0.0867, Energy=0.2248, Healthcare=0.3701, Nature=0.4601, Sales=0.5593, Transport=0.4130, Web/CloudOps=0.4281. +- frequency skill: A=0.3418, D=0.4285, H=0.3860, M=0.1767, Q=0.1499, S=0.2821, T=0.3437, W=0.2407. +- variates skill: multivariate=0.3578, univariate=0.3473. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: horizon_jitter, backcast2 +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.243326425552368 seconds. +- Overall skill 0.352445; relative MASE 0.776496; relative WQL 0.540026. +- term skill: long=0.3678, medium=0.3759, short=0.3375. +- domain skill: Econ/Fin=0.0824, Energy=0.2247, Healthcare=0.3724, Nature=0.4606, Sales=0.5600, Transport=0.4138, Web/CloudOps=0.4293. +- frequency skill: A=0.3405, D=0.4280, H=0.3865, M=0.1811, Q=0.1490, S=0.2826, T=0.3439, W=0.2424. +- variates skill: multivariate=0.3585, univariate=0.3475. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E57 period-relative phase projection, initial screen +- Checkpoint SHA-256: `275e6d68dda364b71999bf311a8ce7acf09ae4fb4642b8e07c404dd1bd9849ca`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.636561393737793 seconds. +- Overall skill 0.375793; relative MASE 0.745649; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4406, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0954, Q=0.1982, S=0.4239, T=0.4362, W=0.2090. +- variates skill: multivariate=0.3937, univariate=0.3611. +- Outcome: Exactly equal to the E47 parent score0.3757929301726527, validating the zero-initialized runtime before training. + +## E55 final12000 matched training difference, screen +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.509355783462524 seconds. +- Overall skill 0.375956; relative MASE 0.746201; relative WQL 0.521885. +- term skill: long=0.3991, medium=0.4059, short=0.3549. +- domain skill: Econ/Fin=0.1387, Energy=0.2371, Healthcare=0.4442, Nature=0.4287, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3506, H=0.3961, M=0.1054, Q=0.1984, S=0.4235, T=0.4345, W=0.2191. +- variates skill: multivariate=0.3928, univariate=0.3622. +- Outcome: Skill0.375956 versus selected E47 score0.375793. This is a larger screen gain than the6000-step difference; evaluate both earlier cutoffs before selecting. + +## E57 period-relative phase projections1000, screen +- Checkpoint SHA-256: `2deeff17c98c6993f9da1713c973fe0f803358a717c021e81438cdf203ae5f51`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.055758476257324 seconds. +- Overall skill 0.375590; relative MASE 0.745958; relative WQL 0.522667. +- term skill: long=0.3989, medium=0.4062, short=0.3542. +- domain skill: Econ/Fin=0.1398, Energy=0.2354, Healthcare=0.4399, Nature=0.4278, Sales=0.3393, Transport=0.4661, Web/CloudOps=0.4996. +- frequency skill: A=0.3762, D=0.3549, H=0.3950, M=0.0942, Q=0.1970, S=0.4219, T=0.4359, W=0.2092. +- variates skill: multivariate=0.3933, univariate=0.3612. +- Outcome: Skill0.375590 is slightly below the parent0.375793. Continue to3000/6000 to assess whether training recovers, as the previous confidence projection did late in its schedule. + +## E42 final12000 matched comparison: large_corpus_control, backcast +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.9762020111084 seconds. +- Overall skill 0.330213; relative MASE 0.806120; relative WQL 0.556510. +- term skill: long=0.3888, medium=0.3557, short=0.2960. +- domain skill: Econ/Fin=0.1456, Energy=0.2279, Healthcare=0.4182, Nature=0.3493, Sales=0.3975, Transport=0.3647, Web/CloudOps=0.4422. +- frequency skill: A=0.2987, D=0.3583, H=0.3572, M=0.1590, Q=0.2332, S=0.3409, T=0.3303, W=0.2690. +- variates skill: multivariate=0.3460, univariate=0.3174. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E42 final12000 matched comparison: partial_targets, backcast +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.47197651863098 seconds. +- Overall skill 0.331074; relative MASE 0.805060; relative WQL 0.555811. +- term skill: long=0.3901, medium=0.3561, short=0.2969. +- domain skill: Econ/Fin=0.1467, Energy=0.2289, Healthcare=0.4192, Nature=0.3505, Sales=0.3984, Transport=0.3646, Web/CloudOps=0.4431. +- frequency skill: A=0.3115, D=0.3560, H=0.3581, M=0.1677, Q=0.2337, S=0.3423, T=0.3297, W=0.2763. +- variates skill: multivariate=0.3468, univariate=0.3183. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E55 final12000 transferred difference, backcast +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.976391792297363 seconds. +- Overall skill 0.335609; relative MASE 0.797954; relative WQL 0.553184. +- term skill: long=0.3979, medium=0.3572, short=0.3014. +- domain skill: Econ/Fin=0.1631, Energy=0.2288, Healthcare=0.4091, Nature=0.3616, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4491. +- frequency skill: A=0.3254, D=0.3493, H=0.3647, M=0.1918, Q=0.2328, S=0.3430, T=0.3345, W=0.2857. +- variates skill: multivariate=0.3525, univariate=0.3218. +- Outcome: Transfer gains main+0.000163 and earlier1+0.001483, but loses earlier2 by0.001028. Average gain across the three cutoffs is positive; run exact full validation before deciding whether to publish this tradeoff. + +## E42 final12000 matched comparison: large_corpus_control, backcast2 +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.495740175247192 seconds. +- Overall skill 0.353454; relative MASE 0.776299; relative WQL 0.538480. +- term skill: long=0.3687, medium=0.3751, short=0.3393. +- domain skill: Econ/Fin=0.0914, Energy=0.2288, Healthcare=0.3664, Nature=0.4591, Sales=0.5548, Transport=0.4142, Web/CloudOps=0.4303. +- frequency skill: A=0.3473, D=0.4293, H=0.3865, M=0.1743, Q=0.1540, S=0.2821, T=0.3466, W=0.2433. +- variates skill: multivariate=0.3605, univariate=0.3477. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E42 final12000 matched comparison: partial_targets, backcast2 +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.049270629882812 seconds. +- Overall skill 0.353096; relative MASE 0.776739; relative WQL 0.538771. +- term skill: long=0.3692, medium=0.3760, short=0.3381. +- domain skill: Econ/Fin=0.0920, Energy=0.2294, Healthcare=0.3671, Nature=0.4574, Sales=0.5540, Transport=0.4141, Web/CloudOps=0.4294. +- frequency skill: A=0.3519, D=0.4253, H=0.3874, M=0.1772, Q=0.1555, S=0.2805, T=0.3464, W=0.2443. +- variates skill: multivariate=0.3599, univariate=0.3476. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E55 final12000 transferred difference, backcast2 +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.92556405067444 seconds. +- Overall skill 0.357472; relative MASE 0.772231; relative WQL 0.534610. +- term skill: long=0.3642, medium=0.3858, short=0.3437. +- domain skill: Econ/Fin=0.1127, Energy=0.2350, Healthcare=0.3474, Nature=0.4678, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4300. +- frequency skill: A=0.3556, D=0.4262, H=0.3901, M=0.1532, Q=0.1527, S=0.2796, T=0.3567, W=0.2577. +- variates skill: multivariate=0.3616, univariate=0.3541. +- Outcome: Transfer gains main+0.000163 and earlier1+0.001483, but loses earlier2 by0.001028. Average gain across the three cutoffs is positive; run exact full validation before deciding whether to publish this tradeoff. + +E31 amplitude-varying synthetic run completed24000 steps in7471.1 elapsed training-loop seconds on the shared H100. Final checkpoint is being checked with the selected fixed inference rules at all three cutoffs. + +## E58: increase width from our own trained model (preparing) +Repeated continuations of the36.8M model show diminishing gains. Hypothesis: more capacity can improve learning from the allowed corpus after a function-preserving initialization, given a sufficiently long matched schedule. Widen the selected E47 model from d512/heads8 to d1024/heads16, retaining enc6/dec4 and patch16. Duplicate hidden representations; duplicate input columns with weights divided by2; duplicate output rows. Preserve attention K/V grouping, repeat layernorm vectors, and repeat the original512-dimensional positional vector. Verify the unperturbed conversion on fixed synthetic fixtures. Then add independently seeded1%-of-tensor-standard-deviation noise to matrix weights to break duplicated-neuron symmetry, measuring the resulting prediction change. This is an initialization derived only from our own trained weights. + +A matched original-width control will use the same parent, data windows, seed113 and original sign-augmented loss. Proposed batch128, LR3e-5 and24000-step schedule are subject to a maximum-shape memory check after E31 releases its training slot. For widened matrices with duplicated input columns, use half the base learning rate and twice the weight decay to retain comparable initial functional update/decay scales; other parameters use the original rate. These settings and any necessary memory-driven batch adjustment will be recorded before training. No external weights or data. + +## E55 final12000 transferred update, exact full package validation +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372143; relative MASE 0.748865; relative WQL 0.526402. +- term skill: long=0.3930, medium=0.4049, short=0.3509. +- domain skill: Econ/Fin=0.1163, Energy=0.2302, Healthcare=0.4510, Nature=0.4286, Sales=0.3487, Transport=0.4659, Web/CloudOps=0.4912. +- frequency skill: A=0.2931, D=0.3551, H=0.3913, M=0.1284, Q=0.1851, S=0.4235, T=0.4275, W=0.2120. +- variates skill: multivariate=0.3885, univariate=0.3588. +- Outcome: Select for publication after relocation and determinism checks. Full skill0.372143 improves on E47 score0.371766. All97 configurations and151170 instances passed, with no quantile crossings; actual inference123.68 seconds. Earlier temporal diagnostics retain a tradeoff: first earlier cutoff+0.001483, second earlier cutoff-0.001028. The mean gain across the main and two earlier screens is positive; this is validation selection, not a held-out reward claim. + +E58 conversion produced 146477344 parameters. Maximum normalized-quantile difference before noise was 0.000001669; after the fixed1% matrix noise it was 0.018048. Conversion took 2.38 CPU seconds. Parent hash and noise seed113 are recorded in wide_capacity_initial.pt.json. + +Maximum-shape memory checks, including optimizer moments and EMA placeholders, used13326 MiB reserved at batch128 and10708 MiB at batch96; both had finite gradients. Choose batch96 for both arms to preserve evaluation headroom. Increase the planned schedule from24000 to32000 steps so the planned number of windows remains3072000 per arm. Save/evaluate4000,8000,16000,24000,32000. Base LR3e-5, seed113, unchanged context/horizon mixture and packed_sample. Wider-matrix LR multiplier0.5 and decay multiplier2 remain as declared. Start the wide arm now that E31 has exited; queue the original-width control after E57 completes. Research and package inference use batch64 for both widths to keep memory comparable. + +E55 relocation/determinism checks passed: the candidate and a separate fresh /tmp copy, both launched from /tmp, produced bitwise identical finite monotone quantiles for daily, hourly and multivariate medium-horizon examples. Publish the complete model/report/manifest/provenance/log bundle atomically. + +## E59: equal-weight ensemble of complementary training variants +The final E31 amplitude-varying model improves both earlier cutoffs over its recency24000 control, while its main fixed-rule screen is lower. The selected E55 transfer has the opposite second-earlier tradeoff. Hypothesis: an equal-weight average can reduce these differences. Reuse cached quantiles for E55 partial_delta12k and E31 amplitude24000, with both members forecasting every instance. Test only the fixed50/50 average, with and without applying the selected zero0.4 projection once more after averaging; averaging two zero-projected forecasts can otherwise introduce small positive values. No weight sweep or training. If promising, build and validate the actual two-member runtime before publication. + +## E31 final24000 with selected fixed rules, screen +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.934752464294434 seconds. +- Overall skill 0.375166; relative MASE 0.746944; relative WQL 0.522686. +- term skill: long=0.3998, medium=0.4070, short=0.3527. +- domain skill: Econ/Fin=0.1414, Energy=0.2355, Healthcare=0.4087, Nature=0.4266, Sales=0.3412, Transport=0.4655, Web/CloudOps=0.5053. +- frequency skill: A=0.3762, D=0.3445, H=0.3950, M=0.0900, Q=0.2023, S=0.4234, T=0.4389, W=0.2104. +- variates skill: multivariate=0.3958, univariate=0.3582. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E31 final24000 with selected fixed rules, backcast +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.675416946411133 seconds. +- Overall skill 0.334745; relative MASE 0.799254; relative WQL 0.553722. +- term skill: long=0.3965, medium=0.3574, short=0.3003. +- domain skill: Econ/Fin=0.1603, Energy=0.2277, Healthcare=0.4000, Nature=0.3619, Sales=0.3979, Transport=0.3709, Web/CloudOps=0.4497. +- frequency skill: A=0.3115, D=0.3485, H=0.3643, M=0.1990, Q=0.2289, S=0.3403, T=0.3365, W=0.2702. +- variates skill: multivariate=0.3522, univariate=0.3205. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E31 final24000 with selected fixed rules, backcast2 +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.473368406295776 seconds. +- Overall skill 0.358910; relative MASE 0.771616; relative WQL 0.532644. +- term skill: long=0.3672, medium=0.3833, short=0.3462. +- domain skill: Econ/Fin=0.1126, Energy=0.2349, Healthcare=0.3493, Nature=0.4705, Sales=0.5536, Transport=0.4202, Web/CloudOps=0.4327. +- frequency skill: A=0.3556, D=0.4300, H=0.3901, M=0.1370, Q=0.1497, S=0.2870, T=0.3573, W=0.2669. +- variates skill: multivariate=0.3623, univariate=0.3562. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E59 cached equal-weight comparison +No training; fixed inference seed0 and ensemble weight0.5 for each member. Member weights: selected E55 partial_delta12k SHA-256 721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802; amplitude24000 hash is recorded in its matched reports. + +screen: 2.65 CPU diagnostic seconds. +- average: skill 0.376116; term: short=0.3545, medium=0.4069, long=0.3997; domain: Econ/Fin=0.1408, Energy=0.2367, Healthcare=0.4304, Nature=0.4279, Sales=0.3385, Transport=0.4658, Web/CloudOps=0.5025; freq: A-DEC=0.3755, Q-DEC=0.2008, M=0.0994, W-SUN=0.0865, D=0.3491, H=0.3958, 15T=0.2143, W-FRI=-0.0164, 10T=0.6125, W-TUE=0.5565, W-THU=0.2049, W-WED=0.3155, 5T=0.5141, 10S=0.4235. +- average_then_zero: skill 0.376000; term: short=0.3545, medium=0.4068, long=0.3994; domain: Econ/Fin=0.1408, Energy=0.2367, Healthcare=0.4304, Nature=0.4277, Sales=0.3386, Transport=0.4658, Web/CloudOps=0.5021; freq: A-DEC=0.3755, Q-DEC=0.2008, M=0.0999, W-SUN=0.0865, D=0.3489, H=0.3957, 15T=0.2143, W-FRI=-0.0164, 10T=0.6124, W-TUE=0.5565, W-THU=0.2049, W-WED=0.3154, 5T=0.5138, 10S=0.4235. + +backcast: 2.59 CPU diagnostic seconds. +- average: skill 0.335702; term: short=0.3015, medium=0.3577, long=0.3976; domain: Econ/Fin=0.1625, Energy=0.2286, Healthcare=0.4066, Nature=0.3622, Sales=0.3978, Transport=0.3714, Web/CloudOps=0.4500; freq: A-DEC=0.3193, Q-DEC=0.2313, M=0.1979, W-SUN=0.0360, D=0.3493, H=0.3648, 15T=0.2260, W-FRI=0.2606, 10T=0.3193, W-TUE=0.5296, W-THU=0.2330, W-WED=0.3440, 5T=0.4376, 10S=0.3419. +- average_then_zero: skill 0.335612; term: short=0.3014, medium=0.3575, long=0.3976; domain: Econ/Fin=0.1625, Energy=0.2286, Healthcare=0.4066, Nature=0.3619, Sales=0.3980, Transport=0.3714, Web/CloudOps=0.4498; freq: A-DEC=0.3193, Q-DEC=0.2313, M=0.1983, W-SUN=0.0360, D=0.3491, H=0.3648, 15T=0.2260, W-FRI=0.2606, 10T=0.3188, W-TUE=0.5296, W-THU=0.2330, W-WED=0.3440, 5T=0.4372, 10S=0.3419. + +backcast2: 2.43 CPU diagnostic seconds. +- average: skill 0.358667; term: short=0.3455, medium=0.3850, long=0.3661; domain: Econ/Fin=0.1134, Energy=0.2353, Healthcare=0.3493, Nature=0.4696, Sales=0.5519, Transport=0.4203, Web/CloudOps=0.4320; freq: A-DEC=0.3562, Q-DEC=0.1515, M=0.1452, W-SUN=0.0558, D=0.4288, H=0.3904, 15T=0.1044, W-FRI=0.1452, 10T=0.4937, W-TUE=0.1018, W-THU=0.3276, W-WED=0.5366, 5T=0.4664, 10S=0.2839. +- average_then_zero: skill 0.358497; term: short=0.3453, medium=0.3849, long=0.3659; domain: Econ/Fin=0.1134, Energy=0.2352, Healthcare=0.3493, Nature=0.4693, Sales=0.5513, Transport=0.4203, Web/CloudOps=0.4318; freq: A-DEC=0.3562, Q-DEC=0.1515, M=0.1452, W-SUN=0.0558, D=0.4286, H=0.3904, 15T=0.1044, W-FRI=0.1452, 10T=0.4927, W-TUE=0.1018, W-THU=0.3276, W-WED=0.5364, 5T=0.4661, 10S=0.2839. + +Outcome: plain averaging wins all three cutoffs over the selected single model. Reapplying the zero projection after averaging is worse at every cutoff. Build the actual two-member package and verify cached/runtime agreement, full validation and relocation before publication. + +E58 wide_capacity_control training started at 2026-10-22T05:35:38Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E59 actual two-member runtime produced bitwise identical quantiles to the cached plain50/50 average for every point in all97 main-screen configurations. Its screening skill is0.37611643951533646, matching the probe exactly. Proceed to actual full-package inference and scoring. + +## E57 period-relative phase projections3000, screen +- Checkpoint SHA-256: `740fed81313fbb2dc2060173ae11ed120d6cca9600620cd1c9d9331ccac699e5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.340542793273926 seconds. +- Overall skill 0.375400; relative MASE 0.745694; relative WQL 0.523171. +- term skill: long=0.3995, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1392, Energy=0.2355, Healthcare=0.4394, Nature=0.4265, Sales=0.3394, Transport=0.4660, Web/CloudOps=0.4999. +- frequency skill: A=0.3762, D=0.3544, H=0.3946, M=0.0943, Q=0.1976, S=0.4227, T=0.4359, W=0.2085. +- variates skill: multivariate=0.3928, univariate=0.3611. +- Outcome: The6000-step score0.375840 is only0.000047 above its E47 parent, after earlier regressions. Existing model tensors remain bitwise unchanged. Check earlier cutoffs before selecting any use of these projections. + +## E57 period-relative phase projections6000, screen +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.05087399482727 seconds. +- Overall skill 0.375840; relative MASE 0.745321; relative WQL 0.522695. +- term skill: long=0.3997, medium=0.4065, short=0.3542. +- domain skill: Econ/Fin=0.1396, Energy=0.2356, Healthcare=0.4472, Nature=0.4272, Sales=0.3377, Transport=0.4655, Web/CloudOps=0.4998. +- frequency skill: A=0.3762, D=0.3562, H=0.3947, M=0.0979, Q=0.1989, S=0.4232, T=0.4357, W=0.2089. +- variates skill: multivariate=0.3935, univariate=0.3614. +- Outcome: The6000-step score0.375840 is only0.000047 above its E47 parent, after earlier regressions. Existing model tensors remain bitwise unchanged. Check earlier cutoffs before selecting any use of these projections. + +E57 completed6000 steps in1147.4 elapsed training-loop seconds. Every pre-existing tensor is bitwise equal to the E47 parent; only the65536 phase-projection parameters changed. E58 original-width control started after this process exited. + +## E58 widened initialization, main screen at batch64 +- Checkpoint SHA-256: `495eed9e1a09379b3cbcdadbee447d2c519a2cff8239c0756cf94f49f8a1b55e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 43.54188299179077 seconds. +- Overall skill 0.375710; relative MASE 0.745704; relative WQL 0.522645. +- term skill: long=0.3998, medium=0.4067, short=0.3538. +- domain skill: Econ/Fin=0.1394, Energy=0.2348, Healthcare=0.4397, Nature=0.4283, Sales=0.3400, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3540, H=0.3951, M=0.0946, Q=0.1984, S=0.4240, T=0.4362, W=0.2087. +- variates skill: multivariate=0.3937, univariate=0.3610. +- Outcome: Initial score0.375710 remains close to the original model before any larger-model training. The matched original-width initialization at the same inference batch size is being checked. + +## E56 log window loss3000, matched screen +- Checkpoint SHA-256: `14dd06fb6dff3c336f5aa26b8525d7ccb921a80b3e7be4d22b285584c14ff3bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.476420640945435 seconds. +- Overall skill 0.357135; relative MASE 0.765561; relative WQL 0.539835. +- term skill: long=0.3893, medium=0.3998, short=0.3270. +- domain skill: Econ/Fin=0.1142, Energy=0.1808, Healthcare=0.3930, Nature=0.4235, Sales=0.3538, Transport=0.4615, Web/CloudOps=0.5024. +- frequency skill: A=0.3804, D=0.3293, H=0.3825, M=0.1125, Q=0.2032, S=0.4413, T=0.3984, W=0.2094. +- variates skill: multivariate=0.3893, univariate=0.3303. +- Outcome: Score0.357135 regresses versus original-loss control0.358802. Continue to6000 before deciding whether to stop this objective. + +## E48 phase diffusion6000, matched screen +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.55935049057007 seconds. +- Overall skill 0.356225; relative MASE 0.765189; relative WQL 0.541626. +- term skill: long=0.3862, medium=0.3999, short=0.3266. +- domain skill: Econ/Fin=0.1072, Energy=0.1811, Healthcare=0.4144, Nature=0.4178, Sales=0.3484, Transport=0.4543, Web/CloudOps=0.5048. +- frequency skill: A=0.3702, D=0.3423, H=0.3775, M=0.0903, Q=0.1971, S=0.4361, T=0.4007, W=0.2000. +- variates skill: multivariate=0.3887, univariate=0.3292. +- Outcome: Score0.356225 versus amplitude-only0.355543: the main gain persists at6000. Earlier cutoffs are being evaluated. + +## E52 varied requested horizons6000, matched screen +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.603736400604248 seconds. +- Overall skill 0.359683; relative MASE 0.762743; relative WQL 0.537542. +- term skill: long=0.3900, medium=0.4024, short=0.3303. +- domain skill: Econ/Fin=0.1129, Energy=0.1876, Healthcare=0.4160, Nature=0.4253, Sales=0.3425, Transport=0.4576, Web/CloudOps=0.5040. +- frequency skill: A=0.3774, D=0.3429, H=0.3812, M=0.1107, Q=0.1984, S=0.4413, T=0.4021, W=0.2071. +- variates skill: multivariate=0.3915, univariate=0.3332. +- Outcome: Score0.359683 versus E42 partial-target control0.359222: a smaller main gain persists. Check both earlier cutoffs. + +## E54 original-context control6000, screen +- Checkpoint SHA-256: `14d964cb2b828f8e81c8b656b33da583b2f5fb48a3f003d043ba7c0b88cd3137`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.69702458381653 seconds. +- Overall skill 0.374515; relative MASE 0.746663; relative WQL 0.523973. +- term skill: long=0.3995, medium=0.4071, short=0.3516. +- domain skill: Econ/Fin=0.1381, Energy=0.2362, Healthcare=0.4110, Nature=0.4291, Sales=0.3380, Transport=0.4658, Web/CloudOps=0.5007. +- frequency skill: A=0.3757, D=0.3496, H=0.3960, M=0.0674, Q=0.2005, S=0.4225, T=0.4371, W=0.2070. +- variates skill: multivariate=0.3945, univariate=0.3581. +- Outcome: Fresh continuation is below the E25 parent. Keep as the matched source-window/seed reference for the8192-context arm. + +## E48 matched6000 comparison: amplitude_synth, backcast +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.44511580467224 seconds. +- Overall skill 0.324002; relative MASE 0.810229; relative WQL 0.564005. +- term skill: long=0.3880, medium=0.3521, short=0.2864. +- domain skill: Econ/Fin=0.1415, Energy=0.2210, Healthcare=0.3855, Nature=0.3485, Sales=0.3980, Transport=0.3607, Web/CloudOps=0.4366. +- frequency skill: A=0.3171, D=0.3509, H=0.3541, M=0.1703, Q=0.2160, S=0.3413, T=0.3204, W=0.2494. +- variates skill: multivariate=0.3381, univariate=0.3126. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: phase_synth, backcast +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.959611415863037 seconds. +- Overall skill 0.322903; relative MASE 0.811500; relative WQL 0.564954. +- term skill: long=0.3870, medium=0.3532, short=0.2843. +- domain skill: Econ/Fin=0.1406, Energy=0.2220, Healthcare=0.3697, Nature=0.3497, Sales=0.3989, Transport=0.3583, Web/CloudOps=0.4353. +- frequency skill: A=0.3141, D=0.3444, H=0.3533, M=0.1676, Q=0.2139, S=0.3417, T=0.3204, W=0.2546. +- variates skill: multivariate=0.3382, univariate=0.3105. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: amplitude_synth, backcast2 +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.365211486816406 seconds. +- Overall skill 0.349572; relative MASE 0.778615; relative WQL 0.543345. +- term skill: long=0.3660, medium=0.3724, short=0.3345. +- domain skill: Econ/Fin=0.0821, Energy=0.2234, Healthcare=0.3611, Nature=0.4581, Sales=0.5590, Transport=0.4121, Web/CloudOps=0.4247. +- frequency skill: A=0.3403, D=0.4277, H=0.3841, M=0.1545, Q=0.1409, S=0.2820, T=0.3394, W=0.2470. +- variates skill: multivariate=0.3548, univariate=0.3453. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: phase_synth, backcast2 +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.906906366348267 seconds. +- Overall skill 0.348439; relative MASE 0.780846; relative WQL 0.543682. +- term skill: long=0.3636, medium=0.3707, short=0.3341. +- domain skill: Econ/Fin=0.0817, Energy=0.2219, Healthcare=0.3552, Nature=0.4580, Sales=0.5591, Transport=0.4110, Web/CloudOps=0.4239. +- frequency skill: A=0.3402, D=0.4247, H=0.3827, M=0.1524, Q=0.1420, S=0.2780, T=0.3407, W=0.2441. +- variates skill: multivariate=0.3541, univariate=0.3439. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E59 equal-weight two-member ensemble, exact full package validation +- Checkpoint SHA-256: `a5f575ec44defbc0ca0c4aeb29618bbcc0e09f726985851eee4027ea698cfadd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372254; relative MASE 0.748754; relative WQL 0.526294. +- term skill: long=0.3937, medium=0.4059, short=0.3504. +- domain skill: Econ/Fin=0.1179, Energy=0.2297, Healthcare=0.4376, Nature=0.4278, Sales=0.3512, Transport=0.4661, Web/CloudOps=0.4950. +- frequency skill: A=0.2917, D=0.3537, H=0.3910, M=0.1216, Q=0.1860, S=0.4235, T=0.4302, W=0.2080. +- variates skill: multivariate=0.3905, univariate=0.3573. +- Outcome: Select after relocation/determinism checks: full skill0.372254 versus single-model0.372143; relative MASE0.748754 and WQL0.526294. All97 configurations and151170 instances passed with no quantile crossings. Actual package inference234.68 seconds while training shared the one H100. Main screening and both earlier cutoffs improve; every member forecasts every instance with fixed equal weights. + +E48 stopped cleanly at step7631, after 2736.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `702c419a404c2aad31011fb824ace504576f5e74244fc4228229fdfb2d970a9a`. The stop checkpoint is retained for provenance and is not selected. + +E59 relocation/determinism passed: the two-member candidate and a separate /tmp copy, both launched from /tmp, produced bitwise identical finite monotone forecasts on daily, hourly and multivariate medium-horizon examples. The complete two-member package is ready for atomic publication. + +## E57 phase projections final6000, backcast +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.856826066970825 seconds. +- Overall skill 0.333418; relative MASE 0.800235; relative WQL 0.555251. +- term skill: long=0.3968, medium=0.3558, short=0.2984. +- domain skill: Econ/Fin=0.1603, Energy=0.2271, Healthcare=0.4058, Nature=0.3594, Sales=0.3943, Transport=0.3716, Web/CloudOps=0.4455. +- frequency skill: A=0.3079, D=0.3513, H=0.3638, M=0.1776, Q=0.2354, S=0.3427, T=0.3327, W=0.2745. +- variates skill: multivariate=0.3498, univariate=0.3201. +- Outcome: Reject this feature addition: main gain0.000047 is offset by earlier1 loss0.000708 and earlier2 loss0.000030 versus the frozen E47 parent. No package change from this branch. + +## E52 varied requested horizons6000, backcast +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.876362562179565 seconds. +- Overall skill 0.330107; relative MASE 0.806559; relative WQL 0.556384. +- term skill: long=0.3900, medium=0.3554, short=0.2954. +- domain skill: Econ/Fin=0.1459, Energy=0.2294, Healthcare=0.4132, Nature=0.3489, Sales=0.3970, Transport=0.3634, Web/CloudOps=0.4423. +- frequency skill: A=0.3187, D=0.3539, H=0.3583, M=0.1613, Q=0.2281, S=0.3442, T=0.3292, W=0.2708. +- variates skill: multivariate=0.3469, univariate=0.3164. +- Outcome: Relative to E42 partial-target control6000: main+0.000461, earlier1-0.000193, earlier2+0.000278. Continue to the final12000 checkpoint; a small positive average effect persists. + +## E57 phase projections final6000, backcast2 +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.712015867233276 seconds. +- Overall skill 0.358470; relative MASE 0.770691; relative WQL 0.534015. +- term skill: long=0.3646, medium=0.3858, short=0.3453. +- domain skill: Econ/Fin=0.1102, Energy=0.2363, Healthcare=0.3561, Nature=0.4700, Sales=0.5508, Transport=0.4205, Web/CloudOps=0.4287. +- frequency skill: A=0.3495, D=0.4331, H=0.3891, M=0.1593, Q=0.1505, S=0.2824, T=0.3568, W=0.2548. +- variates skill: multivariate=0.3620, univariate=0.3556. +- Outcome: Reject this feature addition: main gain0.000047 is offset by earlier1 loss0.000708 and earlier2 loss0.000030 versus the frozen E47 parent. No package change from this branch. + +## E52 varied requested horizons6000, backcast2 +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.18545150756836 seconds. +- Overall skill 0.353179; relative MASE 0.775830; relative WQL 0.539265. +- term skill: long=0.3689, medium=0.3764, short=0.3382. +- domain skill: Econ/Fin=0.0847, Energy=0.2293, Healthcare=0.3759, Nature=0.4588, Sales=0.5595, Transport=0.4134, Web/CloudOps=0.4274. +- frequency skill: A=0.3432, D=0.4263, H=0.3869, M=0.1771, Q=0.1489, S=0.2829, T=0.3454, W=0.2495. +- variates skill: multivariate=0.3591, univariate=0.3484. +- Outcome: Relative to E42 partial-target control6000: main+0.000461, earlier1-0.000193, earlier2+0.000278. Continue to the final12000 checkpoint; a small positive average effect persists. + +## E60 filtered shared drivers for a frozen cross-channel adapter +Hypothesis: earlier joint adapters saw lagged shared latent drivers but no channel-specific response filtering. A synthetic fast driver and a smoothed response may better represent thermal and energy relationships. Compare original joint generation against causal exponential filtering of half the channels in half the synthetic groups. Filtering time constant is log-uniform from1 to316 steps, applied before observation noise with256 warmup points and stationary initial level. Real windows, latent drivers, coefficients, noise, signs and scales use matched main RNG draws. +- Parent: own E55 partial_delta12k checkpoint, SHA-256721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802. All original weights frozen. Add the previously tested zero-output cross-channel attention adapter (1051136 parameters). Every instance is forecast; one-channel inputs have the identity adapter. +- Data: the26 allow-listed sources in packed_joint plus the original locally generated multivariate latent-driver generator. Synthetic fraction0.30. Candidate adds the declared filtered-response generator. No validation input or labels enter training. +- Matched seed137; independent filter seed400140. Groups16, channels2/3/4/8 with probabilities0.4/0.2/0.2/0.2; contexts512/1024/2048/4096 and horizons32/128/512/1024 follow the original joint sampler. Paired-sign loss in both arms, AdamW LR0.0002,6000 steps, save1000/3000/6000 for diagnostics. One shared H100; training elapsed time will be recorded separately for each arm. +- Selection: compare all97 configurations and both earlier cutoffs against the frozen parent and matched control. First verify sampler matching, identity initialization and maximum-shape memory without optimizer updates. No outcome yet. + +## E56 logarithmic window loss3000 +- Checkpoint SHA-256: `14dd06fb6dff3c336f5aa26b8525d7ccb921a80b3e7be4d22b285584c14ff3bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.476420640945435 seconds. +- Overall skill 0.357135; relative MASE 0.765561; relative WQL 0.539835. +- term skill: long=0.3893, medium=0.3998, short=0.3270. +- domain skill: Econ/Fin=0.1142, Energy=0.1808, Healthcare=0.3930, Nature=0.4235, Sales=0.3538, Transport=0.4615, Web/CloudOps=0.5024. +- frequency skill: A=0.3804, D=0.3293, H=0.3825, M=0.1125, Q=0.2032, S=0.4413, T=0.3984, W=0.2094. +- variates skill: multivariate=0.3893, univariate=0.3303. +- Outcome: Below matched control; the loss transformation is not selected. + +## E56 logarithmic window loss6000 +- Checkpoint SHA-256: `3346c86c6ce73e739fdd2a286b7cd4c1dab7430f6ee1ea8056b8db4943c48d66`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.688469886779785 seconds. +- Overall skill 0.357689; relative MASE 0.764496; relative WQL 0.539655. +- term skill: long=0.3904, medium=0.4011, short=0.3270. +- domain skill: Econ/Fin=0.1167, Energy=0.1822, Healthcare=0.3871, Nature=0.4260, Sales=0.3525, Transport=0.4624, Web/CloudOps=0.5018. +- frequency skill: A=0.3766, D=0.3301, H=0.3834, M=0.1073, Q=0.2061, S=0.4406, T=0.3995, W=0.2098. +- variates skill: multivariate=0.3901, univariate=0.3306. +- Outcome: Skill0.357689 versus matched control0.358628; second regression. Stop and retain existing linear window loss. + +## E54 recent4096 matched control final12000 +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.02079463005066 seconds. +- Overall skill 0.375764; relative MASE 0.744880; relative WQL 0.523131. +- term skill: long=0.4000, medium=0.4083, short=0.3532. +- domain skill: Econ/Fin=0.1410, Energy=0.2368, Healthcare=0.4240, Nature=0.4300, Sales=0.3368, Transport=0.4653, Web/CloudOps=0.5016. +- frequency skill: A=0.3753, D=0.3535, H=0.3960, M=0.0712, Q=0.2025, S=0.4230, T=0.4374, W=0.2130. +- variates skill: multivariate=0.3961, univariate=0.3591. +- Outcome: Finished12000 steps in2491.2 training-loop seconds. Small gain over frozen parent; await the8192 arm before interpretation. + +## E58 widened146M first4000 +- Checkpoint SHA-256: `a8e3dbf8f591804fb3ac6c72ac632dd9e18038e4da7f195208e56f85f41ecd29`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.12893605232239 seconds. +- Overall skill 0.374121; relative MASE 0.747837; relative WQL 0.523810. +- term skill: long=0.3989, medium=0.4070, short=0.3512. +- domain skill: Econ/Fin=0.1400, Energy=0.2366, Healthcare=0.4144, Nature=0.4278, Sales=0.3414, Transport=0.4641, Web/CloudOps=0.4992. +- frequency skill: A=0.3730, D=0.3465, H=0.3947, M=0.0955, Q=0.1987, S=0.4198, T=0.4367, W=0.2046. +- variates skill: multivariate=0.3940, univariate=0.3578. +- Outcome: Ahead of matched37M control by0.000510, but below initial checkpoint. Continue the prespecified longer capacity comparison. + +## E58 matched37M first4000 +- Checkpoint SHA-256: `65969ac2e314e6103c326ab0fe1c550d53a285833d9f983e1c1cdff0d7fb66b3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.00419569015503 seconds. +- Overall skill 0.373612; relative MASE 0.748644; relative WQL 0.524097. +- term skill: long=0.3990, medium=0.4070, short=0.3502. +- domain skill: Econ/Fin=0.1392, Energy=0.2363, Healthcare=0.4121, Nature=0.4272, Sales=0.3410, Transport=0.4638, Web/CloudOps=0.4989. +- frequency skill: A=0.3725, D=0.3451, H=0.3948, M=0.0947, Q=0.1985, S=0.4190, T=0.4363, W=0.2034. +- variates skill: multivariate=0.3937, univariate=0.3572. +- Outcome: Below starting checkpoint; matched capacity comparison continues. + +E56 stop receipt: {"stopped_utc": "2026-10-22T05:53:09.078048+00:00", "reason": "Main screen below matched E38 control at both3000 and6000; prune negative branch.", "final_checkpoint": "/workspace/research/runs/log_window_loss/ema006767.pt", "final_checkpoint_sha256": "ec25440f0d11ac776874679e366255ce9cf54138f2e6802efba22bc88157d06c", "final_step": 6767, "elapsed_training_process_seconds": null} + +E56 measured training-process elapsed time was2298.259 seconds (the previous receipt field was null because the reader used the wrong key; corrected in log_window_loss_stop_receipt.json). + +E60 checks passed: { + "cpu_check_seconds": 1.9617000540019944, + "changed_synthetic_context_values": 21054, + "identity_matches_parent_bitwise": true, + "main_and_filter_rng_matched": true, + "real_windows_unchanged": true, + "optimizer_updates": 0, + "gpu_fixture_seconds": 1.0786702629411593, + "allocated_mib": 2625.63525390625, + "reserved_mib": 3872.0, + "parameters": 37851936, + "trainable_parameters": 1051136, + "loss": 0.3574138879776001 +} +Both arms now start on the shared H100. No optimizer updates occurred during fixtures. + +## E61 log-uniform autoregressive memory in synthetic windows +Hypothesis: the original AR coefficient uniform0.2..0.995 overwhelmingly supplies rapidly decorrelating noise. Energy and short-horizon electricity remain weak across cutoffs; slow stochastic level variation may be missing. Change only the AR coefficient draw to phi=exp(-1/tau), log10(tau) uniform0..4. Keep the existing zero initial state and sqrt(1-phi^2) innovation normalization. All Fourier seasons, trends, changepoints, intermittency, observation-noise draws, synthetic fraction and real-window draws remain matched. +- Matched reference is the already completed E42 partial_targets run; do not retrain it. Same own E25 recency12000 initialization, seed79, packed_sample95-source corpus, B256, AdamW LR0.00005,12000 steps, saves3000/6000/12000. The E42 handling of partially observed targets is unchanged. +- Source declaration if selected: original local generator plus the modified log-uniform AR-time-constant generator, seed79. No new external data or pretrained assets. +- Scheduled after E52 releases its H100 allocation. Validate main screening and both earlier cutoffs against E42 at matched steps, then consider a matched parameter-difference transfer only if the learned effect is useful. No outcome yet. + +E61 sampler checks passed: {"cpu_seconds": 4.961035819957033, "main_rng_matched": true, "real_windows_unchanged": true, "periods_and_missing_masks_unchanged": true, "changed_synthetic_context_values": 31554, "optimizer_updates": 0} + +## E60 joint_filtered_control_ema0 +- Checkpoint SHA-256: `3a7e46a74247ccf366c4e2b950fe1e1cc3625c52f7db1f6fdebab261d1d66ae8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.121415376663208 seconds. +- Overall skill 0.375956; relative MASE 0.746201; relative WQL 0.521885. +- term skill: long=0.3991, medium=0.4059, short=0.3549. +- domain skill: Econ/Fin=0.1387, Energy=0.2371, Healthcare=0.4442, Nature=0.4287, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3506, H=0.3961, M=0.1054, Q=0.1984, S=0.4235, T=0.4345, W=0.2191. +- variates skill: multivariate=0.3928, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E60 joint_filtered_control_ema1000 +- Checkpoint SHA-256: `8f3493cddbf6579a69ed813b056f8a16110f6309d7589016703b68022bef205c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.04537320137024 seconds. +- Overall skill 0.376238; relative MASE 0.745929; relative WQL 0.521603. +- term skill: long=0.4000, medium=0.4050, short=0.3554. +- domain skill: Econ/Fin=0.1387, Energy=0.2375, Healthcare=0.4442, Nature=0.4301, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4986. +- frequency skill: A=0.3739, D=0.3521, H=0.3962, M=0.1054, Q=0.1984, S=0.4213, T=0.4350, W=0.2191. +- variates skill: multivariate=0.3934, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E60 joint_filtered_candidate_ema1000 +- Checkpoint SHA-256: `444ffa52005a89ef409a284a2a952d82da7f760e17f1ea865f118b1bb878fec5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.930442571640015 seconds. +- Overall skill 0.376281; relative MASE 0.745845; relative WQL 0.521590. +- term skill: long=0.4002, medium=0.4050, short=0.3554. +- domain skill: Econ/Fin=0.1387, Energy=0.2376, Healthcare=0.4442, Nature=0.4299, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4988. +- frequency skill: A=0.3739, D=0.3524, H=0.3961, M=0.1054, Q=0.1984, S=0.4208, T=0.4351, W=0.2191. +- variates skill: multivariate=0.3935, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E58 matched37M at8000 +- Checkpoint SHA-256: `2e8a53df1226d34548c14d2f6aa29531e9562825e077658040ad03cf1584e407`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.826340913772583 seconds. +- Overall skill 0.374665; relative MASE 0.746940; relative WQL 0.523529. +- term skill: long=0.3997, medium=0.4070, short=0.3518. +- domain skill: Econ/Fin=0.1410, Energy=0.2366, Healthcare=0.4123, Nature=0.4301, Sales=0.3395, Transport=0.4651, Web/CloudOps=0.4997. +- frequency skill: A=0.3794, D=0.3492, H=0.3961, M=0.0913, Q=0.2022, S=0.4225, T=0.4363, W=0.2001. +- variates skill: multivariate=0.3935, univariate=0.3592. +- Outcome: Recovered from the4000-step dip but remains below its parent. Await the matched146M checkpoint. + +## E31 amplitude synthesis final24000 with original mean-template runtime +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.28603458404541 seconds. +- Overall skill 0.361862; relative MASE 0.761019; relative WQL 0.535099. +- term skill: long=0.3937, medium=0.4047, short=0.3318. +- domain skill: Econ/Fin=0.1167, Energy=0.1881, Healthcare=0.4079, Nature=0.4215, Sales=0.3445, Transport=0.4600, Web/CloudOps=0.5131. +- frequency skill: A=0.3736, D=0.3413, H=0.3832, M=0.0977, Q=0.2001, S=0.4426, T=0.4085, W=0.2080. +- variates skill: multivariate=0.3973, univariate=0.3321. +- Outcome: Finished24000 steps in7471.1 training-loop seconds. Original-rule screening score slightly exceeds matched E25; current-rule and ensemble comparisons are recorded separately. This checkpoint is member1 of E59. + +## E60 joint_filtered_control_ema3000 +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.558463096618652 seconds. +- Overall skill 0.376364; relative MASE 0.746340; relative WQL 0.521106. +- term skill: long=0.4004, medium=0.4033, short=0.3562. +- domain skill: Econ/Fin=0.1387, Energy=0.2353, Healthcare=0.4442, Nature=0.4338, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3535, H=0.3966, M=0.1054, Q=0.1984, S=0.4217, T=0.4342, W=0.2193. +- variates skill: multivariate=0.3937, univariate=0.3622. +- Outcome: Both remain ahead of the frozen parent on the main screen. Unfiltered control now leads by 0.000084; earlier-cutoff evaluations are running. Continue both to 6000 as specified. + +## E60 joint_filtered_candidate_ema3000 +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.436699151992798 seconds. +- Overall skill 0.376280; relative MASE 0.746320; relative WQL 0.521261. +- term skill: long=0.4005, medium=0.4035, short=0.3559. +- domain skill: Econ/Fin=0.1387, Energy=0.2352, Healthcare=0.4442, Nature=0.4324, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4997. +- frequency skill: A=0.3739, D=0.3528, H=0.3961, M=0.1054, Q=0.1984, S=0.4201, T=0.4351, W=0.2193. +- variates skill: multivariate=0.3935, univariate=0.3622. +- Outcome: Both remain ahead of the frozen parent on the main screen. Unfiltered control now leads by 0.000084; earlier-cutoff evaluations are running. Continue both to 6000 as specified. + +## E62 matched horizon-training correction transferred to the selected backbone +Hypothesis: E52's varied requested horizons may add to E42's partial-target correction when transferred to the later E47 backbone. Repeat the successful E55 matched-difference method with the E52 final checkpoint: E47 confidence6000 + E52 horizon_jitter12000 - E38 control12000. Coefficient is fixed at 1.0, with no sweep. This is equivalently the E55 backbone plus the E52-minus-E42 horizon-training difference, apart from floating-point order. Confidence projection remains unchanged. All three parents originate from our own random initialization and permitted sources. +- No new training or data. CPU merge records parent hashes and elapsed time; the candidate will use the current fixed inference rules. +- Compare the main screen and both earlier cutoffs against E55 and the current E59 package before any full validation or publication. A single main-screen gain is insufficient. No outcome yet. + +E61 long_memory_synth training started at 2026-10-22T06:01:39Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E60 joint_filtered_control at3000, backcast_evals +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.748270750045776 seconds. +- Overall skill 0.334618; relative MASE 0.799261; relative WQL 0.553928. +- term skill: long=0.3961, medium=0.3571, short=0.3004. +- domain skill: Econ/Fin=0.1631, Energy=0.2278, Healthcare=0.4091, Nature=0.3620, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4461. +- frequency skill: A=0.3254, D=0.3492, H=0.3639, M=0.1918, Q=0.2328, S=0.3399, T=0.3325, W=0.2872. +- variates skill: multivariate=0.3503, univariate=0.3218. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_control at3000, backcast2_evals +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.68830132484436 seconds. +- Overall skill 0.355826; relative MASE 0.774983; relative WQL 0.535445. +- term skill: long=0.3630, medium=0.3845, short=0.3417. +- domain skill: Econ/Fin=0.1127, Energy=0.2316, Healthcare=0.3474, Nature=0.4679, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4270. +- frequency skill: A=0.3556, D=0.4260, H=0.3879, M=0.1532, Q=0.1527, S=0.2768, T=0.3543, W=0.2578. +- variates skill: multivariate=0.3579, univariate=0.3541. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_candidate at3000, backcast_evals +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.67229199409485 seconds. +- Overall skill 0.334545; relative MASE 0.799017; relative WQL 0.554218. +- term skill: long=0.3960, medium=0.3575, short=0.3001. +- domain skill: Econ/Fin=0.1631, Energy=0.2272, Healthcare=0.4091, Nature=0.3627, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4460. +- frequency skill: A=0.3254, D=0.3486, H=0.3640, M=0.1918, Q=0.2328, S=0.3383, T=0.3328, W=0.2870. +- variates skill: multivariate=0.3502, univariate=0.3218. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_candidate at3000, backcast2_evals +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.532593488693237 seconds. +- Overall skill 0.356065; relative MASE 0.774672; relative WQL 0.535261. +- term skill: long=0.3639, medium=0.3845, short=0.3418. +- domain skill: Econ/Fin=0.1127, Energy=0.2321, Healthcare=0.3474, Nature=0.4679, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4274. +- frequency skill: A=0.3556, D=0.4256, H=0.3883, M=0.1532, Q=0.1527, S=0.2764, T=0.3550, W=0.2576. +- variates skill: multivariate=0.3584, univariate=0.3541. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E63 corpus expansion at 146M capacity +Hypothesis: E38's larger packed corpus did not improve the 37M model over 12,000 continuation steps, but a larger model with a longer schedule may benefit from the additional diversity. Add one matched data arm to E58: the same 146M initialization and optimization, using packed_expanded instead of packed_sample. The already-running E58 146M arm is the control; it is not retrained. +- Both packs contain the same 95 allow-listed directories. Source probabilities are read from packed_sample in both arms, so this changes within-source diversity rather than source balance. The expanded pack contains 5,653,290,832 points versus 958,745,103 in the control. No new generator or external source. +- Same own wide_capacity_initial checkpoint, seed 113, B96, 32,000 steps, base LR 0.00003, matched width-dependent AdamW groups, independently sign-augmented loss and EMA. Same runtime and batch64 for validation. All parameters train. +- First verify that the new loader reproduces the control's sampler exactly when given the control pack, and that expanded source probabilities match. The model and maximum tensor shapes are unchanged from the measured E58 memory fixture. +- Start after E60 adapter jobs stop. Compare checkpoints at 4000/8000/16000/24000/32000; evaluate earlier cutoffs before selection. This explicitly tests the interaction of corpus diversity and capacity, rather than repeating the small-model data comparison. No outcome yet. + +E63 checks passed: {"cpu_seconds": 6.780377898016013, "control_sampler_bitwise_equal": true, "source_probabilities_identical": true, "optimizer_updates": 0, "initial_checkpoint_sha256": "c3d41b52987eb033dcc60b4cd59e13e8adb75e319fe5f5bc043296faaac04849"} + +E60 joint_filtered_control stopped: {"final_step": 4691, "final_checkpoint": "/workspace/research/runs/joint_filtered_control/ema004691.pt", "checkpoint_sha256": "8d48a377b49cfd980a973aa9505565a537ed69c27c621ccf39b19d5787fb720b", "last_logged_training_seconds": 592.3, "last_logged_step": 4650, "all_original_tensors_bitwise_unchanged": true, "reason": "Both earlier cutoffs regress at3000 by more than the main gain; negative branch pruned."} + +E60 joint_filtered_candidate stopped: {"final_step": 4648, "final_checkpoint": "/workspace/research/runs/joint_filtered_candidate/ema004648.pt", "checkpoint_sha256": "1574e71b8877b5620a5929a55df22347c9475184194dec37ccb38c0eb71ed9c8", "last_logged_training_seconds": 590.2, "last_logged_step": 4600, "all_original_tensors_bitwise_unchanged": true, "reason": "Both earlier cutoffs regress at3000 by more than the main gain; negative branch pruned."} + +## E52 varied requested horizons final12000 +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.63369631767273 seconds. +- Overall skill 0.362379; relative MASE 0.760035; relative WQL 0.534923. +- term skill: long=0.3913, medium=0.4055, short=0.3334. +- domain skill: Econ/Fin=0.1099, Energy=0.1916, Healthcare=0.4150, Nature=0.4272, Sales=0.3410, Transport=0.4599, Web/CloudOps=0.5083. +- frequency skill: A=0.3715, D=0.3433, H=0.3828, M=0.1086, Q=0.1994, S=0.4416, T=0.4075, W=0.2138. +- variates skill: multivariate=0.3960, univariate=0.3343. +- Outcome: Completed in3887.5 training-loop seconds (3897.218 process seconds). Main improves versus matched E42; inspect both earlier cutoffs and E62 transfer. + +## E52 final12000 first earlier cutoff +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 19.096883296966553 seconds. +- Overall skill 0.331566; relative MASE 0.804478; relative WQL 0.555396. +- term skill: long=0.3906, medium=0.3563, short=0.2975. +- domain skill: Econ/Fin=0.1463, Energy=0.2302, Healthcare=0.4120, Nature=0.3520, Sales=0.3984, Transport=0.3650, Web/CloudOps=0.4442. +- frequency skill: A=0.3138, D=0.3562, H=0.3588, M=0.1622, Q=0.2341, S=0.3415, T=0.3316, W=0.2747. +- variates skill: multivariate=0.3480, univariate=0.3182. +- Outcome: Improves over E42 by0.000492. + +## E52 final12000 second earlier cutoff +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 18.59932589530945 seconds. +- Overall skill 0.353232; relative MASE 0.776549; relative WQL 0.538676. +- term skill: long=0.3692, medium=0.3768, short=0.3380. +- domain skill: Econ/Fin=0.0898, Energy=0.2297, Healthcare=0.3632, Nature=0.4567, Sales=0.5538, Transport=0.4144, Web/CloudOps=0.4314. +- frequency skill: A=0.3506, D=0.4238, H=0.3876, M=0.1727, Q=0.1527, S=0.2824, T=0.3479, W=0.2436. +- variates skill: multivariate=0.3614, univariate=0.3466. +- Outcome: Improves over E42 by0.000136. The final horizon variation treatment improves all three matched screening windows. + +## E62 transferred horizon correction main screen +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.18038821220398 seconds. +- Overall skill 0.377343; relative MASE 0.744367; relative WQL 0.520847. +- term skill: long=0.3993, medium=0.4068, short=0.3570. +- domain skill: Econ/Fin=0.1398, Energy=0.2376, Healthcare=0.4513, Nature=0.4321, Sales=0.3339, Transport=0.4661, Web/CloudOps=0.4995. +- frequency skill: A=0.3721, D=0.3559, H=0.3958, M=0.1049, Q=0.1994, S=0.4226, T=0.4360, W=0.2230. +- variates skill: multivariate=0.3942, univariate=0.3636. +- Outcome: Main gain0.001387 over E55. CPU composition1.266 seconds; await both earlier-cutoff checks before full validation. + +## E62 transferred horizon correction first earlier cutoff +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.59067988395691 seconds. +- Overall skill 0.336227; relative MASE 0.797258; relative WQL 0.552638. +- term skill: long=0.3980, medium=0.3585, short=0.3020. +- domain skill: Econ/Fin=0.1632, Energy=0.2299, Healthcare=0.4035, Nature=0.3641, Sales=0.3973, Transport=0.3720, Web/CloudOps=0.4497. +- frequency skill: A=0.3264, D=0.3494, H=0.3653, M=0.1894, Q=0.2332, S=0.3419, T=0.3364, W=0.2851. +- variates skill: multivariate=0.3539, univariate=0.3218. +- Outcome: Improves over E55 by0.000618 and current E59 ensemble by0.000525; second earlier cutoff pending. + +## E64 replace the horizon-corrected member in the fixed equal-weight ensemble +Hypothesis: E62 improves all three windows against E55, but the current E59 ensemble remains stronger at the second earlier cutoff. Replace only member0 of E59 with E62 and retain the amplitude-trained member1, applying the same equal quantile average after each member's fixed rules. No new weights, training, blend coefficient or postprocessing is introduced. Every member still forecasts every instance. +- Use cached forecasts first on the main screen and both earlier cutoffs. Compare the candidate ensemble with E62 alone and E59. Validate the actual package if the composition offers a useful improvement. + +## E62 transferred horizon correction second earlier cutoff +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.85834312438965 seconds. +- Overall skill 0.357693; relative MASE 0.772232; relative WQL 0.534241. +- term skill: long=0.3647, medium=0.3858, short=0.3439. +- domain skill: Econ/Fin=0.1095, Energy=0.2360, Healthcare=0.3457, Nature=0.4673, Sales=0.5494, Transport=0.4200, Web/CloudOps=0.4312. +- frequency skill: A=0.3533, D=0.4246, H=0.3905, M=0.1533, Q=0.1508, S=0.2809, T=0.3574, W=0.2594. +- variates skill: multivariate=0.3632, univariate=0.3532. +- Outcome: Improves over E55 by0.000222. All three screening windows improve against the single-model parent; E59 still leads at this cutoff. Proceed to full validation and the fixed E64 ensemble comparison. + +E64 member checkpoint hashes: 22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb. + +E64 cached screen: skill 0.376788946; relative MASE 0.745126449; relative WQL 0.521243098; CPU elapsed 4.12 seconds. Group skill: {"term": {"short": 0.3554964007817075, "medium": 0.4073693459600539, "long": 0.3998307241854733}, "domain": {"Econ/Fin": 0.14130300023652653, "Energy": 0.2369496172656066, "Healthcare": 0.4331271903068751, "Nature": 0.4295973732895463, "Sales": 0.3381125790990753, "Transport": 0.4660477929672022, "Web/CloudOps": 0.5028903628931379}, "freq": {"A-DEC": 0.37465521703273497, "Q-DEC": 0.20133386157730448, "M": 0.09799796329514798, "W-SUN": 0.09310304137899561, "D": 0.35177652554445227, "H": 0.39569724381500315, "15T": 0.21510285937582785, "W-FRI": -0.01717810068114023, "10T": 0.6134978939570246, "W-TUE": 0.5590219029222432, "W-THU": 0.20713023925638596, "W-WED": 0.3147893218102069, "5T": 0.5146554293758923, "10S": 0.42304338912946016}}. + +E64 cached backcast: skill 0.336038010; relative MASE 0.797789283; relative WQL 0.552583914; CPU elapsed 3.90 seconds. Group skill: {"term": {"short": 0.3017705847743448, "medium": 0.3583628431586988, "long": 0.3977762964359516}, "domain": {"Econ/Fin": 0.16247452271830498, "Energy": 0.22924210402608347, "Healthcare": 0.4037429866174578, "Nature": 0.3634291235876055, "Sales": 0.3979195783227222, "Transport": 0.3717322673047254, "Web/CloudOps": 0.45027750430374125}, "freq": {"A-DEC": 0.31962125220900417, "Q-DEC": 0.23151630865404227, "M": 0.19676862244049742, "W-SUN": 0.04104954385433246, "D": 0.3494141749986718, "H": 0.36512969667883677, "15T": 0.22647340624655954, "W-FRI": 0.26044659511767176, "10T": 0.3206375756185784, "W-TUE": 0.5251272756681418, "W-THU": 0.23336875275806457, "W-WED": 0.34380336710053805, "5T": 0.4388723441407405, "10S": 0.34124569112919356}}. + +E64 cached backcast2: skill 0.358773194; relative MASE 0.771487726; relative WQL 0.532959635; CPU elapsed 3.84 seconds. Group skill: {"term": {"short": 0.3455453575305818, "medium": 0.3850562697420571, "long": 0.3662794409758179}, "domain": {"Econ/Fin": 0.11178929070509958, "Energy": 0.2358139051710867, "Healthcare": 0.3485087569088834, "Nature": 0.46931745466541086, "Sales": 0.5520970513032182, "Transport": 0.4203697870790297, "Web/CloudOps": 0.4324624263189104}, "freq": {"A-DEC": 0.3552674881858966, "Q-DEC": 0.15052699940899794, "M": 0.14543941174604302, "W-SUN": 0.05780563284435891, "D": 0.4280091613762501, "H": 0.39053406736994467, "15T": 0.10558086695082369, "W-FRI": 0.14677601366514947, "10T": 0.4931102944101511, "W-TUE": 0.10259191794259981, "W-THU": 0.32777977287160787, "W-WED": 0.5368109233756173, "5T": 0.46691593361082795, "10S": 0.2842010268357835}}. + +E64 improves over current E59 on all three cutoffs. Versus E62 alone, it trails on the main screen and first earlier cutoff but gains at the second. Both complete packages will receive full validation; the current root remains E59 until that comparison and determinism checks finish. + +E64 actual package matches the cached equal-weight composition bitwise for every quantile in all 97 screening configurations. Proceed to exact full-package validation. + +## E65 recent normalization with an 8192-point encoder context +Hypothesis: adding older history changes the normalization reference as well as supplying extra observations. E54's final8192 model scores0.375118 versus its matched4096 control0.375764. Test whether retaining the recent4096 mean and standard deviation makes older context easier to use. The encoder still receives all8192 points; every point and future target uses the recent reference frame. If the recent segment has no finite observations, fall back to the full available context. +- Change only normalization. Same E54 initialization from own recency24000, seed101, matched packed_sample windows, B128, LR0.00003,12000 steps, maximum context8192 and sample context8192. Contexts of at most4096 retain the original formula. Fixed inference corrections still see only4096 observations. The existing E54 long-context run is the control. No new sources or generators. +- Training-data diagnostic: 256 real allowed-corpus windows, seed151;101 had sufficient older and recent history. Full/recent standard-deviation ratio p10/p50/p90 was0.932/1.003/1.255; absolute mean shift in recent standard deviations was0.0068/0.0512/0.4089. This motivates testing the frame, without establishing it as the cause of the regression. Diagnostic CPU time1.90 seconds; no validation data used. +- Verify exact equivalence for contexts at most4096 and finite fallback behavior before launch. Check main screens at3000/6000/12000 and earlier cutoffs before selection. No outcome yet. + +E65 checks passed: {"cpu_seconds": 0.7186618210980669, "short_context_normalization_bitwise_equal": true, "short_context_forecast_bitwise_equal": true, "recent_reference_and_empty_recent_fallback_verified": true, "all_missing_finite": true, "optimizer_updates": 0} + +## E62 exact full-package validation +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.373420; relative MASE 0.747096; relative WQL 0.525505. +- term skill: long=0.3931, medium=0.4057, short=0.3528. +- domain skill: Econ/Fin=0.1173, Energy=0.2305, Healthcare=0.4574, Nature=0.4321, Sales=0.3479, Transport=0.4663, Web/CloudOps=0.4919. +- frequency skill: A=0.2918, D=0.3600, H=0.3910, M=0.1281, Q=0.1853, S=0.4226, T=0.4289, W=0.2156. +- variates skill: multivariate=0.3899, univariate=0.3600. +- Outcome: Full skill0.373420 versus E59 published0.372254. All97 configurations and151170 instances pass; no quantile crossings. Actual inference116.659 seconds. Await E64 full comparison and relocation/determinism before choosing the next publication. + +## E54 context8192 final12000 +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.50181746482849 seconds. +- Overall skill 0.375118; relative MASE 0.744591; relative WQL 0.524419. +- term skill: long=0.4042, medium=0.4057, short=0.3513. +- domain skill: Econ/Fin=0.1426, Energy=0.2337, Healthcare=0.4381, Nature=0.4222, Sales=0.3378, Transport=0.4707, Web/CloudOps=0.5001. +- frequency skill: A=0.3749, D=0.3573, H=0.3955, M=0.0779, Q=0.2010, S=0.4259, T=0.4332, W=0.2127. +- variates skill: multivariate=0.3910, univariate=0.3622. +- Outcome: Finished in3285.3 training-loop seconds (3296.255 process seconds). Main skill0.375118 remains below matched4096 control0.375764. Do not select this checkpoint; E65 isolates the normalization-frame hypothesis. + +## E58 widened146M at8000 +- Checkpoint SHA-256: `822fdf9f16fb741ab5e23728ad13cac2838a70ad4cfa23a191c9373294a6b4d5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.286028146743774 seconds. +- Overall skill 0.374330; relative MASE 0.747410; relative WQL 0.523759. +- term skill: long=0.3993, medium=0.4074, short=0.3512. +- domain skill: Econ/Fin=0.1416, Energy=0.2364, Healthcare=0.4073, Nature=0.4301, Sales=0.3397, Transport=0.4652, Web/CloudOps=0.4995. +- frequency skill: A=0.3799, D=0.3459, H=0.3958, M=0.0911, Q=0.2002, S=0.4225, T=0.4364, W=0.2039. +- variates skill: multivariate=0.3933, univariate=0.3588. +- Outcome: Main skill0.374330 versus matched37M0.374665, reversing the small4000-step advantage. Both remain below initialization. Continue the prespecified32000-step capacity comparison; no capacity conclusion or package change yet. + +## E64 exact full-package validation after operator recovery +- Checkpoint SHA-256: `35306ec57b81c42e8fbdfab14adc96293400eee0dbd808fadbb3c973f9ff427e`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372871; relative MASE 0.747913; relative WQL 0.525850. +- term skill: long=0.3938, medium=0.4063, short=0.3513. +- domain skill: Econ/Fin=0.1184, Energy=0.2299, Healthcare=0.4400, Nature=0.4295, Sales=0.3508, Transport=0.4663, Web/CloudOps=0.4954. +- frequency skill: A=0.2911, D=0.3562, H=0.3909, M=0.1203, Q=0.1862, S=0.4230, T=0.4309, W=0.2097. +- variates skill: multivariate=0.3912, univariate=0.3579. +- Outcome: Full skill0.372871 beats E59 but trails E62 single0.373420. Both pass relocation/determinism. Select E62 single, retaining E64 as a replayable alternative. E64 full inference79.236 seconds on an otherwise idle H100; do not compare that timing directly with concurrent-training measurements. + +## Operator interruption and recovery, 2026-10-22 +All previous container processes were confirmed ended; the H100 was idle. No credentials were inspected. Completed reports and atomic checkpoints were retained. E64 full validation was rerun because no completed report survived. Both E62 and E64 passed asset hashes and independent relocation: [ + { + "package": "/run-state/workspace/research/candidate-horizon-delta12k", + "checkpoint_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "configurations": 3, + "bitwise_equal_after_relocation": true, + "finite_and_monotone": true, + "seconds": 6.016964558046311 + }, + { + "package": "/run-state/workspace/research/candidate-horizon-ensemble", + "checkpoint_sha256": "35306ec57b81c42e8fbdfab14adc96293400eee0dbd808fadbb3c973f9ff427e", + "configurations": 3, + "bitwise_equal_after_relocation": true, + "finite_and_monotone": true, + "seconds": 6.803807514021173 + } +] + + +Publication decision: E62 single has the highest exact full-validation skill among replayed candidates (0.373419858), improves all three screening cutoffs versus E55, and wins the main screen and first earlier cutoff against E64. E64 retains a second-earlier-cutoff advantage but is lower on full validation. Publish E62 with complete runtime, all own-checkpoint lineage, generator code, pinned requirements, this experiment log and the full report. Scores remain on the validation scale, not the held-out reward scale. + +## E66 matched recovery of interrupted research runs +The operator interruption ended all trainers. E58 146M had step/EMA8000, while its37M control also had12000; neither had Adam or sampler state. Both arms restart from their own step8000 and EMA8000, preserving a common comparison point. Fresh AdamW and a shared new sampler seed179 begin at global step8001, with400-step rewarmup and the original cosine schedule through32000. This is a documented matched continuation, not an exact resumption of the old optimizer trajectory. Existing control12000 is retained but is not the recovered comparison control. +- E63 expanded146M had only initialization saved, so it restarts from its own initial checkpoint with original seed113. It will receive the identical optimizer/stream reset at global8000 to match E58 recovery. E61 slow-memory and E65 recent normalization had no completed checkpoints, so they restart from their declared parent, original seeds and settings. No baseline or completed scientific comparison is retrained. +- New driver saves weights, EMA, optimizer, CPU/CUDA RNG, sampler and batch RNG states, and the prefetched next batch atomically every1000 steps. Independent interrupted/continuous fixture: {"seed": 191, "steps": 4, "batch": 2, "fixture_parameters": 164384, "purpose": "recovery fixture only; never selected", "maximum_model_difference": 1.2101430968414206e-14, "maximum_ema_difference": 2.4147350785597155e-15, "maximum_optimizer_difference": 7.095019016745141e-16, "rng_and_prefetched_batch_bitwise_equal": true, "note": "Complete state restored; GPU training replay differs by floating-point roundoff, so training replay is not claimed bitwise identical. Package inference checks are separately bitwise."}. Four optimizer updates per fixture path used only permitted data; fixture weights are never candidates. +- Work lost after the last usable checkpoints: E58 large at least800 steps, control at least1550 beyond its latest12000 (the matched restart also intentionally returns to8000); E63 at least1700; E61 at least2150; E65 at least300. Last logged elapsed times before interruption:2432.6,2101.5,388.0,542.2,71.8 seconds respectively. These are concurrent process times, not summed exclusive GPU time. + +## E67 end-to-end paired-sign training on the selected horizon-corrected model +Hypothesis: E50 updated only the output head and did not sustain a paired-loss gain. The full encoder/decoder may be able to learn complementary sign-orientation forecasts when optimized through the exact neural average used in inference. Compare two full-model continuations from own E62: both forward x and -x, but the control scores each orientation separately while the candidate scores their ordered-quantile average. This changes the loss, not the sampled windows, number of forward passes, architecture or inference. +- Both arms retain E52 random requested-horizon prefixes and E42 partial-target future-key masking, now integrated with the selected confidence features. At inference the requested horizon is fully available and the forward pass must remain bitwise identical at initialization to E62. +- Own parent horizon_delta12k.pt (SHA-25622c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c); seed197, independent horizon seed300200, packed_sample95 allowed sources and the same local generator, B64 distinct windows /128 signed rows, LR0.00002,12000 steps, all parameters train. Same warmup400 and cosine schedule. Every runtime member forecasts every instance; no validation data are used for gradients. +- Check initialization identity, paired-loss sign symmetry and the independence of unused future tokens. Measure maximum-shape memory before launch. Compare main and both earlier cutoffs; a main-only gain is insufficient. Complete recovery state includes both sampler RNGs. No outcome yet. + +E67 checks passed: { + "cpu_seconds": 3.4358641319558956, + "initial_forecast_bitwise_parent": true, + "unused_future_tokens_do_not_change_requested_prefix": true, + "paired_loss_sign_symmetric": true, + "matched_sampler_main_and_horizon_rng": true, + "gpu_fixture_seconds": 3.137407455011271, + "allocated_mib": 5783.81689453125, + "reserved_mib": 6266.0, + "optimizer_updates": 0 +}. Current allocated/reserved process footprint fits both additional paired arms within the single80GB H100. Each new arm uses about6.3GiB reserved at maximum shape. + +## E68 fixed upward quantile-level shift +Hypothesis: E62 coverage diagnostics show upper-tail underprediction in several groups, while lower-tail excess inclusive coverage is largely due to ties at exact zero. Test one globally fixed quantile-function shift from level p to p+0.025, linearly interpolating between adjacent predicted deciles and extrapolating the uppermost interval. This is equivalent to75% of q(p)+25% of q(p+0.1), with upper-end linear extrapolation. It shifts the median as well as intervals. No dataset-specific parameters, context optimization, new training or weight fitting. +- Apply after the existing fixed rules. Monotonicity and nonnegative quantiles for nonnegative histories are preserved by upward interpolation/extrapolation. Compare only unchanged and the predeclared+0.025 setting on the main screen and both earlier cutoffs. No coefficient sweep. +- Descriptive coverage files horizon_delta_calibration_bounds.json and calibration_diagnostic.py retain strict/inclusive tie bounds. Parent weights SHA-25622c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c. No outcome yet. + +E68 screen, CPU elapsed2.34 seconds: +- unchanged: skill0.377343216, relative MASE0.744366865, relative WQL0.520847298; group skill {"term": {"short": 0.35695456496017197, "medium": 0.4068421174843613, "long": 0.3992704749750494}, "domain": {"Econ/Fin": 0.1398359119561744, "Energy": 0.23759505750828103, "Healthcare": 0.4512562626750727, "Nature": 0.4321373180939323, "Sales": 0.33393397659338675, "Transport": 0.46608088355848554, "Web/CloudOps": 0.49950488336015364}, "freq": {"A-DEC": 0.37212708500173697, "Q-DEC": 0.19935115627243538, "M": 0.10494660003314427, "W-SUN": 0.09001322152715163, "D": 0.355915177294738, "H": 0.39579077444245214, "15T": 0.214120657226064, "W-FRI": -0.015604695485733178, "10T": 0.6146535484250835, "W-TUE": 0.5792731324380282, "W-THU": 0.21095087378926547, "W-WED": 0.3154347093297968, "5T": 0.5103163560669302, "10S": 0.42256110774455713}}. +- shift_up_0025: skill0.376908525, relative MASE0.742757759, relative WQL0.522704720; group skill {"term": {"short": 0.3566597008609087, "medium": 0.404403536500499, "long": 0.4005186267241073}, "domain": {"Econ/Fin": 0.14287974364263867, "Energy": 0.23414603173384185, "Healthcare": 0.43949354133666974, "Nature": 0.4298630701436009, "Sales": 0.32658918319903174, "Transport": 0.470151191104459, "Web/CloudOps": 0.5032582354135502}, "freq": {"A-DEC": 0.380333567897149, "Q-DEC": 0.20181706747540706, "M": 0.08925268144424381, "W-SUN": 0.07477217948655135, "D": 0.35474663372376547, "H": 0.3940149463382252, "15T": 0.21958831724211048, "W-FRI": -0.0580596428780249, "10T": 0.6129399194069542, "W-TUE": 0.5699015681127257, "W-THU": 0.21136203731846115, "W-WED": 0.3102694893262884, "5T": 0.5147323912192434, "10S": 0.4303777414462714}}. + +E68 backcast, CPU elapsed2.34 seconds: +- unchanged: skill0.336227035, relative MASE0.797257690, relative WQL0.552637565; group skill {"term": {"short": 0.3019534316321959, "medium": 0.35847999416902554, "long": 0.3980452217736976}, "domain": {"Econ/Fin": 0.16321936365108436, "Energy": 0.22989895953120598, "Healthcare": 0.4035339334978575, "Nature": 0.3640809439324144, "Sales": 0.39727796653561065, "Transport": 0.37202575172526886, "Web/CloudOps": 0.4496899590670599}, "freq": {"A-DEC": 0.32642568966436736, "Q-DEC": 0.23316387018660967, "M": 0.18942546327646903, "W-SUN": 0.03722616253430944, "D": 0.3493567465552936, "H": 0.3653486861566616, "15T": 0.22544143675041628, "W-FRI": 0.2612228517292393, "10T": 0.32002639781339237, "W-TUE": 0.5369423215086733, "W-THU": 0.24695593621438172, "W-WED": 0.34366857690318564, "5T": 0.43841920169431536, "10S": 0.34189056734107803}}. +- shift_up_0025: skill0.333181127, relative MASE0.800191338, relative WQL0.555676359; group skill {"term": {"short": 0.30012284957976143, "medium": 0.3563718754867885, "long": 0.3913827408796766}, "domain": {"Econ/Fin": 0.16216091726465265, "Energy": 0.22830088335034404, "Healthcare": 0.4226177811841181, "Nature": 0.3541417493195709, "Sales": 0.38842247511482564, "Transport": 0.3660239875770892, "Web/CloudOps": 0.4469561601104274}, "freq": {"A-DEC": 0.3265608246880194, "Q-DEC": 0.22474554051269913, "M": 0.18267190809841738, "W-SUN": 0.03302751086137623, "D": 0.35103471245845674, "H": 0.36176195029219793, "15T": 0.21821690985575604, "W-FRI": 0.25908813449545354, "10T": 0.3119130318041733, "W-TUE": 0.5410511096762922, "W-THU": 0.24171213296902283, "W-WED": 0.34305917574568634, "5T": 0.43719448871859334, "10S": 0.33922568556395327}}. + +E68 backcast2, CPU elapsed2.31 seconds: +- unchanged: skill0.357693384, relative MASE0.772231694, relative WQL0.534240944; group skill {"term": {"short": 0.34387576099815587, "medium": 0.38579809375160923, "long": 0.36474587566145333}, "domain": {"Econ/Fin": 0.10948663145426041, "Energy": 0.23595983020029976, "Healthcare": 0.3456833197210143, "Nature": 0.4672524394882832, "Sales": 0.5493882044206345, "Transport": 0.4200285125423293, "Web/CloudOps": 0.4311910731987415}, "freq": {"A-DEC": 0.3532937085689807, "Q-DEC": 0.15079546315571057, "M": 0.15334987951579737, "W-SUN": 0.053222430353438654, "D": 0.42461678912892176, "H": 0.39045164404809307, "15T": 0.1063009642103484, "W-FRI": 0.14702837959358672, "10T": 0.4925745835795794, "W-TUE": 0.10051793538767262, "W-THU": 0.31968494040001116, "W-WED": 0.5361596335033245, "5T": 0.4655530740312157, "10S": 0.280869499353007}}. +- shift_up_0025: skill0.352929872, relative MASE0.775985000, relative WQL0.539571964; group skill {"term": {"short": 0.3397486152051552, "medium": 0.38072074318949967, "long": 0.3585956199908913}, "domain": {"Econ/Fin": 0.10581887733310036, "Energy": 0.23338234809030112, "Healthcare": 0.3418028155977272, "Nature": 0.4611553878945821, "Sales": 0.543948848409417, "Transport": 0.4138948091247504, "Web/CloudOps": 0.42581951888726777}, "freq": {"A-DEC": 0.3525707634011239, "Q-DEC": 0.14006676676474916, "M": 0.14537682622646142, "W-SUN": 0.05718515322639861, "D": 0.42470757896302946, "H": 0.38580382383546696, "15T": 0.0967294266428953, "W-FRI": 0.16016050379952163, "10T": 0.4943536981461871, "W-TUE": 0.05512451342569891, "W-THU": 0.29480125149705005, "W-WED": 0.5302395339818361, "5T": 0.4614399225720033, "10S": 0.2693556274034984}}. + +E68 rejected: the fixed upward quantile shift loses on all three windows, including -0.00305 and -0.00476 at the earlier cutoffs. Main median MASE improves slightly but WQL worsens. Descriptive coverage imbalance does not justify a global quantile shift. Retain E62 quantiles unchanged; no further coefficient sweep. + +## E69 persistent stochastic volatility in synthetic training windows — prepared, not launched +Hypothesis: the local generator changes seasonal amplitude in E31 but its observation-noise scale stays constant throughout a window. Teach conditional uncertainty under persistent volatility by multiplying the Gaussian/AR noise component by an independent positive log-OU curve in half of synthetic windows. Leave signal, AR coefficient, observation-noise draws, real windows and the main RNG unchanged. +- Proposed matched reference: completed E42 partial-target training. Same own recency12000 parent, seed79, packed_sample, B256, LR0.00005,12000 steps and original schedule. Only the noise envelope differs; no architecture or inference change. +- Independent generator seed500082; log time constant uniform1.5..3.5 (about32..3162 steps), log standard deviation uniform0.1..0.8, stationary Gaussian initial log state, exp(logcurve-0.5*sd^2), log envelope clipped[-2.5,2.5]. Synthetic fraction remains0.2, so roughly10% of all windows receive the new envelope. +- Verify real-window and main-RNG equality before launch. Queue only when a GPU allocation is released; no training has started. Final selection requires main and both earlier-cutoff evidence. + +E69 preparation checks: {"cpu_seconds": 4.379837638000026, "main_rng_matched": true, "real_windows_unchanged": true, "periods_and_missing_masks_unchanged": true, "changed_synthetic_context_values": 52057, "optimizer_updates": 0} + +## E67 full_paired_control at1000 +- Checkpoint SHA-256: `0aa7ece151109e13af73e7ca2d6b75baa95e67898a6273a081ed38e92cfc63cd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.88213801383972 seconds. +- Overall skill 0.376434; relative MASE 0.745243; relative WQL 0.521755. +- term skill: long=0.3984, medium=0.4065, short=0.3558. +- domain skill: Econ/Fin=0.1332, Energy=0.2361, Healthcare=0.4573, Nature=0.4305, Sales=0.3351, Transport=0.4660, Web/CloudOps=0.4983. +- frequency skill: A=0.3675, D=0.3539, H=0.3948, M=0.1051, Q=0.1982, S=0.4219, T=0.4350, W=0.2252. +- variates skill: multivariate=0.3925, univariate=0.3634. +- Outcome: Paired objective leads the matched individual-orientation control by0.000426, but both trail the frozen E62 parent0.377343. Continue to3000 before interpreting the early optimization drop. + +## E67 full_paired_candidate at1000 +- Checkpoint SHA-256: `256329643ba1d7074386d227f4dafd6bdbf0faca5bf2280a60be51ddf2ad90ee`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.336730480194092 seconds. +- Overall skill 0.376860; relative MASE 0.744723; relative WQL 0.521407. +- term skill: long=0.3991, medium=0.4063, short=0.3564. +- domain skill: Econ/Fin=0.1316, Energy=0.2364, Healthcare=0.4620, Nature=0.4301, Sales=0.3350, Transport=0.4669, Web/CloudOps=0.4985. +- frequency skill: A=0.3655, D=0.3560, H=0.3951, M=0.1058, Q=0.1980, S=0.4230, T=0.4348, W=0.2256. +- variates skill: multivariate=0.3926, univariate=0.3640. +- Outcome: Paired objective leads the matched individual-orientation control by0.000426, but both trail the frozen E62 parent0.377343. Continue to3000 before interpreting the early optimization drop. + +Additional historical diagnostic: valid_backcast3 contains93 configurations and8812 instances, derived only from existing validation histories. This cutoff was not used in earlier selection. Compare E62 and its E55 predecessor, plus the fixed amplitude ensemble option; all outputs are selection/diagnostics only. Scales use capped prefixes and its own Seasonal Naive baseline. + +## Previously unused third earlier cutoff: horizon_delta12k +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.37537980079651 seconds. +- Overall skill 0.387789; relative MASE 0.738165; relative WQL 0.507749. +- term skill: long=0.3944, medium=0.3602, short=0.3954. +- domain skill: Econ/Fin=0.1725, Energy=0.3191, Healthcare=0.2442, Nature=0.5053, Sales=0.3990, Transport=0.5060, Web/CloudOps=0.3880. +- frequency skill: A=0.3565, D=0.4418, H=0.4032, M=0.1118, Q=0.2628, S=0.2833, T=0.4297, W=0.2606. +- variates skill: multivariate=0.3722, univariate=0.3998. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +## Previously unused third earlier cutoff: partial_delta12k +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.088595867156982 seconds. +- Overall skill 0.387664; relative MASE 0.738315; relative WQL 0.507852. +- term skill: long=0.3943, medium=0.3601, short=0.3953. +- domain skill: Econ/Fin=0.1728, Energy=0.3188, Healthcare=0.2482, Nature=0.5065, Sales=0.3984, Transport=0.5041, Web/CloudOps=0.3876. +- frequency skill: A=0.3519, D=0.4408, H=0.4034, M=0.1157, Q=0.2629, S=0.2853, T=0.4287, W=0.2628. +- variates skill: multivariate=0.3721, univariate=0.3997. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +## Previously unused third earlier cutoff: amplitude_fixed_ema24000 +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 24.98914361000061 seconds. +- Overall skill 0.386555; relative MASE 0.740761; relative WQL 0.508011. +- term skill: long=0.3906, medium=0.3617, short=0.3941. +- domain skill: Econ/Fin=0.1763, Energy=0.3186, Healthcare=0.2144, Nature=0.5055, Sales=0.3950, Transport=0.5054, Web/CloudOps=0.3892. +- frequency skill: A=0.3670, D=0.4397, H=0.4032, M=0.1018, Q=0.2609, S=0.2818, T=0.4298, W=0.2517. +- variates skill: multivariate=0.3715, univariate=0.3982. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +Third earlier cutoff, fixed horizon+amplitude ensemble: skill0.387712467, relative MASE0.738747107, relative WQL0.507475454; CPU1.61 seconds; group skill {"term": {"short": 0.3954701763614715, "medium": 0.36122355126648487, "long": 0.39279890497296066}, "domain": {"Econ/Fin": 0.1751736307959596, "Energy": 0.31921698125326037, "Healthcare": 0.23298033105692906, "Nature": 0.5060089627880903, "Sales": 0.3975145877969797, "Transport": 0.5058849307923443, "Web/CloudOps": 0.3889682376441502}, "freq": {"A-DEC": 0.3624040337196054, "Q-DEC": 0.2624518143609271, "M": 0.10707417310085743, "W-SUN": 0.1583361093273692, "D": 0.4418985852875217, "H": 0.403440739007801, "15T": 0.2601635557329961, "W-FRI": 0.014090974305712378, "10T": 0.6023775368816131, "W-TUE": 0.24266767576389037, "W-THU": 0.3814500446358562, "W-WED": 0.36993536616236844, "5T": 0.4629495965892555, "10S": 0.28289459770032044}}. + +Third earlier cutoff, fixed partial+amplitude ensemble: skill0.387583102, relative MASE0.738907219, relative WQL0.507579906; CPU1.63 seconds; group skill {"term": {"short": 0.39530402146176624, "medium": 0.36114921433277336, "long": 0.39271964935249504}, "domain": {"Econ/Fin": 0.17527256907786126, "Energy": 0.31900374729462777, "Healthcare": 0.23531552352603602, "Nature": 0.5063494545833882, "Sales": 0.3972024195554572, "Transport": 0.5049447049689553, "Web/CloudOps": 0.3887045854899489}, "freq": {"A-DEC": 0.36012619804016577, "Q-DEC": 0.2622822707122595, "M": 0.10906468169471106, "W-SUN": 0.15682778156902044, "D": 0.44126848409451547, "H": 0.4035052878161369, "15T": 0.26032721770481526, "W-FRI": 0.011894162492874005, "10T": 0.6016201297891219, "W-TUE": 0.2491326450741952, "W-THU": 0.38350286292612645, "W-WED": 0.3695417432322957, "5T": 0.4619676858363392, "10S": 0.2838781358710065}}. + +The new historical check does not overturn the publication: E62 beats E55 individually at this fourth available window, while the fixed ensemble comparison remains a documented alternative. Full validation and main screening still favor the published single model. + +## E70 training-only compiler throughput diagnostic +Hypothesis: operator/kernel overhead limits the many small transformer operations on one H100. Benchmark torch.compile on the existing own E62 model and unpaired training loss, using64 permitted pretraining windows of context2048/horizon512, seed223. No optimizer updates; no validation examples; no compiler change to the published runtime. Compare eager and compiled loss, gradient direction and absolute differences, then alternate20-step forward/backward timing blocks three times under the existing shared-GPU load. Compilation uses two CPU workers. Any numerical or performance difference is recorded before considering a separate training experiment. No outcome yet. + +## E58/E66 recovered37M control at global12000 +- Checkpoint SHA-256: `5341c5600f5fd3f82a33a9a756ce30ee980973e90c0163455ea2ce545601b051`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.337642669677734 seconds. +- Overall skill 0.374083; relative MASE 0.747749; relative WQL 0.523935. +- term skill: long=0.3989, medium=0.4070, short=0.3511. +- domain skill: Econ/Fin=0.1395, Energy=0.2360, Healthcare=0.4006, Nature=0.4331, Sales=0.3401, Transport=0.4656, Web/CloudOps=0.4984. +- frequency skill: A=0.3744, D=0.3455, H=0.3952, M=0.0891, Q=0.1999, S=0.4216, T=0.4369, W=0.2041. +- variates skill: multivariate=0.3932, univariate=0.3585. +- Outcome: Skill0.374083, below its own8000 EMA0.374665 and initial parent0.375793. First4000 updates after the documented optimizer reset; await the matched146M result. Training losses over shared steps9550..10500 are nearly equal: large0.345200, control0.345264. + +## E67 full_paired_control at3000 +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.129313945770264 seconds. +- Overall skill 0.378018; relative MASE 0.743740; relative WQL 0.520156. +- term skill: long=0.4008, medium=0.4068, short=0.3576. +- domain skill: Econ/Fin=0.1354, Energy=0.2381, Healthcare=0.4531, Nature=0.4314, Sales=0.3329, Transport=0.4660, Web/CloudOps=0.5026. +- frequency skill: A=0.3720, D=0.3538, H=0.3970, M=0.1035, Q=0.1971, S=0.4224, T=0.4379, W=0.2235. +- variates skill: multivariate=0.3959, univariate=0.3634. +- Outcome: Both exceed the E62 main screen0.377343. Paired0.378318 leads control0.378018; check both earlier cutoffs before selection. Training continues toward6000. + +## E67 full_paired_candidate at3000 +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.954200506210327 seconds. +- Overall skill 0.378318; relative MASE 0.743356; relative WQL 0.519924. +- term skill: long=0.4020, medium=0.4066, short=0.3577. +- domain skill: Econ/Fin=0.1339, Energy=0.2391, Healthcare=0.4511, Nature=0.4303, Sales=0.3325, Transport=0.4661, Web/CloudOps=0.5042. +- frequency skill: A=0.3674, D=0.3531, H=0.3978, M=0.1030, Q=0.1972, S=0.4232, T=0.4383, W=0.2236. +- variates skill: multivariate=0.3969, univariate=0.3631. +- Outcome: Both exceed the E62 main screen0.377343. Paired0.378318 leads control0.378018; check both earlier cutoffs before selection. Training continues toward6000. + +## E67 full_paired_control_ema3000 evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.129313945770264 seconds. +- Overall skill 0.378018; relative MASE 0.743740; relative WQL 0.520156. +- term skill: long=0.4008, medium=0.4068, short=0.3576. +- domain skill: Econ/Fin=0.1354, Energy=0.2381, Healthcare=0.4531, Nature=0.4314, Sales=0.3329, Transport=0.4660, Web/CloudOps=0.5026. +- frequency skill: A=0.3720, D=0.3538, H=0.3970, M=0.1035, Q=0.1971, S=0.4224, T=0.4379, W=0.2235. +- variates skill: multivariate=0.3959, univariate=0.3634. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_control_ema3000 backcast_evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.22196912765503 seconds. +- Overall skill 0.336172; relative MASE 0.797227; relative WQL 0.552750. +- term skill: long=0.3984, medium=0.3579, short=0.3019. +- domain skill: Econ/Fin=0.1591, Energy=0.2292, Healthcare=0.4105, Nature=0.3647, Sales=0.3944, Transport=0.3718, Web/CloudOps=0.4497. +- frequency skill: A=0.3173, D=0.3530, H=0.3656, M=0.1894, Q=0.2304, S=0.3411, T=0.3359, W=0.2800. +- variates skill: multivariate=0.3535, univariate=0.3220. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_control_ema3000 backcast2_evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.114278316497803 seconds. +- Overall skill 0.357963; relative MASE 0.772252; relative WQL 0.533779. +- term skill: long=0.3643, medium=0.3867, short=0.3442. +- domain skill: Econ/Fin=0.1073, Energy=0.2363, Healthcare=0.3529, Nature=0.4659, Sales=0.5494, Transport=0.4196, Web/CloudOps=0.4322. +- frequency skill: A=0.3515, D=0.4255, H=0.3911, M=0.1494, Q=0.1504, S=0.2817, T=0.3589, W=0.2528. +- variates skill: multivariate=0.3643, univariate=0.3528. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.954200506210327 seconds. +- Overall skill 0.378318; relative MASE 0.743356; relative WQL 0.519924. +- term skill: long=0.4020, medium=0.4066, short=0.3577. +- domain skill: Econ/Fin=0.1339, Energy=0.2391, Healthcare=0.4511, Nature=0.4303, Sales=0.3325, Transport=0.4661, Web/CloudOps=0.5042. +- frequency skill: A=0.3674, D=0.3531, H=0.3978, M=0.1030, Q=0.1972, S=0.4232, T=0.4383, W=0.2236. +- variates skill: multivariate=0.3969, univariate=0.3631. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 backcast_evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.824409246444702 seconds. +- Overall skill 0.335739; relative MASE 0.797824; relative WQL 0.553058. +- term skill: long=0.3982, medium=0.3579, short=0.3012. +- domain skill: Econ/Fin=0.1554, Energy=0.2283, Healthcare=0.4138, Nature=0.3640, Sales=0.3938, Transport=0.3730, Web/CloudOps=0.4488. +- frequency skill: A=0.3126, D=0.3515, H=0.3664, M=0.1838, Q=0.2305, S=0.3411, T=0.3345, W=0.2832. +- variates skill: multivariate=0.3522, univariate=0.3223. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 backcast2_evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.085822582244873 seconds. +- Overall skill 0.358235; relative MASE 0.771602; relative WQL 0.533775. +- term skill: long=0.3637, medium=0.3876, short=0.3445. +- domain skill: Econ/Fin=0.1066, Energy=0.2361, Healthcare=0.3468, Nature=0.4694, Sales=0.5483, Transport=0.4212, Web/CloudOps=0.4313. +- frequency skill: A=0.3537, D=0.4237, H=0.3911, M=0.1509, Q=0.1498, S=0.2809, T=0.3593, W=0.2593. +- variates skill: multivariate=0.3635, univariate=0.3540. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## long_memory_synth_recovery_ema3000 +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.661465406417847 seconds. +- Overall skill 0.360588; relative MASE 0.761649; relative WQL 0.536793. +- term skill: long=0.3910, medium=0.4017, short=0.3318. +- domain skill: Econ/Fin=0.1155, Energy=0.1829, Healthcare=0.4341, Nature=0.4242, Sales=0.3463, Transport=0.4592, Web/CloudOps=0.5066. +- frequency skill: A=0.3750, D=0.3500, H=0.3816, M=0.1111, Q=0.2000, S=0.4415, T=0.4013, W=0.2067. +- variates skill: multivariate=0.3919, univariate=0.3345. +- Outcome: E61 slower synthetic AR dynamics; seed79; improves main screen over matched E42 at3000 steps. Continue and check earlier cutoffs. + +## recent_normalization_recovery_ema3000 +- Checkpoint SHA-256: `a55a5681f52782a142f44595f69d5aef59579fa7f64124c72b9de918189d8ff9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.14950752258301 seconds. +- Overall skill 0.373434; relative MASE 0.747021; relative WQL 0.525533. +- term skill: long=0.3987, medium=0.4024, short=0.3519. +- domain skill: Econ/Fin=0.1428, Energy=0.2320, Healthcare=0.4255, Nature=0.4235, Sales=0.3398, Transport=0.4701, Web/CloudOps=0.4974. +- frequency skill: A=0.3847, D=0.3515, H=0.3961, M=0.0795, Q=0.2007, S=0.4234, T=0.4320, W=0.2036. +- variates skill: multivariate=0.3889, univariate=0.3609. +- Outcome: E65 recent4096 normalization with8192 context; seed101; improves matched E54 3000-step long-context result .372681. Continue. + +### E70 compiler cache infrastructure diagnostic +Both the default and /tmp Triton caches reject child-directory-to-parent os.replace with EXDEV. Same-parent replacement succeeds. A local SiblingFileCacheManager preserves Triton keys and group formats while writing unique same-parent temporary files. Byte, text, overwrite and group fixtures passed (initial fixture used an invalid nonhex key; corrected before accepting the fixture). No installed library files, model parameters, optimizer state or inference runtime were changed. Retrying the identical training-only compile benchmark; no optimizer updates. + +### E70 fixed-shape compiler benchmark outcome +Seed223, B64, C2048, H512, own E62 checkpoint 22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c; no optimizer updates and only allowed training windows. Compilation 51.065s; total benchmark 80.009s. Alternating three blocks: eager mean0.119890s versus compiled mean0.064745s, speedup1.852. Loss0.228576794 vs0.228607744; gradient cosine0.998925465, maximum absolute gradient difference0.000610351562. bf16 arithmetic differs slightly; this is not bitwise training equivalence. Other experiments shared the H100. Variable-shape compatibility is being checked before use in training; published inference is unchanged. + +## E71 finer eight-point patches — prepared, not launched +Hypothesis: E17 benefited from32→16-point patches, and the current model still has short-horizon energy errors. Test16→8-point patches while preserving physical position units and all attention/MLP/confidence parameters. Fold the two halves of context, query and recency input projections by summation and keep the first8 output rows, as in the earlier resolution experiment. This is an own-weight initialization, not an exact function-preserving conversion. Initialize from E62, use seed197/B64/LR2e-5/12000 steps with paired sign loss, and compare to the already-running E67 paired16-point arm. Keep the identical sampler and its16-point random-prefix rounding; only model patch resolution changes. CPU fixtures and initial evaluation precede training. No additional data or synthetic generator. Waiting for training memory to become available. + +E70 variable-shape follow-up: torch.compile(dynamic=True, fullgraph=True) failed in the installed PyTorch tensorification pass: TensorReferenceAnalysis lacks python_mod. No optimizer updates occurred. Test static shape specialization with a64-graph cache limit instead, preserving the existing16 context/horizon combinations. Dynamic failure log: compiler_variable_shapes.log. + +## E72 convex mixtures of training windows — prepared, not launched +Hypothesis: interpolating real dynamics can expand effective corpus diversity and regularize the forecast mapping beyond drawing additional series. On25% of sampled rows, choose a different row with the same two periods, normalize the donor using context-only mean/std into the primary context units, then combine context and future separately with a Beta(2,2) coefficient. Missing positions use mask intersection; require8 common observed context points and1 common future label. Both real and existing locally synthetic rows are eligible. Independent seed600200 preserves the main corpus/generator stream and requested-horizon stream. Planned own E62 initialization, seed197, paired loss, B64, LR2e-5,12000 steps, identical E67 paired control settings. No inference changes. Fixtures: {"cpu_seconds": 2.7141120220185257, "seed": 197, "mixture_seed": 600200, "rows": 192, "changed_context_rows": 43, "main_and_horizon_rng_matched": true, "changing_labels_does_not_change_contexts": true, "finite_masks_respected": true, "optimizer_updates": 0}. Await training allocation. + +### E58 symmetry diagnostic +Seed239, four allowed training windows, no optimizer updates, CPU5.262225491984282s. At global12000, duplicate-stream encoder5 activations differ by only0.001181 relative RMS, versus0.001124 at initialization. Sampled duplicate-row matrix cosines remain0.99987–0.99997. The nearly redundant streams weaken the interpretation that this experiment tested useful extra capacity. Full measurements: wide_capacity_symmetry_diagnostic.json. No current weights changed. + +## E73 independently initialized extra feature stream — prepared, not launched +Hypothesis: widening by near-identical copies keeps the extra neurons redundant. Build a146,477,344-parameter model with the original512 features and a separate randomly initialized512-feature stream. Inherited linear maps occupy their original blocks; new internal maps are independently random; cross-stream maps and new output-head columns start at zero. Layer normalization operates on each512-feature group separately so the parent function survives initialization. All maps, including cross-stream connections, will train. This changes initialization and normalization grouping relative to E58. Conversion seed241; own E47 parent. Same training seed113, B96, LR3e-5,32000-step schedule and optimizer/sampler reset at8000 with seed179 as the completed/recovered small control. Use unit LR multipliers because original columns are no longer duplicated or divided. No new data or generator. Conversion fixture: {"method": "independent random feature stream with block-diagonal inherited projections, zero cross-stream projections and zero new output columns; separate512-feature layer normalization", "parent_sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", "random_initialization_seed": 241, "fixture_max_abs_difference": 1.6689300537109375e-06, "new_stream_activation": {"relative_rms_difference": 1.4169212579727173}, "learning_rate_multipliers": "one for every parameter", "checkpoint_sha256": "d164d8b12223032b23948d0dcb17389d10f8e739a30a1ade5f677d2a948e965b", "parameters": 146477344, "cpu_seconds": 2.802320774004329, "optimizer_updates": 0}. Initial screen and gradient checks precede training. + +### E70 static shape specialization outcome +All four tested context/horizon shapes compiled and produced finite gradients; returning to2048/512 reused graph1, with four unique graphs total. Loss differences remained below0.00007. First calls took47.33,38.52,51.27,46.47 seconds; steady forward/backward speedups ranged1.60–1.94 under shared load. Complete result compiler_static_shapes_result.json, elapsed208.31172983598663s. Static specialization is usable, but16 training shapes incur compilation cost and bf16 arithmetic changes; existing active training runs remain eager. + +## E58/E66 recovered146M at global12000 +- Checkpoint SHA-256: `3d39cb54e80093bf97c2d95eda6bd30fefa65ec47b33ba70838dc881321e31ea`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.74531269073486 seconds. +- Overall skill 0.373963; relative MASE 0.747878; relative WQL 0.524045. +- term skill: long=0.3982, medium=0.4082, short=0.3507. +- domain skill: Econ/Fin=0.1409, Energy=0.2357, Healthcare=0.3980, Nature=0.4325, Sales=0.3406, Transport=0.4658, Web/CloudOps=0.4987. +- frequency skill: A=0.3756, D=0.3419, H=0.3949, M=0.0902, Q=0.1997, S=0.4220, T=0.4377, W=0.2068. +- variates skill: multivariate=0.3930, univariate=0.3584. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E63 expanded corpus at146M first4000 +- Checkpoint SHA-256: `c89939a906b619e3d119a26d2edf1b567ff902930ca78b3e58cdce5903ed3077`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.43943977355957 seconds. +- Overall skill 0.373186; relative MASE 0.749492; relative WQL 0.524216. +- term skill: long=0.3994, medium=0.4061, short=0.3496. +- domain skill: Econ/Fin=0.1406, Energy=0.2371, Healthcare=0.4020, Nature=0.4224, Sales=0.3395, Transport=0.4650, Web/CloudOps=0.5007. +- frequency skill: A=0.3699, D=0.3383, H=0.3939, M=0.1020, Q=0.2066, S=0.4209, T=0.4379, W=0.2018. +- variates skill: multivariate=0.3928, univariate=0.3571. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E61 slow AR3000 first earlier cutoff +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.004189491271973 seconds. +- Overall skill 0.329626; relative MASE 0.805342; relative WQL 0.558025. +- term skill: long=0.3886, medium=0.3565, short=0.2947. +- domain skill: Econ/Fin=0.1530, Energy=0.2229, Healthcare=0.4151, Nature=0.3515, Sales=0.3980, Transport=0.3624, Web/CloudOps=0.4448. +- frequency skill: A=0.3216, D=0.3548, H=0.3555, M=0.1730, Q=0.2272, S=0.3450, T=0.3293, W=0.2673. +- variates skill: multivariate=0.3459, univariate=0.3164. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E61 slow AR3000 second earlier cutoff +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.961536407470703 seconds. +- Overall skill 0.353271; relative MASE 0.774762; relative WQL 0.539854. +- term skill: long=0.3691, medium=0.3752, short=0.3388. +- domain skill: Econ/Fin=0.0921, Energy=0.2250, Healthcare=0.3726, Nature=0.4619, Sales=0.5589, Transport=0.4127, Web/CloudOps=0.4305. +- frequency skill: A=0.3401, D=0.4317, H=0.3862, M=0.1746, Q=0.1512, S=0.2822, T=0.3452, W=0.2437. +- variates skill: multivariate=0.3595, univariate=0.3482. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E67 paired3000 third earlier cutoff +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 26.884973287582397 seconds. +- Overall skill 0.389069; relative MASE 0.736752; relative WQL 0.506597. +- term skill: long=0.3965, medium=0.3605, short=0.3968. +- domain skill: Econ/Fin=0.1707, Energy=0.3208, Healthcare=0.2592, Nature=0.5054, Sales=0.3991, Transport=0.5053, Web/CloudOps=0.3895. +- frequency skill: A=0.3624, D=0.4436, H=0.4039, M=0.1198, Q=0.2578, S=0.2862, T=0.4305, W=0.2611. +- variates skill: multivariate=0.3741, univariate=0.4006. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E67 candidate3000 complete package validation +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374401; relative MASE 0.746075; relative WQL 0.524578. +- term skill: long=0.3961, medium=0.4055, short=0.3534. +- domain skill: Econ/Fin=0.1115, Energy=0.2320, Healthcare=0.4573, Nature=0.4303, Sales=0.3470, Transport=0.4663, Web/CloudOps=0.4964. +- frequency skill: A=0.2888, D=0.3569, H=0.3930, M=0.1278, Q=0.1823, S=0.4232, T=0.4312, W=0.2160. +- variates skill: multivariate=0.3926, univariate=0.3596. +- Outcome: Full public-package validation. Training seed197, B64 distinct windows with both signs, LR2e-5;3000-step checkpoint at687.5s of training-loop elapsed time on the shared single H100. Exact public inference 129.863s. Paired candidate wins full validation and main screen; it improves earlier cutoffs2/3 versus E62, but loses0.000488 on cutoff1. Control full skill0.374180 versus paired0.374401. Select paired3000 with this temporal tradeoff recorded; training continues. + +## E67 control3000 complete package validation +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374180; relative MASE 0.746358; relative WQL 0.524749. +- term skill: long=0.3948, medium=0.4057, short=0.3535. +- domain skill: Econ/Fin=0.1134, Energy=0.2311, Healthcare=0.4600, Nature=0.4313, Sales=0.3473, Transport=0.4663, Web/CloudOps=0.4949. +- frequency skill: A=0.2923, D=0.3579, H=0.3922, M=0.1281, Q=0.1825, S=0.4224, T=0.4308, W=0.2163. +- variates skill: multivariate=0.3915, univariate=0.3600. +- Outcome: Full public-package validation. Training seed197, B64 distinct windows with both signs, LR2e-5;3000-step checkpoint at687.5s of training-loop elapsed time on the shared single H100. Exact public inference 131.546s. Paired candidate wins full validation and main screen; it improves earlier cutoffs2/3 versus E62, but loses0.000488 on cutoff1. Control full skill0.374180 versus paired0.374401. Select paired3000 with this temporal tradeoff recorded; training continues. + +E67 publication decision: paired3000 checkpoint2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238, full0.3744010291; main0.3783180328; earlier cutoffs0.3357387876/0.3582353306/0.3890690875. Relative to published E62, full gain0.000981171, main gain0.000974817, earlier changes-0.000488248/+0.000541947/+0.001280498. All97 full configurations and151170 instances pass with no quantile crossings. Three example configurations are bitwise equal after independent relocation; runtime/weight hashes verified. The published inference remains eager. + +## E74 equal ensemble of E62 and its paired3000 continuation +Hypothesis: fixed forecast averaging can retain the parent's stronger first earlier cutoff while preserving gains from paired-sign training. Test exactly one equal-weight quantile mean after each model's existing fixed rules, without a weight sweep or additional zero projection. Both models would forecast every instance. Reuse cached predictions for screening; no training, new seed or source. Evaluate main and all three earlier cutoffs, then full validation only if promising; an actual packaged replay remains required before publication. Members: E62 hash22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, E67 hash2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238. + +## full_paired_control_ema6000 +- Checkpoint SHA-256: `4517cc18d0d7b022c728a208b53bb0088fcefe249246640d26e688ba800cf84c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.108938932418823 seconds. +- Overall skill 0.377544; relative MASE 0.744699; relative WQL 0.520279. +- term skill: long=0.3999, medium=0.4077, short=0.3567. +- domain skill: Econ/Fin=0.1294, Energy=0.2391, Healthcare=0.4588, Nature=0.4300, Sales=0.3396, Transport=0.4652, Web/CloudOps=0.4999. +- frequency skill: A=0.3728, D=0.3542, H=0.3955, M=0.1113, Q=0.1942, S=0.4228, T=0.4360, W=0.2279. +- variates skill: multivariate=0.3946, univariate=0.3636. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +## full_paired_candidate_ema6000 +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.94004225730896 seconds. +- Overall skill 0.378455; relative MASE 0.743557; relative WQL 0.519554. +- term skill: long=0.4019, medium=0.4071, short=0.3578. +- domain skill: Econ/Fin=0.1262, Energy=0.2397, Healthcare=0.4622, Nature=0.4291, Sales=0.3379, Transport=0.4657, Web/CloudOps=0.5030. +- frequency skill: A=0.3687, D=0.3544, H=0.3962, M=0.1031, Q=0.1932, S=0.4249, T=0.4385, W=0.2281. +- variates skill: multivariate=0.3972, univariate=0.3631. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +## wide_graft_initial +- Checkpoint SHA-256: `d164d8b12223032b23948d0dcb17389d10f8e739a30a1ade5f677d2a948e965b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 44.365342140197754 seconds. +- Overall skill 0.375793; relative MASE 0.745650; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4405, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0953, Q=0.1981, S=0.4239, T=0.4362, W=0.2089. +- variates skill: multivariate=0.3938, univariate=0.3611. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +E74 valid_screen: skill0.37807862274263027, relativeMASE0.7436448167242383, relativeWQL0.5201222287724669, CPU0.8619319740100764s; group skills {"term": {"short": 0.35759494914169054, "medium": 0.40699311016073325, "long": 0.40082709768107416}, "domain": {"Econ/Fin": 0.1373283443599086, "Energy": 0.23867787085456083, "Healthcare": 0.4514094815443358, "Nature": 0.4314394439880541, "Sales": 0.3334613777872122, "Transport": 0.46623492569656166, "Web/CloudOps": 0.5020547204722161}, "freq": {"A-DEC": 0.3700186215632586, "Q-DEC": 0.1986150873665018, "M": 0.10412662722790622, "W-SUN": 0.07901894069086524, "D": 0.35481222927845457, "H": 0.39699199743484126, "15T": 0.21413878856050306, "W-FRI": -0.0023901912492456656, "10T": 0.615926427622083, "W-TUE": 0.5812846025030445, "W-THU": 0.20706119312963223, "W-WED": 0.31744777723871154, "5T": 0.5126119145163621, "10S": 0.4229238092063159}}. + +E74 valid_backcast: skill0.3362925418425802, relativeMASE0.7972981372266922, relativeWQL0.552500463058947, CPU0.8971402349998243s; group skills {"term": {"short": 0.30190782919949666, "medium": 0.35857372233263296, "long": 0.3983345998796374}, "domain": {"Econ/Fin": 0.15970397473963605, "Energy": 0.22932627079926182, "Healthcare": 0.40921062898616656, "Nature": 0.3642338798926953, "Sales": 0.395796512384459, "Transport": 0.3726773780449273, "Web/CloudOps": 0.4497268240013762}, "freq": {"A-DEC": 0.31984516176318767, "Q-DEC": 0.23213469399614717, "M": 0.1867528733976035, "W-SUN": 0.027286458584816375, "D": 0.35084294376677716, "H": 0.36615049422003554, "15T": 0.22473053922570885, "W-FRI": 0.2587886969661052, "10T": 0.3198607928100037, "W-TUE": 0.5430562436146349, "W-THU": 0.24609593870252322, "W-WED": 0.3423884364810911, "5T": 0.4378462658914031, "10S": 0.34158786712809996}}. + +E74 valid_backcast2: skill0.3582180334801286, relativeMASE0.771690389912856, relativeWQL0.5337426744378997, CPU0.6840074959909543s; group skills {"term": {"short": 0.3444537095616398, "medium": 0.3869421164002306, "long": 0.36441392284164364}, "domain": {"Econ/Fin": 0.10841961881158191, "Energy": 0.2363021419988357, "Healthcare": 0.34644304914503876, "Nature": 0.4685938042819019, "Sales": 0.5492137665291525, "Transport": 0.4207857629370483, "Web/CloudOps": 0.4314575495135424}, "freq": {"A-DEC": 0.3538974701075839, "Q-DEC": 0.1504553008739551, "M": 0.15220470977886436, "W-SUN": 0.04613015348540839, "D": 0.42446352745465865, "H": 0.39096253798739566, "15T": 0.10670219795421398, "W-FRI": 0.14873972396574198, "10T": 0.4961638002828159, "W-TUE": 0.08195477095370607, "W-THU": 0.32491052813791066, "W-WED": 0.5372312006064026, "5T": 0.46600691242017644, "10S": 0.28101678592852175}}. + +E74 valid_backcast3: skill0.38866584889169165, relativeMASE0.7372042201081582, relativeWQL0.506955107034635, CPU0.6765452020335943s; group skills {"term": {"short": 0.39634584808261863, "medium": 0.36050403977747736, "long": 0.39564160116149116}, "domain": {"Econ/Fin": 0.17218827750208232, "Energy": 0.32018031275863146, "Healthcare": 0.251739940360198, "Nature": 0.505730039991936, "Sales": 0.3992528233665873, "Transport": 0.5057485203797758, "Web/CloudOps": 0.38900692766706535}, "freq": {"A-DEC": 0.35992280976221613, "Q-DEC": 0.2607290890980446, "M": 0.1158596568834448, "W-SUN": 0.14646809588021303, "D": 0.4430503070010823, "H": 0.40373923909167875, "15T": 0.26167249262649306, "W-FRI": 0.026229112650416053, "10T": 0.6033044583572338, "W-TUE": 0.2614261172432897, "W-THU": 0.3805020665242401, "W-WED": 0.37420834670061953, "5T": 0.4617999415682724, "10S": 0.28494980458180186}}. + +E74 fixed ensemble recovers cutoff1 but is below the paired member on main and cutoffs2/3. Check cached full validation before deciding; no mixture coefficient tuning. + +E73 gradient fixture: {"cpu_seconds": 3.0038612950011156, "seed": 251, "allowed_training_windows": 2, "loss": 0.6392828226089478, "initial_gradients": {"head_new_columns": 1.3039275407791138, "encoder0_new_to_old_attention": 0.16236796975135803, "decoder3_new_to_old_ff": 0.3286978602409363}, "all_gradients_finite": true, "optimizer_updates": 0}. All gradients finite, with nonzero gradient to new output columns and new-to-old attention/feedforward maps at initialization. + +## E67 paired6000 backcast_evals +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.112698793411255 seconds. +- Overall skill 0.335119; relative MASE 0.798971; relative WQL 0.553296. +- term skill: long=0.3996, medium=0.3567, short=0.2999. +- domain skill: Econ/Fin=0.1484, Energy=0.2276, Healthcare=0.4122, Nature=0.3651, Sales=0.3962, Transport=0.3724, Web/CloudOps=0.4480. +- frequency skill: A=0.3127, D=0.3525, H=0.3668, M=0.1712, Q=0.2359, S=0.3414, T=0.3328, W=0.2844. +- variates skill: multivariate=0.3517, univariate=0.3216. +- Outcome: Compared with paired3000, cutoff1 loses0.000620 and cutoff2 gains0.001211. Main gains0.000137. Complete package validation and third earlier cutoff follow; keep paired3000 published meanwhile. + +## E67 paired6000 backcast2_evals +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.65610408782959 seconds. +- Overall skill 0.359446; relative MASE 0.769629; relative WQL 0.533126. +- term skill: long=0.3637, medium=0.3914, short=0.3451. +- domain skill: Econ/Fin=0.0947, Energy=0.2369, Healthcare=0.3640, Nature=0.4722, Sales=0.5483, Transport=0.4203, Web/CloudOps=0.4322. +- frequency skill: A=0.3460, D=0.4239, H=0.3913, M=0.1623, Q=0.1478, S=0.2801, T=0.3609, W=0.2646. +- variates skill: multivariate=0.3635, univariate=0.3561. +- Outcome: Compared with paired3000, cutoff1 loses0.000620 and cutoff2 gains0.001211. Main gains0.000137. Complete package validation and third earlier cutoff follow; keep paired3000 published meanwhile. + +E74 cached full validation: skill0.37416157579966614, relativeMASE0.7463637996830615, relativeWQL0.5247758979895311, CPU1.7625104649923742s; group skills {"term": {"short": 0.35339006443372445, "medium": 0.4058776358425863, "long": 0.39478447597143573}, "domain": {"Econ/Fin": 0.1148260686606345, "Energy": 0.2315840307823489, "Healthcare": 0.45764579718017184, "Nature": 0.4314211475708052, "Sales": 0.3476654519885174, "Transport": 0.46645466438647154, "Web/CloudOps": 0.49435858431787905}, "freq": {"A-DEC": 0.2905258409636121, "Q-DEC": 0.18415390225031736, "M": 0.12808227393650784, "W-SUN": 0.042170378733840996, "D": 0.3587361531705563, "H": 0.39218267210684865, "15T": 0.20355479619501637, "W-FRI": -0.021429381368383904, "10T": 0.615926427622083, "W-TUE": 0.5812846025030445, "W-THU": 0.20706119312963223, "W-WED": 0.31744777723871154, "5T": 0.5037733014006005, "10S": 0.4229238092063159}}. Below paired3000 skill0.374401 by0.000239. Reject: the first earlier-cutoff benefit does not outweigh lower full/main/other-earlier scores. No ensemble package is published and no weight sweep follows. + +E71 initial8-point model main screen0.3622169411 versus E62 parent0.3773432163; conversion intentionally changes function. CPU fixture0.9008s verifies constant-input projection folding, unchanged inherited tensors, finite/ordered forecasts at6/18/720/900 steps. Training recovery must justify this initialization cost. + +E58/E63 resource decision fixed before the next results: at global16000, stop the near-duplicate width trial if it remains below both its E47 parent and the matched small control; preserve a complete recovery checkpoint. At8000, assess expanded-corpus146M against its same-width original-corpus8000. Prioritize the independent-stream E73 initialization when a large training slot is released. Existing runs retain eager arithmetic. + +## E67 paired6000 exact full package +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374279; relative MASE 0.746472; relative WQL 0.524502. +- term skill: long=0.3958, medium=0.4059, short=0.3532. +- domain skill: Econ/Fin=0.1029, Energy=0.2327, Healthcare=0.4651, Nature=0.4291, Sales=0.3514, Transport=0.4660, Web/CloudOps=0.4952. +- frequency skill: A=0.2886, D=0.3570, H=0.3913, M=0.1264, Q=0.1824, S=0.4249, T=0.4314, W=0.2203. +- variates skill: multivariate=0.3928, univariate=0.3591. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +## E67 paired6000 third earlier cutoff +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.89822793006897 seconds. +- Overall skill 0.389533; relative MASE 0.736193; relative WQL 0.506212. +- term skill: long=0.3966, medium=0.3607, short=0.3974. +- domain skill: Econ/Fin=0.1634, Energy=0.3178, Healthcare=0.2808, Nature=0.5081, Sales=0.3977, Transport=0.5055, Web/CloudOps=0.3908. +- frequency skill: A=0.3558, D=0.4451, H=0.4045, M=0.1415, Q=0.2554, S=0.2895, T=0.4276, W=0.2643. +- variates skill: multivariate=0.3722, univariate=0.4028. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +## E65 recent normalization6000 +- Checkpoint SHA-256: `1c5bc9b814879a43941f6e59b6d2024152ec9db43014e2b4431195e52366f1ea`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.534422874450684 seconds. +- Overall skill 0.374709; relative MASE 0.745557; relative WQL 0.524426. +- term skill: long=0.4014, medium=0.4044, short=0.3523. +- domain skill: Econ/Fin=0.1384, Energy=0.2354, Healthcare=0.4238, Nature=0.4264, Sales=0.3389, Transport=0.4711, Web/CloudOps=0.4974. +- frequency skill: A=0.3756, D=0.3531, H=0.3970, M=0.0716, Q=0.2013, S=0.4239, T=0.4343, W=0.2078. +- variates skill: multivariate=0.3915, univariate=0.3610. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +E67 paired6000 full public inference131.433437s on the shared single H100; all97 configurations and151170 instances passed. The original3k publication remains selected by full validation, with the temporal tradeoff documented. + +## E75 training loss after fixed inference transformations — prepared, not launched +Hypothesis: paired training aligns sign averaging but still scores raw neural forecasts, whereas inference changes them with seasonal and continuity priors and exact-zero projection. Compute the same fixed context statistics without model gradients, then apply the transforms differentiably to forecasts before the existing normalized median/quantile loss. Gradients include the continuity correction's dependence on the first forecast; zero/positivity thresholds remain fixed and piecewise differentiable. The target transform and seasonal loss weight stay unchanged. Planned E62 initialization, seed197, paired loss, B64, LR2e-5,12000 steps, identical data stream to E67 paired. No new data/generator and no inference changes. CPU implementation comparison: {"cpu_seconds": 0.11522011604392901, "seed": 263, "fixtures": [{"context": 8, "horizon": 6, "maximum_absolute_difference": 0.0, "finite_gradients": true}, {"context": 64, "horizon": 18, "maximum_absolute_difference": 2.384185791015625e-07, "finite_gradients": true}, {"context": 512, "horizon": 128, "maximum_absolute_difference": 1.1920928955078125e-06, "finite_gradients": true}, {"context": 4096, "horizon": 900, "maximum_absolute_difference": 7.152557373046875e-07, "finite_gradients": true}], "optimizer_updates": 0}. Fixture agreement is numerical, not bitwise, because training computes context statistics in float64. Await a training slot and one allowed-window end-to-end gradient check. + +## E61 slow AR6000 evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.034730434417725 seconds. +- Overall skill 0.361281; relative MASE 0.760333; relative WQL 0.536557. +- term skill: long=0.3915, medium=0.4029, short=0.3324. +- domain skill: Econ/Fin=0.1215, Energy=0.1845, Healthcare=0.4313, Nature=0.4272, Sales=0.3429, Transport=0.4577, Web/CloudOps=0.5068. +- frequency skill: A=0.3788, D=0.3481, H=0.3812, M=0.1116, Q=0.2006, S=0.4421, T=0.4034, W=0.2113. +- variates skill: multivariate=0.3930, univariate=0.3349. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +## E61 slow AR6000 backcast_evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.68802785873413 seconds. +- Overall skill 0.331040; relative MASE 0.803953; relative WQL 0.556635. +- term skill: long=0.3886, medium=0.3569, short=0.2972. +- domain skill: Econ/Fin=0.1588, Energy=0.2277, Healthcare=0.4061, Nature=0.3526, Sales=0.3967, Transport=0.3629, Web/CloudOps=0.4452. +- frequency skill: A=0.3244, D=0.3518, H=0.3577, M=0.1682, Q=0.2306, S=0.3442, T=0.3314, W=0.2762. +- variates skill: multivariate=0.3484, univariate=0.3169. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +## E61 slow AR6000 backcast2_evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.468894004821777 seconds. +- Overall skill 0.354097; relative MASE 0.774005; relative WQL 0.539002. +- term skill: long=0.3704, medium=0.3752, short=0.3398. +- domain skill: Econ/Fin=0.0990, Energy=0.2275, Healthcare=0.3686, Nature=0.4617, Sales=0.5571, Transport=0.4131, Web/CloudOps=0.4308. +- frequency skill: A=0.3441, D=0.4303, H=0.3862, M=0.1683, Q=0.1512, S=0.2846, T=0.3470, W=0.2514. +- variates skill: multivariate=0.3602, univariate=0.3491. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +E73 compiler fixture: {"seed": 271, "batch": 16, "context": 512, "horizon": 128, "eager_loss": 0.2625328004360199, "compiled_loss": 0.26252102851867676, "gradient_cosine": 0.9994836559992685, "maximum_gradient_difference": 0.003173828125, "compile_and_gradient_comparison_seconds": 65.4888255270198, "total_seconds": 66.77216628700262, "optimizer_updates": 0, "source": "allowed packed_sample and own generator"}. Static compilation is numerically close, not bitwise; use it for the32k-step independent-stream trial to amortize the16 shape compilations. This implementation difference from the existing eager small control is explicit. Loss formula, sampler, optimizer and schedule stay fixed. + +E75 allowed-window end-to-end fixture: {"cpu_seconds": 2.641128608956933, "seed": 269, "allowed_training_and_own_synthetic_windows": 8, "loss": 0.2808418869972229, "gradient_norm": 0.18120726943016052, "all_gradients_finite": true, "optimizer_updates": 0}. No optimizer updates. + +E69 is now queued after the slow-AR trainer PID980 exits with ema012000.pt, using its declared eager settings and the same allocation. Queue receipt volatility_synth_queue.json and watcher watch_volatility_synth.log identify the run. No E69 training has started yet. + +E71 maximum-shape GPU fixture: {"seed": 277, "batch": 64, "signed_rows": 128, "context": 4096, "horizon": 1024, "optimizer_updates": 0, "loss": 0.2055814117193222, "seconds": 10.965134899015538, "peak_allocated_mib": 10373.298828125, "peak_reserved_mib": 10992.0}. Passed without optimizer updates. Queue after both E67 trainers finish12000, so its larger working set reuses their combined allocation. + +E75 queued after E65 recent-normalization finishes12000. Both new queues require the predecessor final EMA before starting, and use the declared eager settings. E72 mixup remains prepared only; E73 awaits the prespecified width checkpoint decision. + +## E76 transfer the matched slow-AR6000 correction +E61 improves the main and both earlier cutoffs at6000 versus E42. Hypothesis: this learned synthetic-dynamics correction also helps the selected paired3000 model. Form exactly base(E67 paired3000)+candidate(E61 slowAR6000)-control(E42 partial6000), coefficient1.0 on matching tensors; keep the base confidence projection unchanged. All three checkpoints were trained here on declared sources. No coefficient sweep, new training, data or inference changes. Compare the main and earlier screens before full replay. + +## E76 slow-AR correction evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.135655403137207 seconds. +- Overall skill 0.379721; relative MASE 0.741564; relative WQL 0.518831. +- term skill: long=0.4036, medium=0.4064, short=0.3597. +- domain skill: Econ/Fin=0.1442, Energy=0.2362, Healthcare=0.4597, Nature=0.4330, Sales=0.3350, Transport=0.4655, Web/CloudOps=0.5071. +- frequency skill: A=0.3715, D=0.3604, H=0.3974, M=0.0968, Q=0.1987, S=0.4260, T=0.4397, W=0.2230. +- variates skill: multivariate=0.3981, univariate=0.3647. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +## E76 slow-AR correction backcast_evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.913641452789307 seconds. +- Overall skill 0.336781; relative MASE 0.795517; relative WQL 0.552923. +- term skill: long=0.3965, medium=0.3587, short=0.3036. +- domain skill: Econ/Fin=0.1684, Energy=0.2257, Healthcare=0.4092, Nature=0.3689, Sales=0.3927, Transport=0.3721, Web/CloudOps=0.4520. +- frequency skill: A=0.3199, D=0.3498, H=0.3654, M=0.1876, Q=0.2323, S=0.3437, T=0.3374, W=0.2878. +- variates skill: multivariate=0.3539, univariate=0.3228. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +## E76 slow-AR correction backcast2_evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.258840799331665 seconds. +- Overall skill 0.360577; relative MASE 0.768980; relative WQL 0.531693. +- term skill: long=0.3677, medium=0.3876, short=0.3472. +- domain skill: Econ/Fin=0.1192, Energy=0.2354, Healthcare=0.3433, Nature=0.4736, Sales=0.5465, Transport=0.4203, Web/CloudOps=0.4380. +- frequency skill: A=0.3515, D=0.4289, H=0.3897, M=0.1383, Q=0.1499, S=0.2861, T=0.3643, W=0.2654. +- variates skill: multivariate=0.3674, univariate=0.3550. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +E76 CPU composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/full_paired_candidate/ema003000.pt": "2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238", "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb"}, "seconds": 1.1477709169848822}. + +## E77 slow-AR synthesis during full paired-sign training — prepared, not launched +E61's matched correction transfers favorably to the selected model on three screens. Hypothesis: training the confidence/horizon-aware model directly with the same slow-AR prior can improve on composing an older-backbone correction. Reuse E67's exact E62 initialization, seed197, B64, LR2e-5,12000-step schedule, paired-sign loss and independent horizon RNG300200. Change only synthetic AR phi fromU(.2,.995) toexp(-10**(-U(0,4))), preserving the main RNG calls and zero initial state. This yields time constants log-uniform1..10000 and keeps innovation variance normalized as before. Compare to the already-computed E67 paired control. No inference change, new corpus or validation training. Prioritize after a training allocation is released; E72 mixup remains an unlaunched alternative. + +## E76 slow-AR correction third earlier cutoff +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.890827178955078 seconds. +- Overall skill 0.389281; relative MASE 0.737064; relative WQL 0.506031. +- term skill: long=0.3949, medium=0.3619, short=0.3971. +- domain skill: Econ/Fin=0.1812, Energy=0.3198, Healthcare=0.2311, Nature=0.5053, Sales=0.3996, Transport=0.5073, Web/CloudOps=0.3940. +- frequency skill: A=0.3622, D=0.4457, H=0.4032, M=0.1047, Q=0.2602, S=0.2878, T=0.4313, W=0.2630. +- variates skill: multivariate=0.3743, univariate=0.4008. +- Outcome: Publish E76: full0.375612 improves paired3000 full0.374401; main0.379721 and earlier0.336781/0.360577/0.389281 all improve. All97 configurations and151170 instances pass; zero crossings. Fixed coefficient1.0 composition of own trained checkpoints; no additional training. + +## E76 slow-AR correction full package validation +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.375612; relative MASE 0.744415; relative WQL 0.523713. +- term skill: long=0.3976, medium=0.4054, short=0.3551. +- domain skill: Econ/Fin=0.1204, Energy=0.2291, Healthcare=0.4651, Nature=0.4330, Sales=0.3487, Transport=0.4658, Web/CloudOps=0.4992. +- frequency skill: A=0.2896, D=0.3638, H=0.3924, M=0.1218, Q=0.1820, S=0.4260, T=0.4325, W=0.2151. +- variates skill: multivariate=0.3936, univariate=0.3609. +- Outcome: Publish E76: full0.375612 improves paired3000 full0.374401; main0.379721 and earlier0.336781/0.360577/0.389281 all improve. All97 configurations and151170 instances pass; zero crossings. Fixed coefficient1.0 composition of own trained checkpoints; no additional training. + +E76 published checkpoint SHA2568562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105. Public full inference132.224730s on the shared H100. Relocation fixture15.725434s: three example configurations, bitwise identical, finite and monotone; all runtime/weight hashes verified. The checker initially ran before candidate assembly completed and was restarted after the package existed; the infrastructure error log is retained separately. No inference runtime change. + +E77 sampler fixture: {"seed": 197, "main_and_horizon_rng_matched": true, "real_windows_bitwise_equal": true, "changed_synthetic_context_values": 37211, "cpu_seconds": 4.491440053971019, "optimizer_updates": 0}. Prepared only; no optimizer updates or launch yet. + +## wide_capacity_146m_recovery_ema16000 +- Checkpoint SHA-256: `ad4960e948e64ecf25ec3be4cdc50bae6c7076d15cd7470b028f6ac703bb1081`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.720494747161865 seconds. +- Overall skill 0.375817; relative MASE 0.745785; relative WQL 0.522408. +- term skill: long=0.3987, medium=0.4075, short=0.3541. +- domain skill: Econ/Fin=0.1398, Energy=0.2372, Healthcare=0.4246, Nature=0.4298, Sales=0.3438, Transport=0.4655, Web/CloudOps=0.5003. +- frequency skill: A=0.3787, D=0.3494, H=0.3971, M=0.0940, Q=0.1979, S=0.4232, T=0.4362, W=0.2114. +- variates skill: multivariate=0.3941, univariate=0.3609. +- Outcome: Original-corpus146M at16000 reaches0.375817, above its E47 parent0.375793 and matched small control0.375510: retain the planned continuation. Expanded corpus at8000 scores0.374266 versus original-corpus8000 .374330, an essentially tied result after a worse4000 checkpoint. Stop the expanded branch, preserve full recovery state, and prioritize an initialization that actually diversifies features. This is inconclusive for data scaling, not proof that expanded data is harmful. + +## wide_corpus_expanded_recovery_ema8000 +- Checkpoint SHA-256: `fbab74444b04d805cc04ec612964fcad5e66766d55c3f566a8dc870328ca4493`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.68104600906372 seconds. +- Overall skill 0.374266; relative MASE 0.747150; relative WQL 0.524049. +- term skill: long=0.4008, medium=0.4075, short=0.3504. +- domain skill: Econ/Fin=0.1428, Energy=0.2366, Healthcare=0.4040, Nature=0.4268, Sales=0.3397, Transport=0.4655, Web/CloudOps=0.5014. +- frequency skill: A=0.3790, D=0.3421, H=0.3958, M=0.1065, Q=0.2072, S=0.4225, T=0.4375, W=0.1966. +- variates skill: multivariate=0.3942, univariate=0.3579. +- Outcome: Original-corpus146M at16000 reaches0.375817, above its E47 parent0.375793 and matched small control0.375510: retain the planned continuation. Expanded corpus at8000 scores0.374266 versus original-corpus8000 .374330, an essentially tied result after a worse4000 checkpoint. Stop the expanded branch, preserve full recovery state, and prioritize an initialization that actually diversifies features. This is inconclusive for data scaling, not proof that expanded data is harmful. + +E63 stop requested after8000 evaluation. No validation gain justifies continuing the nearly duplicated-width expanded-data arm while E73 is ready; the complete recovery state will allow later continuation. E73 takes that allocation with seed113/B96/LR3e-5/32000, reset at8000 toseed179, and static compiled loss. Its separate feature-group normalization and independent stream are the research changes; compiler numerical differences were measured explicitly. + +E75 maximum-shape bf16 GPU fixture: {"seed": 281, "batch": 64, "context": 4096, "horizon": 1024, "optimizer_updates": 0, "loss": 0.22305740416049957, "seconds": 10.91669597796863, "peak_allocated_mib": 5362.6640625, "peak_reserved_mib": 5694.0}. All model gradients finite; no optimizer updates. + +E73 independent feature stream with static compilation, seed113 training started at 2026-10-22T07:07:01Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E71 eight-point patches, seed197 training started at 2026-10-22T07:08:06Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E63 stop receipt: {"experiment": "E63 expanded146M stopped", "step": 8501, "training_loop_seconds": 2892.9847088330425, "checkpoint_sha256": "1d578f0a2278a3a4ad7011e24957797dde52c70b7e2c6f8b369aaf8227ac7133", "ema": "/workspace/research/runs/wide_corpus_expanded_recovery/ema008501.pt", "complete_recovery": "/workspace/research/runs/wide_corpus_expanded_recovery/recovery.pt", "selection_checkpoint_step": 8000, "selection_skill": 0.3742660744379728, "outcome": "Essentially tied with original-corpus same-width8000 .3743298586; prioritize independent stream. Data scaling remains inconclusive."}. + +## E67 full_paired_control final12000 +- Checkpoint SHA-256: `b79cfdeefa1b2b20af89c8484a447dc96bfdd31234f2b08346468c8d9ece62bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.30943751335144 seconds. +- Overall skill 0.377243; relative MASE 0.745277; relative WQL 0.520379. +- term skill: long=0.4013, medium=0.4067, short=0.3560. +- domain skill: Econ/Fin=0.1346, Energy=0.2365, Healthcare=0.4485, Nature=0.4306, Sales=0.3336, Transport=0.4666, Web/CloudOps=0.5025. +- frequency skill: A=0.3681, D=0.3525, H=0.3948, M=0.1073, Q=0.2012, S=0.4245, T=0.4384, W=0.2186. +- variates skill: multivariate=0.3950, univariate=0.3628. +- Outcome: Seed197/B64/LR2e-5; final12000 is worse than the selected paired3000 and its published slow-AR correction. No publication. Matched control and candidate complete; no baseline rerun. + +## E67 full_paired_candidate final12000 +- Checkpoint SHA-256: `26d529aeaaee4484b0b4375fdc379779b08b38ac5077f0147587421f4f5fc8b0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.91175127029419 seconds. +- Overall skill 0.377427; relative MASE 0.744720; relative WQL 0.520460. +- term skill: long=0.4032, medium=0.4055, short=0.3560. +- domain skill: Econ/Fin=0.1326, Energy=0.2359, Healthcare=0.4464, Nature=0.4299, Sales=0.3326, Transport=0.4667, Web/CloudOps=0.5051. +- frequency skill: A=0.3614, D=0.3505, H=0.3948, M=0.1036, Q=0.1986, S=0.4251, T=0.4404, W=0.2181. +- variates skill: multivariate=0.3963, univariate=0.3620. +- Outcome: Seed197/B64/LR2e-5; final12000 is worse than the selected paired3000 and its published slow-AR correction. No publication. Matched control and candidate complete; no baseline rerun. + +E67 complete measured training loop times on the shared H100: individual control2794.8358459s; paired candidate2794.8673859s. These are overlapping wall times, not additive exclusive GPU seconds. + +## Operator recovery2 — 2026-10-22 +The operator reports152594 research seconds remaining; all old processes ended. Published E76 verified SHA2568562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105 and full validation0.3756123475. Resume complete optimizer/EMA/RNG/prefetched-batch checkpoints: E58/E66 wide17000 and control23000, E61 slowAR8000, E65 recent normalization9000. Their prior last logged steps17200/23750/8450/9600 represent at least200/750/450/600 unsaved updates discarded. Original phase logs remain intact, latest elapsed3043.3/3041.0/3037.0/3034.3s respectively. E73 graft had no checkpoint or logged50-step interval; E71 patch8 reached200/63.0s with no checkpoint. Restart both from saved own initialization with unchanged seeds. Compiler caches were absent after recovery, so E73 recompiles static shapes. E63 remains stopped; E67 remains complete. Phase commands/PIDs/timing are recorded in recovery2_launch_receipt.json and *_recovery2.log; queued E69/E75/E77 retain predeclared settings. + +## E78 multiple persistent scales in synthetic residuals — prepared, not launched +Hypothesis: the slow-AR improvement reflects missing persistent residual dynamics, but a single decay rate per synthetic sequence cannot represent fast variation superimposed on slow level changes. Compare four independent OU components to E77's one component. Keep the original component and main RNG draws; add three components with log-uniform time constants1..10000 from an independent RNG seed700200, then divide their sum by2 to preserve asymptotic stationary variance. All components retain zero initial state, isolating multiple scales from initialization. Other synthetic structure,20% synthetic fraction, real windows, horizon augmentation, architecture and loss remain unchanged. ParentE62, seed197/B64/LR2e-5/12000, paired-sign loss, main/horizon RNG identical to E77. This generator uses no external data. Prepare and check on allowed training windows; launch only after a suitable allocation is released. + +E78 sampler fixture passed: { "seed": 197, "extra_seed": 700200, "real_windows_bitwise_equal": 211, "synthetic_windows": 45, "changed_context_values": 26747, "main_and_horizon_rng_matched": true, "finite_masks_and_periods_matched": true, "cpu_seconds": 4.07623768504709, "optimizer_updates": 0 }; prepared only, no optimizer updates. + +## E58/E66 recovered37M control24000 +- Checkpoint SHA-256: `0a77157c454bf7a913b41493f052666ed1cfce3d65206b6c969fb8d95e6314a7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.700880765914917 seconds. +- Overall skill 0.375681; relative MASE 0.745320; relative WQL 0.522962. +- term skill: long=0.4008, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1417, Energy=0.2348, Healthcare=0.4210, Nature=0.4300, Sales=0.3397, Transport=0.4677, Web/CloudOps=0.5018. +- frequency skill: A=0.3784, D=0.3533, H=0.3961, M=0.0763, Q=0.2029, S=0.4222, T=0.4370, W=0.2113. +- variates skill: multivariate=0.3953, univariate=0.3596. +- Outcome: Seed113, matched reset at8000 toseed179. Skill0.375681 remains slightly below E47parent0.375793; continue the predeclared schedule to32000. E58large24000 is pending. + +## E79 fresh pretraining at37M and146M — prepared, not launched +Hypothesis: duplicating a mature smaller representation and continuing at a small learning rate limits the useful benefit of capacity. Test distinct random initializations under one matched modern recipe. Both arms use the same direct encoder/decoder architecture (patch16,6encoder/4decoder blocks, recency/confidence inputs and partial-target masks); widths512/1024 with8/16heads are the only architectural difference. Every tensor is initialized here with seed307; no parent weights. Both use packed_sample,20% own synthetic windows, the proven slow-AR time-constant prior1..10000, independent horizon-prefix augmentation seed300310, paired-sign objective, seed307 sampling, batch48 distinct/96signed rows, AdamW LR2e-4,400-step warmup and96000-step cosine schedule, EMA. Both use the same static compiled loss after a numerical/memory fixture. Save every1000; screen4000/8000/16000/24000/48000/72000/96000, with earlier cutoffs for promising candidates. This is a matched width comparison within the new recipe; comparisons to the old published lineage are model-selection comparisons, not clean causal claims about width. Reuse no released or baseline weights. Launch only after existing allocations release. The extended schedule supplies4.608M distinct sampled windows per arm; stop a clearly unpromising branch when its checkpoints establish that result. + +## E71 patch8 first1000 +- Checkpoint SHA-256: `67648eaef1f0a4fe5a7c5526f25c2c8724735720463d99250e814632841f9ada`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.271108627319336 seconds. +- Overall skill 0.374708; relative MASE 0.748109; relative WQL 0.522638. +- term skill: long=0.3990, medium=0.3996, short=0.3553. +- domain skill: Econ/Fin=0.1322, Energy=0.2323, Healthcare=0.4676, Nature=0.4328, Sales=0.3481, Transport=0.4583, Web/CloudOps=0.4952. +- frequency skill: A=0.3712, D=0.3577, H=0.3912, M=0.0847, Q=0.1944, S=0.4235, T=0.4328, W=0.2289. +- variates skill: multivariate=0.3876, univariate=0.3643. +- Outcome: Seed197/B64/LR2e-5; recovers most of the conversion loss, from initial0.362217 to0.374708. Still below matched patch16 paired1000 at0.376860 and parentE62 at0.377343; continue to3000/6000 before a decision. + +E79 initial checkpoint receipts: [ { "path": "/workspace/research/random_capacity_512_initial.pt", "sha256": "19da01694123fcb13df815689ca66460d0da596bd31dfabfabb08dda6f7801e4", "parameters": 36800800, "seed": 307, "cpu_seconds": 0.5544250560924411, "optimizer_updates": 0 }, { "path": "/workspace/research/random_capacity_1024_initial.pt", "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", "parameters": 146477344, "seed": 307, "cpu_seconds": 2.0617611361667514, "optimizer_updates": 0 } ] + +E79 width512 fixture: { "width": 512, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": { "batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 4520.62451171875, "peak_reserved_mib": 4784.0 }, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999952735476323, "max_gradient_difference": 4.57763671875e-05, "compile_comparison_seconds": 53.98739787377417, "total_seconds": 63.50496790325269, "source": "allowed packed_sample and own synthetic generator only" } + +E79 width1024 fixture: { "width": 1024, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": { "batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 10162.86376953125, "peak_reserved_mib": 10694.0 }, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999932382274589, "max_gradient_difference": 6.103515625e-05, "compile_comparison_seconds": 62.02263342216611, "total_seconds": 72.94260076899081, "source": "allowed packed_sample and own synthetic generator only" } + +E79 both arms are queued after E58wide and E71patch8 release their allocations; their complete recovery files must exist. Queue receipts random_capacity_512_queue.json and random_capacity_1024_queue.json preserve exact commands. Both use B48/96000/seed307/static compilation. No training has started. Compiler caches are backed up under research/compiler_cache_backup and can be restored to the same /tmp paths after another recovery. + +postloss started 2026-10-22T07:27:21.677278+00:00 after recent_normalization_recovery completed. Original predeclared settings and seed retained. + +## Operator recovery3 — 2026-10-23 +Operator reports151596 research seconds remaining; all prior processes ended. Submission E76 hash verified unchanged. Resume complete state at wide20000/control28000/slowAR10000/patch8 2000. Last logged steps20100/28400/10850/2700 imply at least100/400/850/700 discarded unsaved updates; phase2 elapsed768.6/769.5/767.8/770.0s. Graft reached100 updates/722.7s without checkpoint; restart own seed113 initialization, restored compiler caches (13.8722s). Recent normalization completed12000 with final phase training loop708.0175s; do not retrain. Volatility/paired-slowAR and fresh-width queues restored with new dependencies. Postloss reached200/43.0s with nonfinite losses, no checkpoint; numerical diagnosis precedes restarting. Prior phase logs retained; no credential access. + +E75 numerical failure diagnosed on allowed-corpus step53, seed197, without optimizer updates: one row has context magnitude2.2842e18 and float32 variance accumulation overflow, yielding infinite normalization scale. The normalized neural output is finite, but conversion to raw units produces nonfinite values. Context postprocessing statistics themselves remain finite. Add a float64 fallback only on rows with nonfinite mean/scale; ordinary-row arithmetic remains bitwise unchanged. Restart this experiment from E62 after regression checks; no affected checkpoint will be selected. This correction is part of this comparison and will be retained in its inference runtime if selected. + +## E65 recent normalization final12000 +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 31.676968097686768 seconds. +- Overall skill 0.375806; relative MASE 0.744151; relative WQL 0.523574. +- term skill: long=0.4022, medium=0.4055, short=0.3535. +- domain skill: Econ/Fin=0.1427, Energy=0.2348, Healthcare=0.4380, Nature=0.4255, Sales=0.3383, Transport=0.4706, Web/CloudOps=0.4994. +- frequency skill: A=0.3754, D=0.3572, H=0.3959, M=0.0785, Q=0.2042, S=0.4248, T=0.4352, W=0.2109. +- variates skill: multivariate=0.3924, univariate=0.3622. +- Outcome: Seed101/B128/LR3e-5. Main0.375806 narrowly exceeds4096-control0.375764 and8192-full-normalization0.375118; evaluate earlier windows against both matched controls. Final resumed phase708.0175 training-loop seconds; prior interrupted phases are retained separately. + +E75 numerical regression passed: ordinary rows bitwise original; observed overflowing row now finite loss2.6841469 and all gradients finite,7.0381s,0optimizer updates. Fixed-parent replay of250original training batches found no nonfinite postprocessed forecasts in21.9482s. Restarted seed197/B64/LR2e-5/12000 from E62. Future validation uses postloss_inference with the same overflow fallback. The first earlier-control evaluation launch used the old trend summary runtime by mistake and was cancelled; corrected comparisons are named long_context_control_fixed128_ema12000. No selection uses the cancelled diagnostic. + +E76 descriptive paired full-validation comparison against E67paired3000: improvement0.0012113184,51/97configurations improve. Resampling dataset-directory clusters (28keys, seed317,5000draws) gives skill-delta percentiles[-0.0006681,0.0012221,0.0031907]. The range crosses zero and adaptive validation reuse prevents a held-out significance claim. Retain E76 based on measured full/earlier scores, while recognizing this is a small improvement. Largest gains include us_births daily and bizitobs_l2c short; ETT2 minute short worsens. Full per-configuration log-error differences retained in slow_ar_delta6k_comparison.json. + +## E80 matched control for the overflow correction — prepared +E75 needs a numerical fallback for rare overflowing training rows. To isolate its postprocessing-aware objective, prepare a control with exactly the same fallback but the original E67 paired-sign loss. ParentE62,seed197,B64,LR2e-5,12000steps, matching data/horizon RNG. No other inference or training change. This is a newly required numerical control, not a baseline rerun. + +## E81 equal ensemble of E76 and recent-normalization12000 +The longer-history candidate has a stronger second earlier cutoff but lower main/first-earlier performance than E76. Test whether averaging their postprocessed quantiles reduces complementary errors. Fixed equal weights; every member must forecast every instance if packaged. Compare cached main and both earlier predictions first. No coefficient sweep, new fitting, data or training. Reject unless the diagnostic tradeoff justifies full public-package replay. + +E80 overflow-only paired control queued alongside fresh-capacity arms after the old wide/patch8 allocations release. E78 multiscale-AR queued after postloss releases its allocation. Both use declared seed197/B64/LR2e-5/12000 settings; every command is retained in its queue receipt. Neither has started. + +## E65 matched comparison recent_normalization_recovery backcast_evals +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.444558143615723 seconds. +- Overall skill 0.335105; relative MASE 0.796743; relative WQL 0.554866. +- term skill: long=0.4010, medium=0.3564, short=0.2994. +- domain skill: Econ/Fin=0.1646, Energy=0.2213, Healthcare=0.4212, Nature=0.3540, Sales=0.3970, Transport=0.3770, Web/CloudOps=0.4538. +- frequency skill: A=0.3179, D=0.3541, H=0.3610, M=0.1841, Q=0.2288, S=0.3371, T=0.3395, W=0.2758. +- variates skill: multivariate=0.3510, univariate=0.3221. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison recent_normalization_recovery backcast2_evals +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.86247205734253 seconds. +- Overall skill 0.361614; relative MASE 0.766245; relative WQL 0.531861. +- term skill: long=0.3676, medium=0.3942, short=0.3463. +- domain skill: Econ/Fin=0.1074, Energy=0.2351, Healthcare=0.3566, Nature=0.4647, Sales=0.5547, Transport=0.4203, Web/CloudOps=0.4480. +- frequency skill: A=0.3496, D=0.4310, H=0.3890, M=0.1517, Q=0.1448, S=0.2876, T=0.3677, W=0.2567. +- variates skill: multivariate=0.3709, univariate=0.3540. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_control_fixed128 backcast_evals +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.399088382720947 seconds. +- Overall skill 0.335548; relative MASE 0.797825; relative WQL 0.553375. +- term skill: long=0.3998, medium=0.3578, short=0.3002. +- domain skill: Econ/Fin=0.1618, Energy=0.2279, Healthcare=0.4256, Nature=0.3575, Sales=0.3966, Transport=0.3721, Web/CloudOps=0.4487. +- frequency skill: A=0.3187, D=0.3539, H=0.3656, M=0.1845, Q=0.2285, S=0.3427, T=0.3351, W=0.2751. +- variates skill: multivariate=0.3528, univariate=0.3215. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_control_fixed128 backcast2_evals +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.050649642944336 seconds. +- Overall skill 0.359190; relative MASE 0.769269; relative WQL 0.533801. +- term skill: long=0.3663, medium=0.3893, short=0.3445. +- domain skill: Econ/Fin=0.1046, Energy=0.2371, Healthcare=0.3554, Nature=0.4689, Sales=0.5535, Transport=0.4194, Web/CloudOps=0.4333. +- frequency skill: A=0.3493, D=0.4307, H=0.3894, M=0.1531, Q=0.1429, S=0.2835, T=0.3601, W=0.2577. +- variates skill: multivariate=0.3643, univariate=0.3551. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_8192 backcast_evals +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.02571153640747 seconds. +- Overall skill 0.335778; relative MASE 0.796740; relative WQL 0.553746. +- term skill: long=0.4000, medium=0.3562, short=0.3012. +- domain skill: Econ/Fin=0.1625, Energy=0.2211, Healthcare=0.4240, Nature=0.3584, Sales=0.3963, Transport=0.3783, Web/CloudOps=0.4528. +- frequency skill: A=0.3183, D=0.3550, H=0.3608, M=0.1825, Q=0.2283, S=0.3383, T=0.3410, W=0.2775. +- variates skill: multivariate=0.3516, univariate=0.3229. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_8192 backcast2_evals +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.033729791641235 seconds. +- Overall skill 0.361619; relative MASE 0.766647; relative WQL 0.531576. +- term skill: long=0.3678, medium=0.3937, short=0.3464. +- domain skill: Econ/Fin=0.1060, Energy=0.2331, Healthcare=0.3615, Nature=0.4677, Sales=0.5540, Transport=0.4209, Web/CloudOps=0.4469. +- frequency skill: A=0.3484, D=0.4320, H=0.3875, M=0.1537, Q=0.1444, S=0.2887, T=0.3679, W=0.2592. +- variates skill: multivariate=0.3695, univariate=0.3552. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +E81 main: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3792404374337234, "rel_mase_gmean": 0.7413362113099933, "rel_wql_gmean": 0.5197944315124549, "groups": {"term": {"short": 0.3580501678473965, "medium": 0.4075051608812147, "long": 0.40436165270683755}, "domain": {"Econ/Fin": 0.14514965737880325, "Energy": 0.23693703384364162, "Healthcare": 0.4508892358362413, "Nature": 0.43068317186356664, "Sales": 0.3372290847442204, "Transport": 0.46921029381701185, "Web/CloudOps": 0.5049832577126345}, "freq": {"A-DEC": 0.3741084316720569, "Q-DEC": 0.2032048606604645, "M": 0.09063626527124269, "W-SUN": 0.11024985736894433, "D": 0.35966521985300126, "H": 0.39764382964309264, "15T": 0.21216406035245483, "W-FRI": -0.006517286299776881, "10T": 0.6144670200764979, "W-TUE": 0.5505379760713061, "W-THU": 0.20290227669295913, "W-WED": 0.3148429295780334, "5T": 0.5200294927472697, "10S": 0.42580083885860065}}, "cpu_seconds": 1.3077636559028178, "members": ["/workspace/research/evals/slow_ar_delta6k", "/workspace/research/evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 backcast: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3372609628923202, "rel_mase_gmean": 0.7949387478174683, "rel_wql_gmean": 0.5525243706037937, "groups": {"term": {"short": 0.30267748548708406, "medium": 0.3587870572492281, "long": 0.4004504376989413}, "domain": {"Econ/Fin": 0.16791580188275335, "Energy": 0.2249147271500851, "Healthcare": 0.41565091499514417, "Nature": 0.36337531871749584, "Sales": 0.3953576986774914, "Transport": 0.37558039099633533, "Web/CloudOps": 0.45422426929296467}, "freq": {"A-DEC": 0.3198896505754395, "Q-DEC": 0.2324966250821987, "M": 0.1868807358115966, "W-SUN": 0.05675657061089712, "D": 0.35253814976953, "H": 0.3643205260222693, "15T": 0.2214260132321374, "W-FRI": 0.25870400902354673, "10T": 0.32373236597235966, "W-TUE": 0.534873854215015, "W-THU": 0.23833675077582528, "W-WED": 0.34309889609685684, "5T": 0.44852116184278545, "10S": 0.34093317446682636}}, "cpu_seconds": 0.9129793490283191, "members": ["/workspace/research/backcast_evals/slow_ar_delta6k", "/workspace/research/backcast_evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 backcast2: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.36253066634723885, "rel_mase_gmean": 0.7663699578325764, "rel_wql_gmean": 0.5302493230514544, "groups": {"term": {"short": 0.3479807306166687, "medium": 0.39255912185019026, "long": 0.3693846383480154}, "domain": {"Econ/Fin": 0.1149608358698847, "Energy": 0.23668310113177404, "Healthcare": 0.35088547046370666, "Nature": 0.47069187269468127, "Sales": 0.5515284168852219, "Transport": 0.42149224872299274, "Web/CloudOps": 0.44469672192663035}, "freq": {"A-DEC": 0.3516200787127538, "Q-DEC": 0.14815814613753098, "M": 0.1464874832493296, "W-SUN": 0.06348262953040695, "D": 0.4307487103712574, "H": 0.3906466140437964, "15T": 0.10333300498128906, "W-FRI": 0.155407323458577, "10T": 0.5012397694349602, "W-TUE": 0.09030520980227696, "W-THU": 0.32093855640615543, "W-WED": 0.5365268550523004, "5T": 0.4842228628098807, "10S": 0.2879093531003366}}, "cpu_seconds": 0.9467690440360457, "members": ["/workspace/research/backcast2_evals/slow_ar_delta6k", "/workspace/research/backcast2_evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 actual candidate hash500fdde392c269ef1a6830477580bc7890b711824097ac711885bf0220e657cb,73,598,528parameters, contains original4096 E76 and recent-normalized8192 E65. Full package replay and relocation verification started. Candidate-only, submission unchanged. + +## E71 patch8 at3000 +- Checkpoint SHA-256: `5be1ccd5e5539619e4f5ff221a4088437e7267ceb34928015a0348187e4a575e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.875902891159058 seconds. +- Overall skill 0.378312; relative MASE 0.744947; relative WQL 0.518823. +- term skill: long=0.4027, medium=0.4023, short=0.3592. +- domain skill: Econ/Fin=0.1391, Energy=0.2401, Healthcare=0.4515, Nature=0.4387, Sales=0.3471, Transport=0.4584, Web/CloudOps=0.4997. +- frequency skill: A=0.3807, D=0.3546, H=0.3955, M=0.0952, Q=0.1935, S=0.4235, T=0.4386, W=0.2325. +- variates skill: multivariate=0.3942, univariate=0.3653. +- Outcome: Seed197, interrupted then full-state resumed at2000. Main0.378312 essentially matches E67paired16-point3000 at0.378318. Continue to6000; no publication on this near tie. + +Recovery-frequency change verified on the tiny permitted-data fixture: { "maximum_model_difference": 1.5543122344752192e-15, "maximum_ema_difference": 3.0531133177191805e-16, "batch_rng_equal": true, "sampler_rng_equal": true, "seconds": 29.735046536196023, "selection_checkpoint_every": 4, "recovery_checkpoint_every": 2, "fixture_only": true }; increasing recovery-state saves preserves the sampler stream and model/EMA up to measured GPU roundoff. Newly launched jobs default to complete-state saves every250steps, while selection weights remain every1000. Already-running processes retain their original code/schedule. + +## E82 final slow-AR correction transfer — predeclared comparison +When E61 completes12000, replace the6000-step correction with its12000-step counterpart: E67paired3000 + E61slowAR12000 - E42partial12000, coefficient1.0, confidence-only tensor retained from base. This is the already-planned final matched comparison, not addition on top of E76. No coefficient sweep or further training. Check all four screening cutoffs, then full public package only if justified. slow_ar_final_comparison.py executes the fixed composition and screens after the atomic EMA exists. + +## E81 equal long-history ensemble full package +- Checkpoint SHA-256: `500fdde392c269ef1a6830477580bc7890b711824097ac711885bf0220e657cb`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.375233; relative MASE 0.744322; relative WQL 0.524415. +- term skill: long=0.3984, medium=0.4064, short=0.3536. +- domain skill: Econ/Fin=0.1215, Energy=0.2298, Healthcare=0.4558, Nature=0.4307, Sales=0.3504, Transport=0.4695, Web/CloudOps=0.4976. +- frequency skill: A=0.2913, D=0.3631, H=0.3929, M=0.1149, Q=0.1839, S=0.4258, T=0.4330, W=0.2096. +- variates skill: multivariate=0.3929, univariate=0.3608. +- Outcome: Reject for publication: full0.375233 is below selected E76 0.375612, despite first/second-earlier gains. All97configs/151170instances valid, zero crossings. Public inference213.940586s on shared H100. No coefficient sweep; retain singleton E76. + +volatility_synth started 2026-10-23T02:55:46.196186+00:00 after long_memory_synth_recovery completed. Original predeclared settings and seed retained. + +## E75 corrected postloss first1000 +- Checkpoint SHA-256: `d33a29e773434d2f0faf2bc85b73151354dcb98bedc83f28c44e776835310afa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.844736576080322 seconds. +- Overall skill 0.376671; relative MASE 0.745163; relative WQL 0.521416. +- term skill: long=0.3992, medium=0.4062, short=0.3560. +- domain skill: Econ/Fin=0.1257, Energy=0.2385, Healthcare=0.4569, Nature=0.4304, Sales=0.3363, Transport=0.4666, Web/CloudOps=0.4975. +- frequency skill: A=0.3694, D=0.3556, H=0.3962, M=0.0824, Q=0.1976, S=0.4232, T=0.4357, W=0.2250. +- variates skill: multivariate=0.3926, univariate=0.3637. +- Outcome: Finite training after the verified normalization fallback. Main0.376671 is slightly below E67paired1000 at0.376860; continue to3000/6000, with newly queued overflow-only E80 control needed to isolate the objective. + +paired_long_memory started 2026-10-23T02:56:31.210459+00:00 after wide_capacity_control_recovery completed. Original predeclared settings and seed retained. + +## E61 slowAR final12000 +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.156561374664307 seconds. +- Overall skill 0.362914; relative MASE 0.759071; relative WQL 0.534704. +- term skill: long=0.3926, medium=0.4046, short=0.3342. +- domain skill: Econ/Fin=0.1187, Energy=0.1874, Healthcare=0.4331, Nature=0.4271, Sales=0.3429, Transport=0.4595, Web/CloudOps=0.5091. +- frequency skill: A=0.3722, D=0.3472, H=0.3824, M=0.1132, Q=0.2021, S=0.4423, T=0.4070, W=0.2137. +- variates skill: multivariate=0.3958, univariate=0.3355. +- Outcome: Seed79; main0.362914 improves matched E42partial12000 at0.361108. Completed final resumed phase569.4896 training-loop seconds; prior interrupted phase logs retained. E82 transfers the final matched correction to selected paired3000, compared with the already published6000 correction. + +E75 overflow source replay identifies bitcoin_with_missing (seed197,step53,row37), with daily periods7/365 and observed values from6.0e11 to2.28e18. These scales can be legitimate crypto quantities; no data-cleaning or filtering rule is inferred. Source diagnostic0.9295CPU seconds, no optimizer updates. The numerical fallback addresses the representation range. + +E81 relocated package checks passed: three example configurations bitwise equal, finite and monotone,21.2942s. Third-earlier cached ensemble0.389488 slightly exceeds E76 0.389281, but main/full remain lower, so the publication decision remains rejection. The long-history member alone scores0.386764 at this third cutoff. + +## E58/E66 recovered37M control final32000 +- Checkpoint SHA-256: `570983ddd4f6d8e136906f1669798d938ecd93738da55f624afc5b25606249bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.769165754318237 seconds. +- Overall skill 0.375305; relative MASE 0.746308; relative WQL 0.522900. +- term skill: long=0.3997, medium=0.4059, short=0.3535. +- domain skill: Econ/Fin=0.1400, Energy=0.2324, Healthcare=0.4362, Nature=0.4284, Sales=0.3384, Transport=0.4676, Web/CloudOps=0.5011. +- frequency skill: A=0.3825, D=0.3508, H=0.3940, M=0.0846, Q=0.2029, S=0.4232, T=0.4370, W=0.2159. +- variates skill: multivariate=0.3936, univariate=0.3604. +- Outcome: Final0.375305 below E47parent0.375793 and own24000 at0.375681. Final resumed phase616.7562 training-loop seconds; prior phase logs retained. No publication. Its allocation now trains E77pairedslowAR. + +E61 final12k EMA hashc27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e. Last resumed phase569.4895656s; phase2 reached10850 in767.8s, phase1 reached8450 in3037.0s, original pre-recovery attempt reached2150 in542.2s. These are overlapping process elapsed times, with discarded unsaved updates counted as spent compute; not exclusive GPU seconds. E65 final resumed phase708.0175s, prior phases3034.3s and71.8s. + +## E82 slowAR final correction evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.064879655838013 seconds. +- Overall skill 0.379181; relative MASE 0.741695; relative WQL 0.519643. +- term skill: long=0.4028, medium=0.4057, short=0.3593. +- domain skill: Econ/Fin=0.1465, Energy=0.2342, Healthcare=0.4607, Nature=0.4319, Sales=0.3354, Transport=0.4660, Web/CloudOps=0.5068. +- frequency skill: A=0.3720, D=0.3593, H=0.3969, M=0.1007, Q=0.1994, S=0.4227, T=0.4390, W=0.2245. +- variates skill: multivariate=0.3977, univariate=0.3640. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.045677423477173 seconds. +- Overall skill 0.336511; relative MASE 0.796069; relative WQL 0.552989. +- term skill: long=0.3975, medium=0.3593, short=0.3024. +- domain skill: Econ/Fin=0.1707, Energy=0.2251, Healthcare=0.4072, Nature=0.3664, Sales=0.3935, Transport=0.3727, Web/CloudOps=0.4527. +- frequency skill: A=0.3195, D=0.3490, H=0.3653, M=0.1930, Q=0.2358, S=0.3419, T=0.3374, W=0.2844. +- variates skill: multivariate=0.3537, univariate=0.3225. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast2_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.12555480003357 seconds. +- Overall skill 0.360111; relative MASE 0.768417; relative WQL 0.532858. +- term skill: long=0.3671, medium=0.3887, short=0.3461. +- domain skill: Econ/Fin=0.1203, Energy=0.2346, Healthcare=0.3518, Nature=0.4695, Sales=0.5471, Transport=0.4199, Web/CloudOps=0.4385. +- frequency skill: A=0.3524, D=0.4264, H=0.3900, M=0.1434, Q=0.1516, S=0.2859, T=0.3636, W=0.2642. +- variates skill: multivariate=0.3674, univariate=0.3541. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast3_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 23.64928960800171 seconds. +- Overall skill 0.389784; relative MASE 0.736377; relative WQL 0.505671. +- term skill: long=0.3953, medium=0.3617, short=0.3980. +- domain skill: Econ/Fin=0.1860, Energy=0.3200, Healthcare=0.2362, Nature=0.5068, Sales=0.3992, Transport=0.5052, Web/CloudOps=0.3945. +- frequency skill: A=0.3688, D=0.4453, H=0.4034, M=0.1130, Q=0.2642, S=0.2924, T=0.4309, W=0.2637. +- variates skill: multivariate=0.3749, univariate=0.4013. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +E82 composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/full_paired_candidate/ema003000.pt": "2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238", "/workspace/research/runs/long_memory_synth_recovery/ema012000.pt": "c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e", "/workspace/research/runs/partial_targets/ema012000.pt": "a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837"}, "seconds": 1.2579920410644263} + +## E61 slowAR final12k backcast_evals +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.161132097244263 seconds. +- Overall skill 0.332462; relative MASE 0.802575; relative WQL 0.555221. +- term skill: long=0.3889, medium=0.3582, short=0.2991. +- domain skill: Econ/Fin=0.1592, Energy=0.2274, Healthcare=0.4159, Nature=0.3553, Sales=0.3990, Transport=0.3647, Web/CloudOps=0.4455. +- frequency skill: A=0.3164, D=0.3542, H=0.3581, M=0.1781, Q=0.2386, S=0.3429, T=0.3325, W=0.2793. +- variates skill: multivariate=0.3483, univariate=0.3196. +- Outcome: Final direct slow-AR improves E42partial12k on both earlier cutoffs:0.332462 versus0.331074 and0.354079 versus0.353096. Matched synthetic-prior benefit survives the full schedule, while transferring its final delta is weaker than transferring6000 at the selected backbone. + +## E61 slowAR final12k backcast2_evals +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.80446219444275 seconds. +- Overall skill 0.354079; relative MASE 0.774604; relative WQL 0.538615. +- term skill: long=0.3715, medium=0.3752, short=0.3393. +- domain skill: Econ/Fin=0.1039, Energy=0.2274, Healthcare=0.3615, Nature=0.4600, Sales=0.5536, Transport=0.4138, Web/CloudOps=0.4332. +- frequency skill: A=0.3506, D=0.4274, H=0.3872, M=0.1661, Q=0.1581, S=0.2852, T=0.3480, W=0.2482. +- variates skill: multivariate=0.3615, univariate=0.3480. +- Outcome: Final direct slow-AR improves E42partial12k on both earlier cutoffs:0.332462 versus0.331074 and0.354079 versus0.353096. Matched synthetic-prior benefit survives the full schedule, while transferring its final delta is weaker than transferring6000 at the selected backbone. + +E73 usage diagnostic on8allowed-corpus windows,seed337,C512,H128,5.8388CPU seconds,0optimizer updates: initial added-head contribution is zero; atEMA2000 its output RMS is0.00924times the inherited head contribution. Cross-stream query-weight norm rises from0 to0.01672times within-stream norm; head-input streams remain distinct (relative RMS difference1.4274). Distinct features are being used, but this alone does not establish validation improvement. Full receipt wide_graft_usage2k.json includes hashes. + +## E75 corrected postloss3000 +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.580218076705933 seconds. +- Overall skill 0.378814; relative MASE 0.742602; relative WQL 0.519622. +- term skill: long=0.4027, medium=0.4070, short=0.3582. +- domain skill: Econ/Fin=0.1222, Energy=0.2441, Healthcare=0.4509, Nature=0.4321, Sales=0.3355, Transport=0.4650, Web/CloudOps=0.5021. +- frequency skill: A=0.3710, D=0.3521, H=0.4006, M=0.0768, Q=0.1947, S=0.4220, T=0.4401, W=0.2249. +- variates skill: multivariate=0.3963, univariate=0.3645. +- Outcome: Main0.378814 exceeds original E67paired3000 at0.378318, but remains below selected E76 at0.379721. Check earlier cutoffs; numerical-only control E80 remains queued, so causal attribution to postprocessing loss is provisional. + +## E83 combine postprocessing-aware3000 with the selected slow-AR6000 correction +E75 improves the original paired3000 main screen, while E76 demonstrates that the matched slow-AR6000 correction transfers across cutoffs. Test a fixed composition: E75postloss3000 + E61slowAR6000 - E42partial6000. Keep E75 confidence parameters, its verified overflow fallback and all inference rules. Coefficient1.0, no sweep; evaluate all four screening cutoffs before full replay/publication. This is a predictive composition test; E80 is still needed to separate the numerical correction from the postprocessing-aware loss. No additional training or validation gradients. + +## E77 pairedslowAR first1000 +- Checkpoint SHA-256: `278af3b837eee9032d80e20e70dc9155bd1f272983232826f16ff9df95547846`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.467870473861694 seconds. +- Overall skill 0.377046; relative MASE 0.744404; relative WQL 0.521319. +- term skill: long=0.3994, medium=0.4062, short=0.3566. +- domain skill: Econ/Fin=0.1382, Energy=0.2363, Healthcare=0.4530, Nature=0.4321, Sales=0.3345, Transport=0.4673, Web/CloudOps=0.4987. +- frequency skill: A=0.3685, D=0.3562, H=0.3951, M=0.1012, Q=0.1989, S=0.4234, T=0.4360, W=0.2232. +- variates skill: multivariate=0.3931, univariate=0.3639. +- Outcome: Seed197/B64/LR2e-5; main0.377046 slightly exceeds original paired1000 at0.376860. Early checkpoint only; continue matched3000/6000/12000 comparison. + +## E75 postloss3000 backcast_evals +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.485270261764526 seconds. +- Overall skill 0.333947; relative MASE 0.800204; relative WQL 0.554393. +- term skill: long=0.3971, medium=0.3587, short=0.2981. +- domain skill: Econ/Fin=0.1484, Energy=0.2303, Healthcare=0.3976, Nature=0.3612, Sales=0.3967, Transport=0.3722, Web/CloudOps=0.4461. +- frequency skill: A=0.3136, D=0.3467, H=0.3696, M=0.1659, Q=0.2280, S=0.3365, T=0.3319, W=0.2801. +- variates skill: multivariate=0.3510, univariate=0.3200. +- Outcome: Both earlier cutoffs regress against original E67paired3000:0.333947 versus0.335739 and0.357605 versus0.358235, exceeding the main gain. Prune corrected postloss continuation, preserve complete recovery and checkpoints, and release its allocation to E78multiscale. E83 composition screening continues; E80 numerical-only control remains needed for attribution. + +## E75 postloss3000 backcast2_evals +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.475824117660522 seconds. +- Overall skill 0.357605; relative MASE 0.772196; relative WQL 0.534413. +- term skill: long=0.3631, medium=0.3873, short=0.3437. +- domain skill: Econ/Fin=0.1041, Energy=0.2395, Healthcare=0.3227, Nature=0.4712, Sales=0.5519, Transport=0.4212, Web/CloudOps=0.4278. +- frequency skill: A=0.3532, D=0.4162, H=0.3932, M=0.1558, Q=0.1493, S=0.2753, T=0.3604, W=0.2566. +- variates skill: multivariate=0.3621, univariate=0.3540. +- Outcome: Both earlier cutoffs regress against original E67paired3000:0.333947 versus0.335739 and0.357605 versus0.358235, exceeding the main gain. Prune corrected postloss continuation, preserve complete recovery and checkpoints, and release its allocation to E78multiscale. E83 composition screening continues; E80 numerical-only control remains needed for attribution. + +multiscale_ar seed197 training started at 2026-10-23T03:01:47Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E75 stop receipt: {"experiment": "E75 corrected postloss stopped", "step": 3653, "checkpoint_sha256": "760314a6d65350417c4a58e32eb21cebaac953dc83820d300a4b6b24b0977cb1", "weights": "/workspace/research/runs/postloss/ema003653.pt", "recovery": "/workspace/research/runs/postloss/recovery.pt", "training_loop_final_record": {"completed_step": 3653, "training_process_loop_seconds": 799.9150489440653}, "process_receipt": {"command": ["python3", "/workspace/research/recovery/train.py", "--code-dir", "/workspace/research/postloss", "--packed", "/workspace/research/packed_sample", "--source-weights-from", "/workspace/research/packed_sample", "--out", "/workspace/research/runs/postloss", "--initialize-from", "/workspace/research/horizon_delta12k.pt", "--steps", "12000", "--batch", "64", "--lr", "2e-05", "--seed", "197", "--stop-file", "/workspace/research/postloss.stop", "--loss-mode", "paired"], "status": "complete", "pid": 1280, "log": "/workspace/research/postloss_recovery3.log", "started_utc": "2026-10-23T02:48:16Z", "note": "Restart own E62 initialization after verified float32 variance-overflow correction; original seed and recipe unchanged.", "returncode": 0, "process_seconds": 810.3138020890765}, "outcome": "Both earlier3000 cutoffs regress; E83 saved-checkpoint composition remains in screening, E80 numerical control queued."} + +## E83 postloss+slowAR evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.666229724884033 seconds. +- Overall skill 0.380251; relative MASE 0.741085; relative WQL 0.518280. +- term skill: long=0.4038, medium=0.4070, short=0.3603. +- domain skill: Econ/Fin=0.1348, Energy=0.2414, Healthcare=0.4552, Nature=0.4344, Sales=0.3382, Transport=0.4643, Web/CloudOps=0.5059. +- frequency skill: A=0.3743, D=0.3567, H=0.4003, M=0.0763, Q=0.1987, S=0.4254, T=0.4419, W=0.2242. +- variates skill: multivariate=0.3980, univariate=0.3658. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.061537742614746 seconds. +- Overall skill 0.335421; relative MASE 0.797508; relative WQL 0.553807. +- term skill: long=0.3950, medium=0.3597, short=0.3013. +- domain skill: Econ/Fin=0.1640, Energy=0.2281, Healthcare=0.3974, Nature=0.3657, Sales=0.3962, Transport=0.3713, Web/CloudOps=0.4494. +- frequency skill: A=0.3211, D=0.3463, H=0.3688, M=0.1723, Q=0.2313, S=0.3404, T=0.3344, W=0.2853. +- variates skill: multivariate=0.3526, univariate=0.3214. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast2_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.91576099395752 seconds. +- Overall skill 0.360099; relative MASE 0.769700; relative WQL 0.531990. +- term skill: long=0.3671, medium=0.3869, short=0.3468. +- domain skill: Econ/Fin=0.1196, Energy=0.2390, Healthcare=0.3200, Nature=0.4758, Sales=0.5509, Transport=0.4203, Web/CloudOps=0.4338. +- frequency skill: A=0.3513, D=0.4228, H=0.3920, M=0.1454, Q=0.1495, S=0.2810, T=0.3646, W=0.2628. +- variates skill: multivariate=0.3658, univariate=0.3555. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast3_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 23.31220841407776 seconds. +- Overall skill 0.389069; relative MASE 0.739022; relative WQL 0.505041. +- term skill: long=0.3936, medium=0.3628, short=0.3969. +- domain skill: Econ/Fin=0.1785, Energy=0.3245, Healthcare=0.2109, Nature=0.5039, Sales=0.4010, Transport=0.5082, Web/CloudOps=0.3908. +- frequency skill: A=0.3606, D=0.4409, H=0.4062, M=0.1151, Q=0.2596, S=0.2759, T=0.4323, W=0.2589. +- variates skill: multivariate=0.3734, univariate=0.4011. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +E83 CPU composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb"}, "seconds": 1.0092943429481238} + +## E83 postprocessing-aware3000 plus slowAR6000 full public-package replay +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.376131; relative MASE 0.743936; relative WQL 0.523180. +- term skill: long=0.3978, medium=0.4059, short=0.3557. +- domain skill: Econ/Fin=0.1127, Energy=0.2338, Healthcare=0.4604, Nature=0.4345, Sales=0.3517, Transport=0.4644, Web/CloudOps=0.4981. +- frequency skill: A=0.2909, D=0.3608, H=0.3952, M=0.1011, Q=0.1844, S=0.4254, T=0.4346, W=0.2165. +- variates skill: multivariate=0.3936, univariate=0.3619. +- Outcome: Publish as best full primary validation: skill0.376130733 versus E76 0.375612348; relMASE0.743936224 and relWQL0.523180415, 97 configurations/151170 instances, zero failures. Public inference120.396952s; independent relocation14.861885s gave bitwise equal finite ordered forecasts on three examples. All three earlier cutoffs regress versus E76, so this is a narrow primary-validation selection, not evidence of broad temporal improvement. Keep E76 as the more stable rollback. No training in this composition; coefficient1.0 fixed, source training seeds197/79; hashes and parent compute above. E80 numerical-only control remains queued. + +E83 descriptive cluster comparison: {"candidate": "/workspace/research/valid-report-postloss-slow-ar.json", "parent": "/workspace/research/valid-report-slow-ar-delta6k.json", "candidate_hash": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "parent_hash": "8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105", "skill_difference": 0.0005183850211532004, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 51, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": -0.0027720070621055277, "p50": 0.0002985771391603165, "p975": 0.004193731829011101}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E58/E66 recovered146M at global24000 +- Checkpoint SHA-256: `8f9a786a85c8fcd3d4aaba9e5651a68b6f2df74d5cdc0e30907a4293dd297492`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 37.02190327644348 seconds. +- Overall skill 0.375978; relative MASE 0.744657; relative WQL 0.522931. +- term skill: long=0.4006, medium=0.4073, short=0.3537. +- domain skill: Econ/Fin=0.1411, Energy=0.2353, Healthcare=0.4235, Nature=0.4300, Sales=0.3398, Transport=0.4674, Web/CloudOps=0.5021. +- frequency skill: A=0.3775, D=0.3521, H=0.3962, M=0.0785, Q=0.2030, S=0.4233, T=0.4372, W=0.2148. +- variates skill: multivariate=0.3957, univariate=0.3598. +- Outcome: Matched 37M control24000 is0.375680951 and original E47parent0.375792930. Widened model0.375977511 is modestly higher; continue planned32000, no publication against stronger E83. Seed113 then recovery reset179, batch96, baseLR3e-5; complete recovery retained. + +## E73 independent feature stream first4000 +- Checkpoint SHA-256: `c16f146c285d9e5c8c9ae60e54af3d9d1dae3f48e1cf2104e37676062df8ad5e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.91307091712952 seconds. +- Overall skill 0.372085; relative MASE 0.750057; relative WQL 0.525664. +- term skill: long=0.3976, medium=0.4060, short=0.3484. +- domain skill: Econ/Fin=0.1401, Energy=0.2348, Healthcare=0.4070, Nature=0.4248, Sales=0.3416, Transport=0.4634, Web/CloudOps=0.4971. +- frequency skill: A=0.3733, D=0.3439, H=0.3937, M=0.0971, Q=0.1987, S=0.4185, T=0.4336, W=0.2014. +- variates skill: multivariate=0.3914, univariate=0.3563. +- Outcome: Main0.372084568 regresses versus own function-preserving initialization0.375792503 and original-width parent. New-stream usage was nonzero at2000; use planned8000 to distinguish transient feature learning from persistent degradation. Seed113/B96/LR3e-5, compiled static loss; no publication. + +## E78 multiscale AR first1000 +- Checkpoint SHA-256: `a3c57dba6318728692a87990bf652a9a8469fa4fb24bf925e79a6f72510936d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.617778062820435 seconds. +- Overall skill 0.377072; relative MASE 0.744319; relative WQL 0.521335. +- term skill: long=0.3993, medium=0.4061, short=0.3568. +- domain skill: Econ/Fin=0.1341, Energy=0.2362, Healthcare=0.4612, Nature=0.4310, Sales=0.3345, Transport=0.4671, Web/CloudOps=0.4985. +- frequency skill: A=0.3662, D=0.3563, H=0.3950, M=0.1046, Q=0.1987, S=0.4232, T=0.4355, W=0.2248. +- variates skill: multivariate=0.3928, univariate=0.3643. +- Outcome: Main0.377071682 is effectively tied with E77 single slowAR1000 at0.377046018 and above E67 original AR1000 at0.376859515. Early checkpoint, continue matched3000/6000/12000. Seed197, extraRNG700200, B64/LR2e-5, unchanged corpus and main/horizon RNG. + +## E84 daily and weekly aggregation of permitted real series +Hypothesis: the original two/four-fold aggregation rarely exposes coarse energy and other dynamics. On20% of real rows, independently consider a daily or weekly block average of the same allowed series at the original cutoff. Only exact integral frequency ratios are used; require8 context blocks and1 future block. Select equally among eligible daily/weekly choices. Finite-value averages use float64 sums and disjoint past/future blocks. Context and target can be shorter than requested and remain masked; periods become[7,365] or[52,1]. All original sampling/random draws and original local synthetic windows remain unchanged; extra RNGseed900200. Planned own E62 initialization, seed197, paired B64, LR2e-5/12000steps match E67. This tests coarser real-series augmentation, not additional external data. Queue after E77 to stay within one H100. +Training-only fixture: {"seed": 197, "aggregation_seed": 900200, "diagnostic_shapes_seed": 331, "cpu_seconds": 3.8464299628976732, "rows": 4096, "aggregated_rows": 459, "main_and_horizon_rng_matched": true, "nonaggregated_rows_bitwise_equal": true, "changing_future_does_not_change_context": true, "before_period_counts": {"(24, 168)": 932, "(1440, 10080)": 160, "(288, 2016)": 805, "(12, 1)": 214, "(48, 336)": 249, "(4, 1)": 235, "(7, 365)": 513, "(96, 672)": 244, "(52, 1)": 148, "(144, 1008)": 149, "(2, 91)": 5, "(1, 1)": 153, "(900, 21600)": 23, "(360, 8640)": 73, "(4, 28)": 54, "(12, 84)": 30, "(720, 5040)": 14, "(6, 42)": 24, "(360, 2520)": 7, "(450, 10800)": 3, "(72, 504)": 51, "(4, 182)": 6, "(36, 252)": 3, "(1, 7)": 1}, "after_period_counts": {"(52, 1)": 352, "(1440, 10080)": 131, "(288, 2016)": 692, "(12, 1)": 214, "(48, 336)": 231, "(4, 1)": 235, "(7, 365)": 704, "(96, 672)": 223, "(24, 168)": 778, "(1, 1)": 153, "(900, 21600)": 23, "(360, 8640)": 73, "(144, 1008)": 133, "(4, 28)": 38, "(12, 84)": 26, "(720, 5040)": 10, "(360, 2520)": 6, "(450, 10800)": 3, "(72, 504)": 41, "(2, 91)": 3, "(4, 182)": 6, "(36, 252)": 3, "(6, 42)": 17, "(1, 7)": 1}, "factor_counts": {"168": 73, "288": 97, "2016": 37, "7": 66, "1440": 26, "24": 90, "48": 14, "96": 20, "28": 12, "144": 4, "336": 6, "4": 4, "10080": 8, "1008": 1, "672": 1}, "aggregated_context_percentiles": [8.0, 48.0, 4096.0], "aggregated_target_percentiles": [1.0, 60.0, 1024.0], "optimizer_updates": 0} + +## E71 patch8 at6000 +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.29093050956726 seconds. +- Overall skill 0.381179; relative MASE 0.741215; relative WQL 0.516638. +- term skill: long=0.4036, medium=0.4049, short=0.3630. +- domain skill: Econ/Fin=0.1328, Energy=0.2446, Healthcare=0.4760, Nature=0.4387, Sales=0.3481, Transport=0.4598, Web/CloudOps=0.5005. +- frequency skill: A=0.3764, D=0.3587, H=0.3961, M=0.1191, Q=0.1895, S=0.4235, T=0.4409, W=0.2396. +- variates skill: multivariate=0.3970, univariate=0.3683. +- Outcome: Main0.381178739 exceeds matched E67paired6000 0.378455389 and selected E83main0.380250568. Test all three earlier cutoffs and full public replay before publication. Architecture change only; seed197/B64/LR2e-5; checkpoints resumed with full optimizer and RNG state. + +## E77 paired slowAR at3000 +- Checkpoint SHA-256: `0691cb2a1f55203c949dcdd159bc9da17d56a3cccbba57fa2c61a9f74b769376`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.542114734649658 seconds. +- Overall skill 0.378238; relative MASE 0.743200; relative WQL 0.520166. +- term skill: long=0.4019, medium=0.4056, short=0.3580. +- domain skill: Econ/Fin=0.1408, Energy=0.2382, Healthcare=0.4444, Nature=0.4319, Sales=0.3325, Transport=0.4662, Web/CloudOps=0.5040. +- frequency skill: A=0.3686, D=0.3549, H=0.3971, M=0.0926, Q=0.1967, S=0.4234, T=0.4392, W=0.2222. +- variates skill: multivariate=0.3972, univariate=0.3627. +- Outcome: Main0.378238485 is slightly below original E67paired3000 0.378318033; continue planned6000 before choosing. Seed197/B64/LR2e-5, main and requested-horizon sampling matched. + +## E85 transfer the slow-AR correction to the finer-patch model +E71patch8 at6000 improves the main screen and first earlier cutoff. E76 previously showed a matched slow-AR6000 correction improves all four cutoffs on patch16. Test one fixed composition: patch8_6000 + fold16to8(slowAR6000 - partial6000), where the linear fold is exactly E71 initialization: sum projection halves, retain first8 output positions, other tensors unchanged. Confidence parameters remain those of patch8. This is a transfer hypothesis, not exact function preservation. Coefficient1 with no sweep, original inference rules, all four cutoffs before full replay/publication. No new optimizer updates or random draws; original training seeds197 and79. Script patch8_delta/merge.py and all parent hashes retained. + +## E86 learn the added feature stream while freezing inherited parameters — prepared +E73 at4000 underperforms its function-preserving starting model despite using the new stream. Hypothesis: a low-rate update of every parameter disturbs the mature function while learning the random additions too slowly. Reuse exactly E73 independent-stream initialization, but protect all36,800,800 inherited entries and train the109,676,544 new/cross-stream entries atLR2e-4 for8000steps. Original seed113/B96/source/context/horizon/loss unchanged. This changes trainable scope and learning rate together and is a method comparison, not a one-factor causal attribution. Gradient entries for protected blocks are zeroed before clipping; inherited values are restored after AdamW to cancel its weight decay. References reconstruct from the saved checkpoint on resume. All outputs still come from one146M model; inference has no adaptation or freezing machinery. Await E73next8000 before allocation. +Fixture on6 allowed-corpus windows, discarded copy only: {"cpu_seconds": 8.51362281711772, "seed": 347, "optimizer_updates_on_discarded_fixture_copy": 3, "allowed_corpus_windows": 6, "protected_parameters": 36800800, "trainable_parameters": 109676544, "all_inherited_parameters_bitwise_equal_to_parent": true, "recovery_reference_reconstruction_equal": true, "new_head_max_change": 0.0006009560311213136, "losses": [0.3154084384441376, 0.5418640375137329, 3.4678804874420166], "selection_checkpoint_written": false} + +## E71 patch8 at6000 first earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 31.848629474639893 seconds. +- Overall skill 0.337263; relative MASE 0.796725; relative WQL 0.551283. +- term skill: long=0.4004, medium=0.3547, short=0.3044. +- domain skill: Econ/Fin=0.1652, Energy=0.2281, Healthcare=0.4272, Nature=0.3699, Sales=0.4068, Transport=0.3692, Web/CloudOps=0.4462. +- frequency skill: A=0.3305, D=0.3545, H=0.3635, M=0.2050, Q=0.2352, S=0.3470, T=0.3351, W=0.2877. +- variates skill: multivariate=0.3553, univariate=0.3226. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 second earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 30.961294412612915 seconds. +- Overall skill 0.360620; relative MASE 0.769294; relative WQL 0.531405. +- term skill: long=0.3643, medium=0.3909, short=0.3471. +- domain skill: Econ/Fin=0.1073, Energy=0.2373, Healthcare=0.3614, Nature=0.4729, Sales=0.5535, Transport=0.4233, Web/CloudOps=0.4312. +- frequency skill: A=0.3265, D=0.4302, H=0.3900, M=0.1513, Q=0.1529, S=0.2830, T=0.3613, W=0.2737. +- variates skill: multivariate=0.3599, univariate=0.3612. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 third earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 30.769143104553223 seconds. +- Overall skill 0.384513; relative MASE 0.743664; relative WQL 0.509403. +- term skill: long=0.3930, medium=0.3668, short=0.3880. +- domain skill: Econ/Fin=0.1775, Energy=0.3064, Healthcare=0.2392, Nature=0.5093, Sales=0.3974, Transport=0.5038, Web/CloudOps=0.3894. +- frequency skill: A=0.3445, D=0.4405, H=0.4005, M=0.1373, Q=0.2471, S=0.2972, T=0.4240, W=0.2382. +- variates skill: multivariate=0.3641, univariate=0.4002. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 full public-package replay +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.377160; relative MASE 0.744341; relative WQL 0.521172. +- term skill: long=0.3977, medium=0.4038, short=0.3585. +- domain skill: Econ/Fin=0.1125, Energy=0.2381, Healthcare=0.4791, Nature=0.4387, Sales=0.3613, Transport=0.4600, Web/CloudOps=0.4920. +- frequency skill: A=0.2981, D=0.3626, H=0.3904, M=0.1423, Q=0.1804, S=0.4235, T=0.4341, W=0.2328. +- variates skill: multivariate=0.3923, univariate=0.3649. +- Outcome: Publish strongest full primary candidate: skill0.377160271, relMASE0.744340532 and relWQL0.521171845; 97 configurations/151170 instances and zero failures. Inference149.631765s under shared H100; relocation14.860671s, three configurations bitwise equal, finite and ordered. Earlier cutoffs1/2 improve but cutoff3 falls to0.384512704 from E83 0.389069333. This selection is based on primary full validation, with a material earlier-window tradeoff. Seed197/B64/LR2e-5; model36,665,488 parameters. Training continues to12000; E85slowAR transfer currently lowers main skill. + +E71 descriptive full comparison: {"candidate": "/workspace/research/valid-report-patch8-6k.json", "parent": "/workspace/research/valid-report-postloss-slow-ar.json", "candidate_hash": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "parent_hash": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "skill_difference": 0.001029538022933929, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 51, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": -0.0037342410536253257, "p50": 0.0011012262742491896, "p975": 0.005930261648940039}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E87 equal ensemble of postloss+slowAR and patch8_6000 +E71 improves full and first two earlier scores but regresses on the third. Its per-configuration differences against E83 run in both directions. Test a single predeclared equal average of their final quantiles, every member on every instance, to reduce these disagreements. No coefficient sweep or per-dataset rules; no additional training. Screen all four cutoffs with cached forecasts, then require a complete public-package replay if promising. Member hashes0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49 and308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988. + +E87 cached valid_screen: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.38368555666405846, "rel_mase_gmean": 0.7380746260326486, "rel_wql_gmean": 0.5146410398989778, "groups": {"term": {"short": 0.36538266249250273, "medium": 0.4082837973759923, "long": 0.4054283252594051}, "domain": {"Econ/Fin": 0.13784772212566998, "Energy": 0.24686600590076013, "Healthcare": 0.4744445530216731, "Nature": 0.43858582844670857, "Sales": 0.34499044135263635, "Transport": 0.4641713711179224, "Web/CloudOps": 0.504852655777996}, "freq": {"A-DEC": 0.37872174128763647, "Q-DEC": 0.19576783224250183, "M": 0.10352329460914667, "W-SUN": 0.0815487165237122, "D": 0.3619759620437517, "H": 0.40136898241411867, "15T": 0.21618729924976976, "W-FRI": 0.0005727425187482815, "10T": 0.6270627319464949, "W-TUE": 0.6195479435809044, "W-THU": 0.20656160899192244, "W-WED": 0.3284622519828829, "5T": 0.5178170596317864, "10S": 0.4250896621077831}}, "cpu_seconds": 0.8467225290369242, "members": ["/workspace/research/evals/postloss_slow_ar_delta6k", "/workspace/research/evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.33897078175106665, "rel_mase_gmean": 0.7947425391953629, "rel_wql_gmean": 0.549812808335635, "groups": {"term": {"short": 0.30566345086890123, "medium": 0.3596853813715456, "long": 0.4000253823922667}, "domain": {"Econ/Fin": 0.16860733481230095, "Energy": 0.23127409233361262, "Healthcare": 0.41508771848830917, "Nature": 0.3697364579642294, "Sales": 0.40314036211800997, "Transport": 0.3731226096810256, "Web/CloudOps": 0.44992972632456585}, "freq": {"A-DEC": 0.32848231511958337, "Q-DEC": 0.23562309290129158, "M": 0.19041732638938724, "W-SUN": 0.025351943698138202, "D": 0.3534437856481293, "H": 0.3688302027123801, "15T": 0.22312808413257845, "W-FRI": 0.2396493514491056, "10T": 0.3237622247956604, "W-TUE": 0.5543034150109358, "W-THU": 0.2604484095221261, "W-WED": 0.35736004737028026, "5T": 0.4409641017446271, "10S": 0.3450492950879055}}, "cpu_seconds": 0.7932982260826975, "members": ["/workspace/research/backcast_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast_evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast2: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.36315845377936284, "rel_mase_gmean": 0.7669826024462578, "rel_wql_gmean": 0.5287827307935709, "groups": {"term": {"short": 0.3500710560941004, "medium": 0.39152062222827344, "long": 0.36789234736191556}, "domain": {"Econ/Fin": 0.11764473029610945, "Energy": 0.2411172995160572, "Healthcare": 0.3456990033484809, "Nature": 0.4766227701429041, "Sales": 0.5542499449658524, "Transport": 0.4240681895536792, "Web/CloudOps": 0.43520532523252287}, "freq": {"A-DEC": 0.3426922609629939, "Q-DEC": 0.15231664461723582, "M": 0.15186824306557356, "W-SUN": 0.05088825731569291, "D": 0.4296455306851713, "H": 0.39379373998466227, "15T": 0.10856607437428756, "W-FRI": 0.14720063917754334, "10T": 0.5085351252790775, "W-TUE": 0.07220161720253104, "W-THU": 0.3450882445488662, "W-WED": 0.5601701661454508, "5T": 0.47180636145224786, "10S": 0.2848018841721206}}, "cpu_seconds": 0.8004084089770913, "members": ["/workspace/research/backcast2_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast2_evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast3: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3893067316884232, "rel_mase_gmean": 0.7388677045007551, "rel_wql_gmean": 0.5047537816165226, "groups": {"term": {"short": 0.3954965650939142, "medium": 0.3665319698411411, "long": 0.3951340525388045}, "domain": {"Econ/Fin": 0.18260879016430553, "Energy": 0.31821834617690903, "Healthcare": 0.23007490883688486, "Nature": 0.5085775372702099, "Sales": 0.40095301819850215, "Transport": 0.5083874509785007, "Web/CloudOps": 0.39193111101214995}, "freq": {"A-DEC": 0.3560016768547195, "Q-DEC": 0.2553722438340734, "M": 0.12861913252670398, "W-SUN": 0.15123578049216402, "D": 0.44398634475249976, "H": 0.40571804459976457, "15T": 0.25382261362712966, "W-FRI": 0.03470000993227129, "10T": 0.6063950584074473, "W-TUE": 0.24994144625076442, "W-THU": 0.35649129369337096, "W-WED": 0.3788996637883131, "5T": 0.4648714119960353, "10S": 0.2886025572123534}}, "cpu_seconds": 0.7890921849757433, "members": ["/workspace/research/backcast3_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast3_evals/patch8_ema6000"], "selection_only": true} + +E87 cached equal ensemble improves all four cutoffs over both members:0.383686/0.338971/0.363158/0.389307. Assemble exact per-member model code and start full public-package validation. No coefficient search or new optimization. + +## E88 matched late slow-AR continuation of patch8 — prepared +E71patch8 improves primary validation, while mapping the E61slowAR weight correction onto it lowers the main screen. Test direct training instead: preserve E71 complete model/EMA/AdamW/RNG/prefetched-batch state exactly at8000, then continue to12000 with only the synthetic AR coefficient law changed fromU(.2,.995) toexp(-10**(-U(0,4))). Reuse the already verified E77 data implementation and E71 model. All corpus windows, signs, horizon prefixes, batch64, seed197, original LR2e-5 cosine schedule and optimizer state stay matched. The saved prefetched batch is consumed once unchanged, so the changed generator starts with the following batch. No new random initialization, external data or validation training. Queue after E69 volatility releases its memory. Compare the unchanged E71 final12000 and the candidate; screen9000/12000 and earlier cutoffs for promising results. + +## E85 patch8 slowAR correction evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.3618426322937 seconds. +- Overall skill 0.379635; relative MASE 0.743623; relative WQL 0.517537. +- term skill: long=0.4040, medium=0.4057, short=0.3597. +- domain skill: Econ/Fin=0.1422, Energy=0.2420, Healthcare=0.4441, Nature=0.4393, Sales=0.3494, Transport=0.4592, Web/CloudOps=0.5028. +- frequency skill: A=0.3775, D=0.3606, H=0.3953, M=0.0567, Q=0.1914, S=0.4261, T=0.4427, W=0.2368. +- variates skill: multivariate=0.3979, univariate=0.3647. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 32.34789538383484 seconds. +- Overall skill 0.339493; relative MASE 0.792721; relative WQL 0.550345. +- term skill: long=0.4006, medium=0.3577, short=0.3072. +- domain skill: Econ/Fin=0.1745, Energy=0.2254, Healthcare=0.4254, Nature=0.3780, Sales=0.4071, Transport=0.3673, Web/CloudOps=0.4527. +- frequency skill: A=0.3339, D=0.3537, H=0.3634, M=0.2145, Q=0.2368, S=0.3480, T=0.3408, W=0.2893. +- variates skill: multivariate=0.3590, univariate=0.3235. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast2_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 31.240530729293823 seconds. +- Overall skill 0.363604; relative MASE 0.765287; relative WQL 0.529214. +- term skill: long=0.3689, medium=0.3919, short=0.3503. +- domain skill: Econ/Fin=0.1175, Energy=0.2366, Healthcare=0.3619, Nature=0.4770, Sales=0.5513, Transport=0.4209, Web/CloudOps=0.4416. +- frequency skill: A=0.3278, D=0.4365, H=0.3885, M=0.1369, Q=0.1530, S=0.2924, T=0.3673, W=0.2792. +- variates skill: multivariate=0.3657, univariate=0.3619. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast3_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 30.950783491134644 seconds. +- Overall skill 0.384319; relative MASE 0.743701; relative WQL 0.509698. +- term skill: long=0.3926, medium=0.3666, short=0.3878. +- domain skill: Econ/Fin=0.1844, Energy=0.3057, Healthcare=0.2112, Nature=0.5108, Sales=0.3977, Transport=0.5024, Web/CloudOps=0.3936. +- frequency skill: A=0.3446, D=0.4387, H=0.3996, M=0.1104, Q=0.2522, S=0.2976, T=0.4263, W=0.2439. +- variates skill: multivariate=0.3656, univariate=0.3987. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E69 stochastic volatility first3000 +- Checkpoint SHA-256: `f68cd2d694ecf03ff038c6a2f49657eb2f211f213d68c7dec3ed5cc0c5592c5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.498825311660767 seconds. +- Overall skill 0.359482; relative MASE 0.763227; relative WQL 0.537539. +- term skill: long=0.3909, medium=0.4022, short=0.3296. +- domain skill: Econ/Fin=0.1126, Energy=0.1841, Healthcare=0.4243, Nature=0.4229, Sales=0.3462, Transport=0.4587, Web/CloudOps=0.5052. +- frequency skill: A=0.3751, D=0.3459, H=0.3825, M=0.1061, Q=0.1992, S=0.4403, T=0.3990, W=0.2102. +- variates skill: multivariate=0.3912, univariate=0.3331. +- Outcome: Main0.359481571 exceeds matched E42partial3000 0.358812323, while E61slowAR3000 was0.360587999. Continue6000 to assess persistence before transfer or earlier-window selection. Seed79/B256/LR5e-5, independent generatorRNG500082, same real windows. + +## E78 multiscale AR at3000 +- Checkpoint SHA-256: `185d1a3d5d32a3cad539fb3a83bf98ae06a56606a35bafaf8deecd75c8b496d1`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.39926815032959 seconds. +- Overall skill 0.378048; relative MASE 0.743609; relative WQL 0.520198. +- term skill: long=0.4028, medium=0.4059, short=0.3572. +- domain skill: Econ/Fin=0.1377, Energy=0.2383, Healthcare=0.4460, Nature=0.4316, Sales=0.3318, Transport=0.4664, Web/CloudOps=0.5035. +- frequency skill: A=0.3675, D=0.3526, H=0.3972, M=0.1004, Q=0.1981, S=0.4242, T=0.4386, W=0.2228. +- variates skill: multivariate=0.3966, univariate=0.3629. +- Outcome: Main0.378048480 is slightly below E77single slowAR3000 0.378238485 and E67original AR3000 0.378318033. Continue planned6000; no publication or evidence of a gain yet. Seed197/B64/LR2e-5, extraRNG700200, main/horizon draws matched. + +E85 exact composition receipt: { + "method": "matched training delta with fixed linear patch conversion", + "formula": "patch8_base + fold16to8(slowAR6000 - partial6000)", + "coefficient": 1.0, + "mapping": "sum input/query/recency halves; take first8 output positions; other tensors unchanged", + "exact_function_preservation": false, + "parent_hashes": { + "/workspace/research/runs/patch8/ema006000.pt": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0393919900525361, + "checkpoint_sha256": "7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4", + "optimizer_updates": 0 +} + +Measured checkpoint compute through current selection milestones: +```json +{ + "E71 patch8 selected6000": { + "phase_log": "patch8_recovery3.log", + "checkpoint_loop_record": { + "step": 6000, + "loss": 0.27341755777597426, + "seconds": 1302.8, + "lr": 1.2000000000000002e-05, + "grad_norm": 0.12276209145784378, + "context": 2048, + "horizon": 512 + }, + "prior_interrupted_logged_seconds": { + "initial_unsaved_attempt": 63.0, + "recovery2_last_logged2700_resumed_from2000": 770.0 + }, + "total_logged_process_loop_seconds_including_repeated_work": 2135.8 + }, + "E58 recoveredwide24000": { + "phase_log": "wide_capacity_146m_recovery_recovery3.log", + "checkpoint_loop_record": { + "step": 24000, + "loss": 0.3451157429814339, + "seconds": 1117.3, + "lr": 9.51471862576143e-06, + "grad_norm": 0.31578314304351807, + "context": 2048, + "horizon": 1024 + } + }, + "E73 graft4000": { + "phase_log": "wide_graft_recovery3.log", + "checkpoint_loop_record": { + "step": 4000, + "loss": 0.34949749410152436, + "seconds": 1146.4, + "lr": 2.908655439013544e-05, + "grad_norm": 0.47331908345222473, + "context": 1024, + "horizon": 1024 + } + }, + "E69 volatility3000": { + "phase_log": "volatility_synth_recovery3.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.33109228551387787, + "seconds": 977.8, + "lr": 4.4142135623730954e-05, + "grad_norm": 0.13540834188461304, + "context": 2048, + "horizon": 1024 + } + }, + "E77 pairedslowAR3000": { + "phase_log": "paired_long_memory_recovery3.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.31684702143073085, + "seconds": 624.8, + "lr": 1.765685424949238e-05, + "grad_norm": 1.3133997917175293, + "context": 2048, + "horizon": 1024 + } + }, + "E78 multiscale3000": { + "phase_log": "multiscale_ar_train.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.3144953328371048, + "seconds": 637.3, + "lr": 1.765685424949238e-05, + "grad_norm": 1.2501322031021118, + "context": 2048, + "horizon": 1024 + } + }, + "note": "These are concurrent training-process loop measurements on the one H100, not exclusive GPU seconds. Prefix records exclude startup and may exclude unlogged tails before operator interruption. Earlier parent training is recorded separately in the lineage experiments." +} +``` + +E88 launcher correction: naming the launcher queue.py shadowed Python standard-library queue during Torch import, causing a circular-import failure before snapshotting or training. Renamed it launch.py and restarted while E71recovery8000 was still present. Also renamed the E84launcher to avoid the same import hazard in future sampler checks. Existing E84 queued process is unchanged. No optimizer updates or validation results were affected. + +E88 preserved complete exact8000 state: { + "snapshot": "/workspace/research/patch8_recovery008000.pt", + "step": 8000, + "sha256": "2fa4b6f18df4a5f2eed7e1bc153f8f5e3755584305569db42e047f3b1312f5d5", + "snapshot_process_seconds_including_wait": 2.3576558139175177, + "prefetched_batch_preserved": true +} + +## E87 equal patch16/patch8 ensemble complete public-package replay +- Checkpoint SHA-256: `65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.379630; relative MASE 0.741025; relative WQL 0.519360. +- term skill: long=0.3995, medium=0.4072, short=0.3609. +- domain skill: Econ/Fin=0.1168, Energy=0.2399, Healthcare=0.4788, Nature=0.4386, Sales=0.3583, Transport=0.4643, Web/CloudOps=0.4967. +- frequency skill: A=0.2977, D=0.3660, H=0.3960, M=0.1275, Q=0.1843, S=0.4251, T=0.4366, W=0.2280. +- variates skill: multivariate=0.3954, univariate=0.3668. +- Outcome: Publish strongest replayable candidate: full skill0.379629893, relMASE0.741025239, relWQL0.519360272; 97 configurations/151170 instances, zero failures. Both members forecast every instance with fixed .5/.5 weights, total73,466,288 parameters. Full inference229.446591s on the shared H100, relocation22.524727s with bitwise-equal finite ordered forecasts on3 examples. Actual package quantiles are bitwise equal to the independent member average on electricity hourly short, solar minute short and ETT2hourly long. Cached diagnostic skill0.383685557/0.338970782/0.363158454/0.389306732 exceeds each member at all four cutoffs. No additional training or coefficient sweep; member training seeds/compute recorded above. + +E87 composition verification: { + "cpu_seconds": 0.016339811962097883, + "comparisons": [ + { + "config_id": "electricity__H__short", + "shape": [ + 370, + 1, + 9, + 48 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + }, + { + "config_id": "solar__T__short", + "shape": [ + 137, + 1, + 9, + 48 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + }, + { + "config_id": "ett2__H__long", + "shape": [ + 1, + 7, + 9, + 720 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + } + ], + "no_new_inference_or_training": true +} + +E87 descriptive cluster comparison: {"candidate": "/workspace/research/valid-report-mixed-patch-ensemble.json", "parent": "/workspace/research/valid-report-patch8-6k.json", "candidate_hash": "65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d", "parent_hash": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "skill_difference": 0.002469622689308837, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 53, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": 0.0003627411169234291, "p50": 0.002411418344102745, "p975": 0.004671754347801495}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E77 paired slowAR at6000 +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.37148094177246 seconds. +- Overall skill 0.378677; relative MASE 0.743065; relative WQL 0.519526. +- term skill: long=0.4020, medium=0.4060, short=0.3586. +- domain skill: Econ/Fin=0.1354, Energy=0.2384, Healthcare=0.4567, Nature=0.4305, Sales=0.3378, Transport=0.4664, Web/CloudOps=0.5036. +- frequency skill: A=0.3690, D=0.3556, H=0.3958, M=0.1000, Q=0.1944, S=0.4250, T=0.4395, W=0.2269. +- variates skill: multivariate=0.3981, univariate=0.3628. +- Outcome: Main0.378677489 modestly exceeds matched E67paired6000 0.378455389, after3000 was slightly behind. Continue planned12000 and check three earlier cutoffs; this remains below selected individual E71 and ensemble E87. Seed197/B64/LR2e-5, same real-window and requested-horizon RNG. + +## E73 independent stream at8000, prune continuation +- Checkpoint SHA-256: `c75d9f9ceae94e22370c2cc8ce4aac6ca83f5474d32e9ca3c571d5aa381d8d4a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.07528495788574 seconds. +- Overall skill 0.373597; relative MASE 0.747769; relative WQL 0.524735. +- term skill: long=0.3982, medium=0.4061, short=0.3509. +- domain skill: Econ/Fin=0.1426, Energy=0.2349, Healthcare=0.4024, Nature=0.4298, Sales=0.3401, Transport=0.4643, Web/CloudOps=0.4998. +- frequency skill: A=0.3809, D=0.3443, H=0.3950, M=0.0990, Q=0.2037, S=0.4221, T=0.4345, W=0.2060. +- variates skill: multivariate=0.3921, univariate=0.3585. +- Outcome: Main0.373596872 recovers from4000 0.372084568 but remains below its function-preserving start0.375792503 and matched original-width parent. Prune after this second negative checkpoint to prioritize E86 frozen-inherited higher-rate training; this does not establish that further E73 training could never recover. Checkpoint8000 training loop2058.7s this recovery plus722.7s logged in the prior interrupted attempt; complete stop receipt follows. Seed113/B96/LR3e-5, compiled static loss; resetseed179 occurred at8001 while waiting for evaluation. + +E86 frozen inherited stream seed113 training started at 2026-10-23T03:23:23Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E73 stop receipt: {"experiment": "E73 stopped after negative8000", "final_loop": {"completed_step": 8683, "training_process_loop_seconds": 2219.4671748820692}, "checkpoint": "/workspace/research/runs/wide_graft/ema008683.pt", "sha256": "36c21e4662c5c6e07cd3c2a34ecba515bc986d29deaef5e1856e6950c30e7db7", "complete_recovery": "/workspace/research/runs/wide_graft/recovery.pt"} + +## E77 paired slowAR6000 backcast_evals +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.434251308441162 seconds. +- Overall skill 0.337098; relative MASE 0.795494; relative WQL 0.552410. +- term skill: long=0.3992, medium=0.3581, short=0.3032. +- domain skill: Econ/Fin=0.1599, Energy=0.2277, Healthcare=0.4115, Nature=0.3693, Sales=0.3963, Transport=0.3724, Web/CloudOps=0.4511. +- frequency skill: A=0.3147, D=0.3511, H=0.3673, M=0.1858, Q=0.2368, S=0.3433, T=0.3357, W=0.2891. +- variates skill: multivariate=0.3547, univariate=0.3227. +- Outcome: Earlier0.337098369/0.360407088/0.389754840 each exceeds matched E67paired6000 0.335118632/0.359446144/0.389533029, with main0.378677489 also above0.378455389. Supports slower synthetic AR dynamics in the actual paired objective. Continue12000 and queued E88 patch8 continuation; selected E87ensemble remains stronger on primary validation. + +## E77 paired slowAR6000 backcast2_evals +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.03375768661499 seconds. +- Overall skill 0.360407; relative MASE 0.768163; relative WQL 0.532542. +- term skill: long=0.3654, medium=0.3912, short=0.3462. +- domain skill: Econ/Fin=0.1057, Energy=0.2366, Healthcare=0.3597, Nature=0.4721, Sales=0.5486, Transport=0.4198, Web/CloudOps=0.4360. +- frequency skill: A=0.3457, D=0.4251, H=0.3918, M=0.1564, Q=0.1512, S=0.2811, T=0.3637, W=0.2618. +- variates skill: multivariate=0.3657, univariate=0.3561. +- Outcome: Earlier0.337098369/0.360407088/0.389754840 each exceeds matched E67paired6000 0.335118632/0.359446144/0.389533029, with main0.378677489 also above0.378455389. Supports slower synthetic AR dynamics in the actual paired objective. Continue12000 and queued E88 patch8 continuation; selected E87ensemble remains stronger on primary validation. + +## E77 paired slowAR6000 backcast3_evals +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 21.342447519302368 seconds. +- Overall skill 0.389755; relative MASE 0.736028; relative WQL 0.505958. +- term skill: long=0.3958, medium=0.3615, short=0.3978. +- domain skill: Econ/Fin=0.1734, Energy=0.3172, Healthcare=0.2610, Nature=0.5086, Sales=0.3982, Transport=0.5051, Web/CloudOps=0.3947. +- frequency skill: A=0.3572, D=0.4437, H=0.4041, M=0.1316, Q=0.2594, S=0.2895, T=0.4297, W=0.2664. +- variates skill: multivariate=0.3731, univariate=0.4026. +- Outcome: Earlier0.337098369/0.360407088/0.389754840 each exceeds matched E67paired6000 0.335118632/0.359446144/0.389533029, with main0.378677489 also above0.378455389. Supports slower synthetic AR dynamics in the actual paired objective. Continue12000 and queued E88 patch8 continuation; selected E87ensemble remains stronger on primary validation. + +## E89 matched patch4 versus patch8 continuation — prepared +E71 finer patches improved primary full validation. Test another halving of patch length. Both arms initialize from own E71EMA6000, with candidate applying the same fixed linear fold8to4 and first4 output rows. Positions preserve physical time units. Candidate starts functionally different, so record its zero-step screen. Width512/heads8/6encoder/4decoder/context4096/horizon1024 unchanged. New matched sampling seed401, B32 distinct/64signed, paired loss, LR2e-5/12000steps and fresh AdamW/EMA. Both use original synthetic generator and the same source and horizon-prefix streams; horizon truncation remains rounded16 in both to isolate model patch length. Candidate versus control changes patch length, while comparisons against E71 are method selections with a new optimizer/batch/seed. Measure maximum-shape memory before queuing both arms after E78 and E86 release their allocations. Screen1000/3000/6000/12000; earlier windows and full package replay for promising candidates. No external data or weights. + +## E89 patch4 zero-step conversion +- Checkpoint SHA-256: `60a834e264452f3acddfdf191115c6af7ce6e972d959909bf701bac5517420ed`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 52.6757493019104 seconds. +- Overall skill 0.370553; relative MASE 0.752738; relative WQL 0.526349. +- term skill: long=0.3989, medium=0.3945, short=0.3498. +- domain skill: Econ/Fin=0.1324, Energy=0.2289, Healthcare=0.4183, Nature=0.4394, Sales=0.3492, Transport=0.4525, Web/CloudOps=0.4931. +- frequency skill: A=0.3342, D=0.3388, H=0.3842, M=0.1611, Q=0.1857, S=0.4158, T=0.4284, W=0.2377. +- variates skill: multivariate=0.3847, univariate=0.3590. +- Outcome: Initial screen0.370553128 is below source E71patch8_6000 0.381178739, as expected from a non-function-preserving patch fold. This is the baseline before new training, not an improvement. Candidate/control maximum-shape checks are finite and fit: reserved11376/6224MiB including EMA and AdamW moment storage. Both B32/seed401 arms are queued after E78 and E86. + +E89 patch4_initial.json: { + "method": "sum input/query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "checkpoint_sha256": "60a834e264452f3acddfdf191115c6af7ce6e972d959909bf701bac5517420ed", + "parameters": 36597832, + "cpu_seconds": 0.6177915919106454, + "optimizer_updates": 0 +} + +E89 patch4_memory_check.json: { + "seed": 401, + "batch": 32, + "signed_rows": 64, + "patch": 4, + "context": 4096, + "horizon": 1024, + "EMA_and_AdamW_moment_storage_present": true, + "optimizer_updates": 0, + "loss": 0.2863434851169586, + "seconds": 10.160149822942913, + "peak_allocated_mib": 10789.2275390625, + "peak_reserved_mib": 11376.0 +} + +E89 patch4_control_memory_check.json: { + "seed": 401, + "batch": 32, + "signed_rows": 64, + "patch": 8, + "context": 4096, + "horizon": 1024, + "EMA_and_AdamW_moment_storage_present": true, + "optimizer_updates": 0, + "loss": 0.30326029658317566, + "seconds": 10.05252459505573, + "peak_allocated_mib": 5778.71923828125, + "peak_reserved_mib": 6224.0 +} + +E89 candidate and control queued after PIDs2497(E78) and3946(E86), with their complete recovery files required; inferred total memory replaces those two allocations while preserving evaluation headroom. + +## E86 protected inherited stream first1000 +- Checkpoint SHA-256: `048d9f14388ad2409cd2a3f0b352d5fc1b8525f2e1e5e196707a36fe84a193bc`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.35012197494507 seconds. +- Overall skill 0.372364; relative MASE 0.749500; relative WQL 0.525586. +- term skill: long=0.3978, medium=0.4046, short=0.3494. +- domain skill: Econ/Fin=0.1443, Energy=0.2339, Healthcare=0.4085, Nature=0.4257, Sales=0.3367, Transport=0.4639, Web/CloudOps=0.4980. +- frequency skill: A=0.3876, D=0.3511, H=0.3944, M=0.0661, Q=0.1958, S=0.4208, T=0.4323, W=0.2051. +- variates skill: multivariate=0.3906, univariate=0.3575. +- Outcome: Main0.372363971 is below own initialization0.375792503. Higher-rate added/cross-stream learning still changes predictions despite protecting inherited tensors. Continue predeclared3000 comparison before deciding. Seed113/B96/LR2e-4, compiled loss, 36,800,800 inherited parameters protected and109,676,544 new/cross-stream parameters train. + +## E78 multiscale AR at6000 +- Checkpoint SHA-256: `d517ab35a8bdaeb1b0d14d4fb1879a984cedec0663bc09e3a602497facbcf473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.888899564743042 seconds. +- Overall skill 0.378668; relative MASE 0.743166; relative WQL 0.519472. +- term skill: long=0.4027, medium=0.4063, short=0.3582. +- domain skill: Econ/Fin=0.1300, Energy=0.2384, Healthcare=0.4669, Nature=0.4301, Sales=0.3370, Transport=0.4663, Web/CloudOps=0.5026. +- frequency skill: A=0.3680, D=0.3559, H=0.3959, M=0.1037, Q=0.1941, S=0.4255, T=0.4387, W=0.2279. +- variates skill: multivariate=0.3972, univariate=0.3635. +- Outcome: Main0.378667589 is effectively tied with E77single slowAR6000 0.378677489; both slightly exceed original E67paired6000 0.378455389. No demonstrated gain from adding AR components. Continue planned12000 endpoint; no publication. + +## E69 stochastic volatility at6000 +- Checkpoint SHA-256: `1161e76a6d17ace780f0bf63d6961a2ea28a4036ee5a29ee78b9e9897e7661ee`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.00778031349182 seconds. +- Overall skill 0.359792; relative MASE 0.762404; relative WQL 0.537598. +- term skill: long=0.3895, medium=0.4029, short=0.3305. +- domain skill: Econ/Fin=0.1133, Energy=0.1860, Healthcare=0.4240, Nature=0.4263, Sales=0.3419, Transport=0.4578, Web/CloudOps=0.5034. +- frequency skill: A=0.3769, D=0.3446, H=0.3811, M=0.1104, Q=0.1982, S=0.4402, T=0.4011, W=0.2124. +- variates skill: multivariate=0.3908, univariate=0.3340. +- Outcome: Main0.359791528 exceeds matched E42partial6000 0.359221833; E61slowAR6000 remains stronger at0.361281186. Check the first two earlier cutoffs to decide whether the volatility gain generalizes. Seed79/B256/LR5e-5, extraRNG500082; full continuation is planned12000. + +E86 actual GPU-trained EMA1000 preservation audit: { + "checkpoint": "/workspace/research/runs/wide_graft_frozen/ema001000.pt", + "step": 1000, + "cpu_seconds": 1.7478242949582636, + "inherited_parameters": 36800800, + "inherited_bitwise_equal_to_E47": true, + "changed_added_or_cross_stream_parameters": 109676526, + "optimizer_updates": 0 +} + +## E69 volatility6000 backcast_evals +- Checkpoint SHA-256: `1161e76a6d17ace780f0bf63d6961a2ea28a4036ee5a29ee78b9e9897e7661ee`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.790717124938965 seconds. +- Overall skill 0.330896; relative MASE 0.805425; relative WQL 0.555856. +- term skill: long=0.3909, medium=0.3566, short=0.2960. +- domain skill: Econ/Fin=0.1469, Energy=0.2301, Healthcare=0.4125, Nature=0.3497, Sales=0.3988, Transport=0.3637, Web/CloudOps=0.4436. +- frequency skill: A=0.3198, D=0.3550, H=0.3590, M=0.1648, Q=0.2278, S=0.3421, T=0.3294, W=0.2744. +- variates skill: multivariate=0.3479, univariate=0.3170. +- Outcome: Main0.359791528 and earlier1 0.330895782 improve matched E42partial6000 0.359221833/0.330299984; earlier2 0.352505400 is below control0.352900879. Mixed temporal evidence, so no transfer or publication. Finish predeclared12000 before deciding; E88 remains queued after this allocation. + +## E69 volatility6000 backcast2_evals +- Checkpoint SHA-256: `1161e76a6d17ace780f0bf63d6961a2ea28a4036ee5a29ee78b9e9897e7661ee`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.497740983963013 seconds. +- Overall skill 0.352505; relative MASE 0.776021; relative WQL 0.540255. +- term skill: long=0.3678, medium=0.3769, short=0.3372. +- domain skill: Econ/Fin=0.0890, Energy=0.2282, Healthcare=0.3738, Nature=0.4582, Sales=0.5585, Transport=0.4133, Web/CloudOps=0.4263. +- frequency skill: A=0.3446, D=0.4275, H=0.3868, M=0.1756, Q=0.1499, S=0.2802, T=0.3442, W=0.2458. +- variates skill: multivariate=0.3580, univariate=0.3481. +- Outcome: Main0.359791528 and earlier1 0.330895782 improve matched E42partial6000 0.359221833/0.330299984; earlier2 0.352505400 is below control0.352900879. Mixed temporal evidence, so no transfer or publication. Finish predeclared12000 before deciding; E88 remains queued after this allocation. + +## E86 protected inherited stream at3000 +- Checkpoint SHA-256: `45ac18a80765f03bca329ccef8d4c81f39fae8cb3f555e4e261b9a38c5fd253f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.0149462223053 seconds. +- Overall skill 0.373573; relative MASE 0.748714; relative WQL 0.524113. +- term skill: long=0.3985, medium=0.4063, short=0.3506. +- domain skill: Econ/Fin=0.1401, Energy=0.2337, Healthcare=0.4215, Nature=0.4251, Sales=0.3422, Transport=0.4636, Web/CloudOps=0.5006. +- frequency skill: A=0.3797, D=0.3460, H=0.3949, M=0.0960, Q=0.1979, S=0.4211, T=0.4348, W=0.2041. +- variates skill: multivariate=0.3931, univariate=0.3576. +- Outcome: Main0.373573070 improves from1000 0.372363971 and reaches roughly E73unrestricted8000 0.373596872 in fewer updates, but still trails the starting model0.375792503. Continue planned6000/8000 to test recovery. This compares different trainable scopes and learning rates together. Actual EMA1000 audit showed all36,800,800 inherited entries bitwise unchanged; added connections can still change the inherited stream activations. + +E84 coarse aggregation seed197 training started at 2026-10-23T03:37:37Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E77 paired slowAR final12000 +- Checkpoint SHA-256: `61cdf64f284aaa5bd97be010a29178d8b6dc796af35898d9b0ea2a76dce7dd0e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.205326557159424 seconds. +- Overall skill 0.377696; relative MASE 0.743749; relative WQL 0.520690. +- term skill: long=0.4033, medium=0.4049, short=0.3568. +- domain skill: Econ/Fin=0.1435, Energy=0.2349, Healthcare=0.4451, Nature=0.4300, Sales=0.3324, Transport=0.4672, Web/CloudOps=0.5053. +- frequency skill: A=0.3634, D=0.3546, H=0.3953, M=0.0987, Q=0.2009, S=0.4254, T=0.4404, W=0.2126. +- variates skill: multivariate=0.3967, univariate=0.3621. +- Outcome: Final main0.377696007 exceeds matched E67paired12000 0.377427077 but is below its own6000 checkpoint0.378677489; retain6000 for the method comparison. Training completed12000 in2453.330776 process-loop seconds on the shared H100, seed197/B64/LR2e-5. E84coarse aggregation started after this trainer exited. No publication against stronger E87ensemble. + +overflow_control seed197 training started at 2026-10-23T03:43:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E90 training loss scale for daily and weekly windows — prepared +The task metadata confirms daily and weekly MASE uses lag1, while the current training weight uses the first modeled seasonal period,7/52. Hypothesis: matching this scale improves coarse-frequency forecasting. Change only the lag used by the context seasonal-MAE loss weight for exact period pairs[7,365] and[52,1] to1; all other periods, weighting formula, forecasts and inference rules remain unchanged. Match E80overflow-only control: own E62 initialization, seed197/B64/paired loss/LR2e-5/12000steps, same original sampler and horizon RNG, verified float64 overflow fallback in both. Compare against E80, not the older normalization implementation. No generator or training source change. Queue after E84 releases its allocation. + +E79 fresh512 seed307 training started at 2026-10-23T03:43:44Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:43:44Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:43:56Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:43:56Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:43:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:43:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:10Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:10Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:11Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:11Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:24Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:24Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:25Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:25Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:39Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:39Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:46Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:46Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:51Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:51Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E79 startup failure and clean matched restart +{ + "started_utc": "2026-10-23T03:43:44Z", + "cleanup_utc": "2026-10-23T03:47:40.492921+00:00", + "cause": "legacy random_capacity/queue.py shadowed stdlib queue inside compiler workers and launched recursive duplicate E79 trainers; OOM then closed pool errors", + "saved_checkpoints": 0, + "discarded_partial_optimizer_updates": "not recoverable from interleaved/overwritten logs; no model selected", + "established_trainers_affected": false, + "terminated_related_processes": 50, + "remedy": "rename and guard launchers; exclusive output-directory and receipt locks; clean fresh restart", + "numerical_recipe_correction": "both fresh arms now include previously verified float64 statistics fallback only for nonfinite float32 mean/scale; initial weights/seeds/source streams unchanged" +} +The incident interval is wall time on the sole shared H100; duplicate per-process compute cannot be reconstructed exactly because legacy launchers reused log paths. Original failed logs and receipts are retained. No valid E79 checkpoint exists from this attempt. The updated numerical normalization is shared by both fresh widths; width remains the only difference between their recipes. + +E79 corrected-normalization fixture: {"normalization_overflow_fallback": true, "width": 512, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": {"batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 4521.12451171875, "peak_reserved_mib": 4784.0}, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999952735476323, "max_gradient_difference": 4.57763671875e-05, "compile_comparison_seconds": 43.313792017987, "total_seconds": 50.912394708022475, "source": "allowed packed_sample and own synthetic generator only"} + +E90 fixture and queue: { + "seed": 419, + "cpu_seconds": 1.048940374981612, + "forward_bitwise_unchanged": true, + "hourly_monthly_loss_bitwise_unchanged": true, + "mixed_loss_before": 0.4770006537437439, + "mixed_loss_after": 0.4904267191886902, + "all_gradients_finite": true, + "optimizer_updates": 0, + "diagnostic_input": "four locally generated random/smooth contexts; never used in selected weights" +} +Queued after E84(PID4254), using E80 as the matched control. + +E79 duplicate-output guard fixture: { + "duplicate_rejected_before_model_loading": true, + "optimizer_updates": 0, + "cpu_seconds": 1.6497254162095487 +} +With the training code directory on the import path, queue now resolves to the Python standard library. No queue.py/torch.py/multiprocessing.py/concurrent.py shadow files remain under research. + +E79 corrected-normalization fixture: {"normalization_overflow_fallback": true, "width": 1024, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": {"batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 10162.86376953125, "peak_reserved_mib": 10696.0}, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999932382274589, "max_gradient_difference": 6.103515625e-05, "compile_comparison_seconds": 40.99431764590554, "total_seconds": 49.15364895504899, "source": "allowed packed_sample and own synthetic generator only"} + +E79 fresh1024 seed307 training started at 2026-10-23T03:50:34Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:50:34Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E89 patch4_candidate seed401 training started at 2026-10-23T03:50:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E89 patch4_control seed401 training started at 2026-10-23T03:50:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E58/E66 widened146M final32000 +- Checkpoint SHA-256: `ecbb1f28a9bced1c7ecc078593908435320a618cde23bf034719b92b14c12b96`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.13470983505249 seconds. +- Overall skill 0.375306; relative MASE 0.746016; relative WQL 0.523103. +- term skill: long=0.3994, medium=0.4059, short=0.3536. +- domain skill: Econ/Fin=0.1403, Energy=0.2325, Healthcare=0.4376, Nature=0.4286, Sales=0.3380, Transport=0.4675, Web/CloudOps=0.5006. +- frequency skill: A=0.3821, D=0.3507, H=0.3942, M=0.0875, Q=0.2028, S=0.4235, T=0.4362, W=0.2179. +- variates skill: multivariate=0.3934, univariate=0.3605. +- Outcome: Final0.375305635 is effectively identical to matched37Mcontrol0.375304864 and below own E47parent0.375792930. The small24000 advantage did not persist. This rejects a benefit from this duplicated-width continuation, not from fresh larger pretraining. Final recovery3 loop3443.875463s; previous phases recorded separately; seed113/reset179/B96/LR3e-5. E79 tests fresh capacity instead. + +## E86 protected inherited stream at6000 +- Checkpoint SHA-256: `73dfe63b77e9f981fec42ceff6b2c9ec8b69e887c6d1d42830629c729c989625`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 30.87101984024048 seconds. +- Overall skill 0.373645; relative MASE 0.748615; relative WQL 0.524061. +- term skill: long=0.3977, medium=0.4063, short=0.3511. +- domain skill: Econ/Fin=0.1394, Energy=0.2337, Healthcare=0.4357, Nature=0.4267, Sales=0.3377, Transport=0.4634, Web/CloudOps=0.4976. +- frequency skill: A=0.3780, D=0.3487, H=0.3934, M=0.1091, Q=0.2016, S=0.4221, T=0.4332, W=0.2062. +- variates skill: multivariate=0.3912, univariate=0.3593. +- Outcome: Main0.373645290 barely improves3000 0.373573070 and remains below starting model0.375792503. Finish planned8000, then release allocation to E89. Seed113/B96/LR2e-4; no publication. + +## E84 coarse-data first1000 +- Checkpoint SHA-256: `207329fa0c16814d1fa72b3683219761f5ca3b692fa7059730f76c3fe0e93712`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.292750597000122 seconds. +- Overall skill 0.377433; relative MASE 0.744088; relative WQL 0.520892. +- term skill: long=0.4001, medium=0.4067, short=0.3569. +- domain skill: Econ/Fin=0.1311, Energy=0.2365, Healthcare=0.4620, Nature=0.4308, Sales=0.3347, Transport=0.4671, Web/CloudOps=0.5002. +- frequency skill: A=0.3669, D=0.3545, H=0.3965, M=0.1063, Q=0.1974, S=0.4228, T=0.4351, W=0.2289. +- variates skill: multivariate=0.3942, univariate=0.3638. +- Outcome: Main0.377433346 exceeds matched E67paired1000 0.376859515. Early evidence only; same seed197/B64/LR2e-5, independent aggregationRNG900200; no inference changes. + +## E84 coarse-data at3000 +- Checkpoint SHA-256: `75b4b41869254617288521d3c0c3539c9d60c6cad6b259b6ff166d1c9fd78c29`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.35591197013855 seconds. +- Overall skill 0.378023; relative MASE 0.743608; relative WQL 0.520241. +- term skill: long=0.4019, medium=0.4064, short=0.3573. +- domain skill: Econ/Fin=0.1364, Energy=0.2363, Healthcare=0.4484, Nature=0.4319, Sales=0.3319, Transport=0.4672, Web/CloudOps=0.5044. +- frequency skill: A=0.3677, D=0.3514, H=0.3990, M=0.1053, Q=0.1979, S=0.4219, T=0.4378, W=0.2193. +- variates skill: multivariate=0.3966, univariate=0.3628. +- Outcome: Main0.378023141 is slightly below matched E67paired3000 0.378318033 after the first1000 gain. Continue6000/12000 and inspect frequency groups; no consistent gain yet. + +## E80 overflow-only control first1000 +- Checkpoint SHA-256: `fb64456ba0c2ebef979b8525274132618fe542f67e7193036e4a013de6629f5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.763219356536865 seconds. +- Overall skill 0.376804; relative MASE 0.744768; relative WQL 0.521468. +- term skill: long=0.3990, medium=0.4062, short=0.3563. +- domain skill: Econ/Fin=0.1319, Energy=0.2364, Healthcare=0.4621, Nature=0.4300, Sales=0.3347, Transport=0.4668, Web/CloudOps=0.4982. +- frequency skill: A=0.3657, D=0.3559, H=0.3950, M=0.1061, Q=0.1979, S=0.4228, T=0.4347, W=0.2257. +- variates skill: multivariate=0.3925, univariate=0.3640. +- Outcome: Main0.376804394 is effectively tied with original E67paired1000 0.376859515, and slightly above E75postloss1000 0.376670711. Numerical correction alone has not shown a predictive gain yet. Continue matched3000/6000/12000. + +## E78 multiscale AR final12000 +- Checkpoint SHA-256: `a9b6f03e211513684787db1d518696925351987e524cb969c3d3a184afde6f25`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.768662929534912 seconds. +- Overall skill 0.377173; relative MASE 0.744921; relative WQL 0.520745. +- term skill: long=0.4032, medium=0.4047, short=0.3559. +- domain skill: Econ/Fin=0.1376, Energy=0.2351, Healthcare=0.4499, Nature=0.4288, Sales=0.3321, Transport=0.4667, Web/CloudOps=0.5043. +- frequency skill: A=0.3628, D=0.3520, H=0.3946, M=0.1047, Q=0.2008, S=0.4249, T=0.4400, W=0.2136. +- variates skill: multivariate=0.3959, univariate=0.3619. +- Outcome: Final0.377172928 is below matched E77single slowAR12000 0.377696007 and original E67paired12000 0.377427077. At6000 it nearly tied single slowAR; no gain from extra components. Completed planned endpoint; retain negative result and release this allocation for queued E89 after E86 finishes. + +E88 patch8 late slowAR seed197 training started at 2026-10-23T03:55:05Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E86 protected inherited stream final8000 +- Checkpoint SHA-256: `8c868d08f583249ae38cd9173b7f19c530825dda785fe66011be60d3e1a6b2f4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 30.288848638534546 seconds. +- Overall skill 0.373894; relative MASE 0.748106; relative WQL 0.524001. +- term skill: long=0.3986, medium=0.4065, short=0.3511. +- domain skill: Econ/Fin=0.1434, Energy=0.2349, Healthcare=0.4214, Nature=0.4283, Sales=0.3364, Transport=0.4640, Web/CloudOps=0.4986. +- frequency skill: A=0.3812, D=0.3459, H=0.3944, M=0.1025, Q=0.2000, S=0.4216, T=0.4346, W=0.2079. +- variates skill: multivariate=0.3920, univariate=0.3591. +- Outcome: Final0.373894042 remains below its own initialization0.375792503. Protecting inherited tensors while training additions at a higher rate improved recovery speed but did not improve the forecast model. Completed8000 in1625.057884loopseconds on the shared H100. Effective protected/trainable counts36,800,800/109,676,544; seed113/B96/LR2e-4. Released allocation to E89; retain as negative result. + +## E80 overflow-only control at3000 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.62967348098755 seconds. +- Overall skill 0.378664; relative MASE 0.743020; relative WQL 0.519581. +- term skill: long=0.4024, medium=0.4069, short=0.3581. +- domain skill: Econ/Fin=0.1345, Energy=0.2391, Healthcare=0.4537, Nature=0.4314, Sales=0.3327, Transport=0.4661, Web/CloudOps=0.5041. +- frequency skill: A=0.3682, D=0.3548, H=0.3976, M=0.1042, Q=0.1968, S=0.4234, T=0.4386, W=0.2234. +- variates skill: multivariate=0.3971, univariate=0.3636. +- Outcome: Main0.378663825 exceeds original E67paired3000 0.378318033 and nearly matches E75postloss3000 0.378813891. Most of the earlier raw main gain may come from the numerical correction rather than the postprocessing-aware loss. Check earlier cutoffs using the same overflow-safe runtime before attributing the remaining difference. Same seed197/B64/LR2e-5. + +## E84 coarse data at6000 +- Checkpoint SHA-256: `79cce8767ec35ed8ba6045957f2ef4147adb8fe312b03c50dc20ae635255926f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.568254947662354 seconds. +- Overall skill 0.378304; relative MASE 0.743340; relative WQL 0.519958. +- term skill: long=0.4018, medium=0.4073, short=0.3574. +- domain skill: Econ/Fin=0.1325, Energy=0.2353, Healthcare=0.4579, Nature=0.4332, Sales=0.3368, Transport=0.4657, Web/CloudOps=0.5045. +- frequency skill: A=0.3681, D=0.3543, H=0.3963, M=0.1037, Q=0.1944, S=0.4243, T=0.4385, W=0.2257. +- variates skill: multivariate=0.3970, univariate=0.3630. +- Outcome: Main0.378304411 remains slightly below matched E67paired6000 0.378455389. Continue planned12000, then assess overall/frequency behavior; no consistent aggregate gain yet. Seed197/B64/LR2e-5, same base/source/horizon streams apart from independent coarse aggregation. + +## E89 patch8 matched control first1000 +- Checkpoint SHA-256: `ebf6cd1845311b149118beb13364892445388f124e9f706bffe7a317ab97b762`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.399544715881348 seconds. +- Overall skill 0.380274; relative MASE 0.743092; relative WQL 0.516841. +- term skill: long=0.4036, medium=0.4039, short=0.3617. +- domain skill: Econ/Fin=0.1303, Energy=0.2425, Healthcare=0.4624, Nature=0.4416, Sales=0.3473, Transport=0.4610, Web/CloudOps=0.5001. +- frequency skill: A=0.3689, D=0.3561, H=0.3952, M=0.1038, Q=0.1908, S=0.4222, T=0.4419, W=0.2419. +- variates skill: multivariate=0.3965, univariate=0.3670. +- Outcome: Control0.380274173 is below its shared starting E71patch8_6000 0.381178739. The patch4 candidate is still approaching1000. Fresh AdamW/EMA, seed401/B32/LR2e-5; wait for the matched comparison. + +Completed process loop receipts: E71 recovery3 final12000=3333.747876572s (earlier interrupted prefixes separately logged); E78 final12000=2448.526446433s; E86 final8000=1625.057883863s. All overlapped other training on the one H100 and are not exclusive GPU times. + +## E71 patch8 final12000 +- Checkpoint SHA-256: `313d035b782188253ecd27c0da37030b397b82e4fa596f3a944994be3f1d203f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.39552927017212 seconds. +- Overall skill 0.379468; relative MASE 0.743587; relative WQL 0.517842. +- term skill: long=0.4043, medium=0.4042, short=0.3599. +- domain skill: Econ/Fin=0.1408, Energy=0.2402, Healthcare=0.4302, Nature=0.4416, Sales=0.3430, Transport=0.4619, Web/CloudOps=0.5048. +- frequency skill: A=0.3766, D=0.3605, H=0.3949, M=0.0689, Q=0.1914, S=0.4241, T=0.4445, W=0.2231. +- variates skill: multivariate=0.3987, univariate=0.3637. +- Outcome: Final main0.379467684 is below selected6000 0.381178739. Retain6000 as published ensemble member. Seed197/B64/LR2e-5; recovery3 loop3333.747877s, previous recovery phases recorded separately; no further continuation in this run. + +## E69 volatility final12000 +- Checkpoint SHA-256: `adddab6f07cb65843a1356ee2a3b36985fd56ecacc6fdb7703c465b0cfe21f5a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.7578706741333 seconds. +- Overall skill 0.360846; relative MASE 0.761644; relative WQL 0.536363. +- term skill: long=0.3901, medium=0.4048, short=0.3314. +- domain skill: Econ/Fin=0.1094, Energy=0.1887, Healthcare=0.4132, Nature=0.4274, Sales=0.3422, Transport=0.4584, Web/CloudOps=0.5066. +- frequency skill: A=0.3708, D=0.3402, H=0.3826, M=0.1173, Q=0.1994, S=0.4419, T=0.4041, W=0.2107. +- variates skill: multivariate=0.3938, univariate=0.3333. +- Outcome: Final main0.360845700 is below matched E42partial12000 0.361108160. Earlier6000 diagnostics were mixed. The early main gain did not persist; no transfer or publication. Seed79/B256/LR5e-5; final recovery3 loop3542.503298s. Released allocation to E88. + +## E89 patch4 candidate first1000 +- Checkpoint SHA-256: `a0b4f56f9b3bbf26a94ee72a8f3487c1fb42c009c79ccb8fcef8538ffdb96e7f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 47.17473244667053 seconds. +- Overall skill 0.378251; relative MASE 0.744567; relative WQL 0.519191. +- term skill: long=0.4036, medium=0.4019, short=0.3589. +- domain skill: Econ/Fin=0.1342, Energy=0.2339, Healthcare=0.4544, Nature=0.4415, Sales=0.3520, Transport=0.4631, Web/CloudOps=0.5002. +- frequency skill: A=0.3613, D=0.3424, H=0.3929, M=0.1696, Q=0.1890, S=0.4219, T=0.4368, W=0.2442. +- variates skill: multivariate=0.3925, univariate=0.3667. +- Outcome: Main0.378250742 improves folded initialization0.370553128 but trails matched patch8control1000 0.380274173 and shared original patch8parent0.381178739. Continue planned comparison; seed401/B32/LR2e-5. + +## E80 overflow-only3000 earlier cutoff1 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.02164888381958 seconds. +- Overall skill 0.336120; relative MASE 0.797369; relative WQL 0.552739. +- term skill: long=0.3981, medium=0.3582, short=0.3019. +- domain skill: Econ/Fin=0.1557, Energy=0.2287, Healthcare=0.4162, Nature=0.3643, Sales=0.3941, Transport=0.3729, Web/CloudOps=0.4489. +- frequency skill: A=0.3135, D=0.3521, H=0.3666, M=0.1852, Q=0.2300, S=0.3411, T=0.3348, W=0.2843. +- variates skill: multivariate=0.3527, univariate=0.3226. +- Outcome: Earlier0.336119626 exceeds E75postloss0.333946620 and original E67paired0.335738788. Numerical fix alone is a better base here; seed197/B64/LR2e-5, no extra optimization. + +## E80 overflow-only3000 earlier cutoff2 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.807528972625732 seconds. +- Overall skill 0.358235; relative MASE 0.771665; relative WQL 0.533732. +- term skill: long=0.3635, medium=0.3875, short=0.3446. +- domain skill: Econ/Fin=0.1067, Energy=0.2360, Healthcare=0.3485, Nature=0.4691, Sales=0.5486, Transport=0.4210, Web/CloudOps=0.4314. +- frequency skill: A=0.3545, D=0.4236, H=0.3910, M=0.1500, Q=0.1497, S=0.2812, T=0.3593, W=0.2599. +- variates skill: multivariate=0.3633, univariate=0.3541. +- Outcome: Earlier0.358234785 exceeds E75postloss0.357604589 and essentially ties original E67paired0.358235331. Main and first two earlier cutoffs warrant one fixed slowAR delta composition; no validation gradients. + +## E80 overflow-only3000 earlier cutoff3 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 21.630401849746704 seconds. +- Overall skill 0.388792; relative MASE 0.737171; relative WQL 0.506769. +- term skill: long=0.3965, medium=0.3607, short=0.3962. +- domain skill: Econ/Fin=0.1707, Energy=0.3203, Healthcare=0.2577, Nature=0.5049, Sales=0.3995, Transport=0.5052, Web/CloudOps=0.3898. +- frequency skill: A=0.3632, D=0.4429, H=0.4039, M=0.1158, Q=0.2578, S=0.2865, T=0.4303, W=0.2614. +- variates skill: multivariate=0.3742, univariate=0.4001. +- Outcome: Earlier0.388791691 is slightly below original E67paired0.389069088. Numerical correction does not improve every cutoff. Keep all outcomes; assess one predeclared fixed composition across all four cutoffs. + +## E91 predeclared overflow-safe base plus slow-AR correction +Hypothesis: the overflow-only E80 paired3000 base retains the useful numerical correction without E75 postprocessing-aware objective regressions, while the independently matched E61 slowAR6000 minus E42partial6000 correction retains its previous benefit. Apply exactly one coefficient1 composition: E80paired3000 + E61slowAR6000 - E42partial6000. No coefficient sweep, no additional optimizer updates, no validation targets used in weight construction. All three parents were trained on allowed corpus/synthetic data from our own scratch lineage. Base seed197/B64/LR2e-5; matched delta parents seed79/B256/LR5e-5. Use the exact postloss_inference overflow-safe model with unchanged fixed inference rules. Evaluate all four established cutoffs, and only then consider equal-weight ensemble replacement with E71patch8_6000 and a full public-contract replay. + +## E80 overflow-only control at6000 +- Checkpoint SHA-256: `b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.57701802253723 seconds. +- Overall skill 0.378289; relative MASE 0.743925; relative WQL 0.519575. +- term skill: long=0.4014, medium=0.4069, short=0.3578. +- domain skill: Econ/Fin=0.1256, Energy=0.2394, Healthcare=0.4638, Nature=0.4293, Sales=0.3386, Transport=0.4657, Web/CloudOps=0.5023. +- frequency skill: A=0.3687, D=0.3551, H=0.3958, M=0.1068, Q=0.1918, S=0.4249, T=0.4380, W=0.2268. +- variates skill: multivariate=0.3966, univariate=0.3633. +- Outcome: Main0.378288765 is below its3000 0.378663825 and matched original E67paired6000 0.378455389. The numerical correction is required for rare finite overflows but its forecasting gain is not monotonic. Continue planned12000; seed197/B64/LR2e-5. + +## E89 patch8 matched control at3000 +- Checkpoint SHA-256: `9083c6be954ec65ec6248801e719d6f182cd3d12bf116f8fc5fc4796675141c4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.57180857658386 seconds. +- Overall skill 0.378946; relative MASE 0.744701; relative WQL 0.517938. +- term skill: long=0.4043, medium=0.4024, short=0.3597. +- domain skill: Econ/Fin=0.1384, Energy=0.2401, Healthcare=0.4325, Nature=0.4444, Sales=0.3407, Transport=0.4620, Web/CloudOps=0.5013. +- frequency skill: A=0.3736, D=0.3524, H=0.3933, M=0.0834, Q=0.1970, S=0.4232, T=0.4439, W=0.2376. +- variates skill: multivariate=0.3975, univariate=0.3638. +- Outcome: Control0.378945686 is below first1000 and original selected6000 parent. Continue matched patch4 comparison; seed401/B32/LR2e-5. + +## E88 late slowAR first9000 +- Checkpoint SHA-256: `fbd4b0d4f29fb162929a3cf9cd4bb0ae264a2e15d860519e0fc08fa314b6820d`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 30.04508352279663 seconds. +- Overall skill 0.380434; relative MASE 0.741856; relative WQL 0.517434. +- term skill: long=0.4054, medium=0.4044, short=0.3611. +- domain skill: Econ/Fin=0.1423, Energy=0.2409, Healthcare=0.4434, Nature=0.4404, Sales=0.3436, Transport=0.4625, Web/CloudOps=0.5050. +- frequency skill: A=0.3803, D=0.3586, H=0.3955, M=0.0778, Q=0.1920, S=0.4256, T=0.4443, W=0.2331. +- variates skill: multivariate=0.3993, univariate=0.3650. +- Outcome: Main0.380434469 exceeds original E71final12000 but is below selected E71earlier6000. Evaluate the exact original9000 checkpoint before attributing a gain to the late AR change. Resume8000 preserved optimizer/EMA/allRNG/prefetched batch; seed197/B64/global12kLRschedule. + +## E91 overflow-safe plus slowAR valid_screen +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.561925172805786 seconds. +- Overall skill 0.379922; relative MASE 0.741449; relative WQL 0.518575. +- term skill: long=0.4039, medium=0.4067, short=0.3598. +- domain skill: Econ/Fin=0.1450, Energy=0.2359, Healthcare=0.4601, Nature=0.4339, Sales=0.3351, Transport=0.4657, Web/CloudOps=0.5073. +- frequency skill: A=0.3727, D=0.3616, H=0.3973, M=0.0940, Q=0.1982, S=0.4264, T=0.4400, W=0.2228. +- variates skill: multivariate=0.3984, univariate=0.3648. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E91 overflow-safe plus slowAR valid_backcast +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.259706020355225 seconds. +- Overall skill 0.337178; relative MASE 0.795032; relative WQL 0.552597. +- term skill: long=0.3962, medium=0.3594, short=0.3042. +- domain skill: Econ/Fin=0.1688, Energy=0.2262, Healthcare=0.4114, Nature=0.3695, Sales=0.3929, Transport=0.3721, Web/CloudOps=0.4520. +- frequency skill: A=0.3205, D=0.3501, H=0.3656, M=0.1901, Q=0.2319, S=0.3439, T=0.3378, W=0.2886. +- variates skill: multivariate=0.3544, univariate=0.3232. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E91 overflow-safe plus slowAR valid_backcast2 +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.369709968566895 seconds. +- Overall skill 0.360453; relative MASE 0.769235; relative WQL 0.531723. +- term skill: long=0.3677, medium=0.3870, short=0.3472. +- domain skill: Econ/Fin=0.1196, Energy=0.2351, Healthcare=0.3437, Nature=0.4735, Sales=0.5473, Transport=0.4202, Web/CloudOps=0.4377. +- frequency skill: A=0.3522, D=0.4289, H=0.3897, M=0.1376, Q=0.1497, S=0.2867, T=0.3638, W=0.2656. +- variates skill: multivariate=0.3670, univariate=0.3551. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E91 overflow-safe plus slowAR valid_backcast3 +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.158844232559204 seconds. +- Overall skill 0.389176; relative MASE 0.737055; relative WQL 0.506212. +- term skill: long=0.3949, medium=0.3621, short=0.3969. +- domain skill: Econ/Fin=0.1809, Energy=0.3196, Healthcare=0.2279, Nature=0.5059, Sales=0.4000, Transport=0.5071, Web/CloudOps=0.3940. +- frequency skill: A=0.3624, D=0.4461, H=0.4034, M=0.1001, Q=0.2604, S=0.2871, T=0.4311, W=0.2634. +- variates skill: multivariate=0.3742, univariate=0.4008. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E92 robust normalization — prepared, not launched +Hypothesis: rare large history observations dominate the current mean/RMS scale and compress typical dynamics. Change only the context normalization to winsorized statistics: center a clipping interval on the finite-value median, radius6 times the mean absolute deviation from that median; estimate mean and standard deviation of the clipped history in float64, retain the existing relative scale floor, and normalize the original history with the existing ±30 bound. This uses a mean absolute deviation, rather than median deviation, to retain scale for intermittent series. All-missing and constant histories use the same safe count/floor conventions. No future observations enter normalization. Initialize own E62 checkpoint; seed197/B64/LR2e-5/12000 paired steps, same original corpus/synthetic/horizon streams as E80overflow-only control. No new parameters, sources, or synthetic generator. A separate runtime will use identical robust statistics. Check finite outputs/gradients, affine and sign behavior, and unchanged loss machinery on locally generated fixtures before launch. Queue only after E80 releases its allocation. + +### E91 fixed ensemble outcome — retain E87 +[ + { + "cutoff": "valid_screen", + "candidate": 0.38295755880742377, + "published": 0.38368555666405846, + "cpu_seconds": 0.7978230791632086, + "groups": { + "term": { + "short": 0.3641412739810047, + "medium": 0.4081748699742944, + "long": 0.4053387686104565 + }, + "domain": { + "Econ/Fin": 0.14196055084083636, + "Energy": 0.2436181245717931, + "Healthcare": 0.47044789997945524, + "Nature": 0.43843771854824554, + "Sales": 0.3435316624897278, + "Transport": 0.4646935796341666, + "Web/CloudOps": 0.50560991569805 + }, + "freq": { + "A-DEC": 0.37806371948108464, + "Q-DEC": 0.1953743898001734, + "M": 0.10835758037283183, + "W-SUN": 0.09200217288388479, + "D": 0.36288028663668526, + "H": 0.39989339265058577, + "15T": 0.21574107475831517, + "W-FRI": 0.00590529614346913, + "10T": 0.6203515795555475, + "W-TUE": 0.5998659430846229, + "W-THU": 0.20928566575491192, + "W-WED": 0.32755565821641586, + "5T": 0.5196292524760446, + "10S": 0.4253796526525012 + } + } + }, + { + "cutoff": "valid_backcast", + "candidate": 0.33965252002132096, + "published": 0.33897078175106665, + "cpu_seconds": 0.8413949671667069, + "groups": { + "term": { + "short": 0.30682882244621934, + "medium": 0.3594584814302525, + "long": 0.4004578178388881 + }, + "domain": { + "Econ/Fin": 0.17015181674919277, + "Energy": 0.23013645693798135, + "Healthcare": 0.4218451623665679, + "Nature": 0.3716837571447873, + "Sales": 0.4016515190787069, + "Transport": 0.3732465934225949, + "Web/CloudOps": 0.450994086374909 + }, + "freq": { + "A-DEC": 0.3282816505284657, + "Q-DEC": 0.23566016127363243, + "M": 0.19914077895872262, + "W-SUN": 0.03865936211094867, + "D": 0.355074708701307, + "H": 0.36721923281513913, + "15T": 0.22292257615547317, + "W-FRI": 0.23702394178468034, + "10T": 0.32706954225689555, + "W-TUE": 0.5531057781818784, + "W-THU": 0.26381006300655674, + "W-WED": 0.35364720411869544, + "5T": 0.44270238618668056, + "10S": 0.34631632390506784 + } + } + }, + { + "cutoff": "valid_backcast2", + "candidate": 0.36318271604290864, + "published": 0.36315845377936284, + "cpu_seconds": 0.7982894480228424, + "groups": { + "term": { + "short": 0.3500873123601329, + "medium": 0.39140163998387134, + "long": 0.3681031208336688 + }, + "domain": { + "Econ/Fin": 0.11631521324076821, + "Energy": 0.23897422330833784, + "Healthcare": 0.3563145060249002, + "Nature": 0.4759919302878802, + "Sales": 0.5526652479550637, + "Transport": 0.42387192299481313, + "Web/CloudOps": 0.436824697056448 + }, + "freq": { + "A-DEC": 0.34293470421447503, + "Q-DEC": 0.15231508648525816, + "M": 0.14735330101758526, + "W-SUN": 0.05191699540908579, + "D": 0.4322785270529358, + "H": 0.39262772604483, + "15T": 0.10591962461225035, + "W-FRI": 0.14794480975291435, + "10T": 0.5077330623307716, + "W-TUE": 0.09268217269468071, + "W-THU": 0.34555097504792365, + "W-WED": 0.5579990641356007, + "5T": 0.4724634827891697, + "10S": 0.2869202644785588 + } + } + }, + { + "cutoff": "valid_backcast3", + "candidate": 0.3889402057921222, + "published": 0.3893067316884232, + "cpu_seconds": 1.0883019380271435, + "groups": { + "term": { + "short": 0.3948070762587602, + "medium": 0.36614080286851436, + "long": 0.3957100819716167 + }, + "domain": { + "Econ/Fin": 0.18258306326920215, + "Energy": 0.3151836976978215, + "Healthcare": 0.23576266671317847, + "Nature": 0.5094192054942891, + "Sales": 0.4006642315236326, + "Transport": 0.5077376839877803, + "Web/CloudOps": 0.39340413209496183 + }, + "freq": { + "A-DEC": 0.3560985343152149, + "Q-DEC": 0.25541091598546395, + "M": 0.11989423475215888, + "W-SUN": 0.15976888148282853, + "D": 0.4460752118885134, + "H": 0.40415283128676627, + "15T": 0.2542013440411708, + "W-FRI": 0.03652589348537405, + "10T": 0.6009630559934178, + "W-TUE": 0.25771359383581927, + "W-THU": 0.35674611651454924, + "W-WED": 0.37808927325032227, + "5T": 0.4654632139858025, + "10S": 0.29366540153879894 + } + } + } +] +The E91/E71 equal ensemble loses main0.382957559 versus E870.383685557 and third earlier0.388940206 versus0.389306732. First earlier improves0.339652520 versus0.338970782; second is effectively tied0.363182716 versus0.363158454. No consistent replacement gain; retain E87 and do not spend a full replay. E91 checkpoint SHA59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089, coefficient1, no optimization. The postloss-related earlier regressions were real, but removing that objective does not improve the selected equal ensemble overall. + +E92 CPU fixture passed: finite outputs/gradients, ordered quantiles, midpoint-median sign symmetry, affine behavior on nonconstant rows, eight own-generated contexts, seed431, zero updates,1.487883s. GPU autocast fixture queued. + +## E88 exact original patch8 control at9000 +- Checkpoint SHA-256: `342436626bc9219f068c118aefbe6ffb106f91e9f88acb01a9ee704cdfb7aa6b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.10145950317383 seconds. +- Overall skill 0.380329; relative MASE 0.741988; relative WQL 0.517518. +- term skill: long=0.4051, medium=0.4042, short=0.3611. +- domain skill: Econ/Fin=0.1410, Energy=0.2410, Healthcare=0.4471, Nature=0.4399, Sales=0.3435, Transport=0.4623, Web/CloudOps=0.5043. +- frequency skill: A=0.3807, D=0.3585, H=0.3953, M=0.0838, Q=0.1923, S=0.4254, T=0.4436, W=0.2332. +- variates skill: multivariate=0.3986, univariate=0.3654. +- Outcome: Original9000 main0.380329158 versus E88late slowAR9000 0.380434469, a small0.000105310 gain after1000 changed steps. Both below original selected6000 0.381178739; continue exact final12000 comparison. One failed evaluator invocation used a nonexistent path and did no inference; rerun with full_paired_inference succeeded. + +E92 GPU bf16 paired-gradient fixture passed, seed433,8.773601s, zero optimizer updates. Queue behind E80PID4371; unchanged declared12k schedule. + +Provenance hardening for E88: publisher now includes the immutable external recovery008000 snapshot as a lineage parent and records its hash/step, in addition to the original initialization. This preserves the original8000-step recipe before the late slowAR change. Mutable within-run recovery files remain excluded to avoid self-referencing lineage; no training state or weights changed. + +## Permitted-sampler coverage diagnostic, seed449 +Independent E79sampler audit generated48000 windows in4.262272CPU seconds, zero optimizer updates, no validation data read, active training streams untouched. Full source probabilities and finite-history/target summaries are sampler_coverage_audit.json. Monthly[12,1] accounts for5.1104% of rows: medianfinitecontext43, medianfinitetarget57,42.68%histories below32. Quarterly[4,1] accounts for5.2792%: mediancontext33,target46,47.95%histories below32. Weekly[52,1] accounts for3.8188%: mediancontext51,target82,30.44%histories below32. Current synthetic-period list contains no[52,1]weekly case. These are training-distribution diagnostics, not performance evidence; context and target marginal medians do not imply every row has that ratio. Original sampler20%synthetic/randomC-H recipe preserved. + +## E79 fresh37M first4000 +- Checkpoint SHA-256: `dc04a05abefdb903497a3311e7eac289ccdeae75db0ada66d02e05e431ba4f1a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.426799774169922 seconds. +- Overall skill 0.341862; relative MASE 0.775670; relative WQL 0.558415. +- term skill: long=0.3667, medium=0.3845, short=0.3148. +- domain skill: Econ/Fin=0.1118, Energy=0.2099, Healthcare=0.3250, Nature=0.4095, Sales=0.3041, Transport=0.4280, Web/CloudOps=0.4683. +- frequency skill: A=0.3520, D=0.3280, H=0.3608, M=-0.0493, Q=0.1682, S=0.4263, T=0.3918, W=0.2320. +- variates skill: multivariate=0.3630, univariate=0.3246. +- Outcome: Fresh random seed307/B48/LR2e-4/96000 static-compiled paired training, original random initialization hash19da01694123fcb13df815689ca66460d0da596bd31dfabfabb08dda6f7801e4. Main0.341861940 is below the published mature lineage but a promising early learning curve. Wait for the matched146M4000 result and planned8000/16000 checkpoints. Both arms share the corrected float64 overflow fallback and slowAR generator. Startup failures and discarded work were recorded separately; no baseline weights used. + +## E89 patch4 candidate at3000 +- Checkpoint SHA-256: `87fcd88001d63389726ff55885ef09933f912034662816cf2080d2f08a041542`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 58.48912262916565 seconds. +- Overall skill 0.379843; relative MASE 0.742829; relative WQL 0.517743. +- term skill: long=0.4040, medium=0.4031, short=0.3611. +- domain skill: Econ/Fin=0.1466, Energy=0.2356, Healthcare=0.4515, Nature=0.4449, Sales=0.3476, Transport=0.4665, Web/CloudOps=0.4992. +- frequency skill: A=0.3695, D=0.3423, H=0.3937, M=0.1494, Q=0.2020, S=0.4211, T=0.4409, W=0.2524. +- variates skill: multivariate=0.3948, univariate=0.3676. +- Outcome: Candidate main0.379842915 now exceeds matched patch8control3000 0.378945686 by0.000897230, though below selected starting parent0.381178739. Monthly skill0.1494 and weekly0.2524 are encouraging; daily0.3423 remains weak. Continue the declared6000/12000 comparisons before considering ensemble complementarity. Seed401/B32/LR2e-5; same original generator and matched fresh optimizer. + +E90 daily-weekly loss scale seed197 training started at 2026-10-23T04:12:55Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E93 patch8 encoder with patch4 forecast blocks — prepared +Hypothesis: E89patch4 improves monthly/weekly behavior by refining forecast blocks; part of the gain may survive with the cheaper patch8 encoder. Decouple input and output patch sizes, keeping input8 and output4. Initialize exactly from own E71patch8 EMA6000: retain all encoder/input tensors, fold query/recency halves and keep the first4 head rows as in E89. No function-preservation claim for output4; input8/output8 must reproduce the old implementation exactly. All other training settings match E89: seed401/B32/LR2e-5/12000 paired steps, original normalization and synthetic generator, horizonRNG300404, fresh optimizer/EMA. Compare with existing E89patch8control and fullpatch4 at1000/3000/6000/12000. No new data/generator or external weights. Queue after E88 releases its allocation, after equivalence and maximum-shape CUDA checks. + +## E84 coarse aggregation final12000 +- Checkpoint SHA-256: `bb3e1d1ef6b57ad9517e69c5f3c4fd5caac6e4fd0f50fa9273df2cd2b13b8a70`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.56629729270935 seconds. +- Overall skill 0.377144; relative MASE 0.744785; relative WQL 0.520888. +- term skill: long=0.4036, medium=0.4057, short=0.3553. +- domain skill: Econ/Fin=0.1335, Energy=0.2339, Healthcare=0.4474, Nature=0.4322, Sales=0.3330, Transport=0.4658, Web/CloudOps=0.5048. +- frequency skill: A=0.3623, D=0.3529, H=0.3953, M=0.1038, Q=0.1971, S=0.4244, T=0.4404, W=0.2071. +- variates skill: multivariate=0.3962, univariate=0.3616. +- Outcome: Final0.377143853 is below matched E67paired12000 0.377427077. Daily skill improves0.352881088 versus0.350503003, but weekly drops0.207079293 versus0.218111206. Short term loses0.000773 while long/medium gain slightly. The targeted daily/weekly augmentation is mixed and not selected. Seed197/B64/LR2e-5, final training loop2103.526387s. E90loss-scale-only starts in the released allocation. + +## E89 patch8 matched control at6000 +- Checkpoint SHA-256: `9e8f798ceb2e1b49d8bd92ba334c42470e780b8d6b62a14195bb268ae8ba872a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.938090801239014 seconds. +- Overall skill 0.377735; relative MASE 0.746288; relative WQL 0.518853. +- term skill: long=0.4024, medium=0.4020, short=0.3584. +- domain skill: Econ/Fin=0.1414, Energy=0.2382, Healthcare=0.4376, Nature=0.4420, Sales=0.3419, Transport=0.4600, Web/CloudOps=0.4997. +- frequency skill: A=0.3730, D=0.3564, H=0.3927, M=0.0689, Q=0.1989, S=0.4229, T=0.4411, W=0.2355. +- variates skill: multivariate=0.3951, univariate=0.3636. +- Outcome: Main0.377734884 continues below original selected parent0.381178739 and control3000 0.378945686. Preserve this matched reference for fullpatch4 and E93splitpatch; seed401/B32/LR2e-5. Continue planned12000. + +E93 initialization SHA0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114;36,601,928parameters, CPUconversion0.663439s. CPUfixture1.433205s proves equal8/8 implementation bitwise unchanged and all converted tensors exactly match E89full4 except the retained input8 projection. CUDAmaximumshapeB32C4096H1024, EMA/moments present, finite loss/gradients,7082MiB reserved,10.871036s. Zero optimizer updates in fixtures. Queued behind E88PID7349 as declared. + +## E93 input8/output4 zero-step conversion +- Checkpoint SHA-256: `0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 36.244373083114624 seconds. +- Overall skill 0.375817; relative MASE 0.747921; relative WQL 0.520916. +- term skill: long=0.4024, medium=0.4024, short=0.3547. +- domain skill: Econ/Fin=0.1375, Energy=0.2390, Healthcare=0.4236, Nature=0.4343, Sales=0.3477, Transport=0.4607, Web/CloudOps=0.4989. +- frequency skill: A=0.3643, D=0.3468, H=0.3925, M=0.0737, Q=0.1911, S=0.4237, T=0.4382, W=0.2424. +- variates skill: multivariate=0.3939, univariate=0.3610. +- Outcome: Initial main0.375817443 is below shared E71patch8parent0.381178739 but above fullpatch4 conversion0.370553128. Keeping the input projection preserves more initial accuracy; this is initialization behavior, not evidence for trained superiority. Conversion0.663439CPU seconds; no optimizer updates; queued matched seed401/B32/LR2e-5/12000 continuation. + +## E87 validation-only context/error audit +Read the established9473-instance screen, both selected member prediction caches, and the cached SeasonalNaive reference; no optimization or changed inference. Compute fixed context4096/recent512 level shifts, scale ratios, and RMS/mean-absolute-deviation ratios, then macro aggregate conditional median-error ratios over represented configurations. CPU2.732488s, zero optimizer updates; complete bins/counts/per-channel metrics in context_error_audit.json. Median-error ratios across recent-level-shift bins[0,.25),[.25,.75),[.75,1.5),[1.5,inf) are.73083,.71495,.77366,.88600. Last bin has only40rows/eightconfigurations. Outlier-dominance bins do not show a monotonic weakness; the highest ratio bin performs relatively well against SeasonalNaive. These are descriptive validation subsets, with different configurations represented; not benchmark skill, independent evidence, or causal estimates. No inference-rule change follows from this audit. + +## E79 fresh146M first4000 +- Checkpoint SHA-256: `ce1d3cf0e49de7acc168ca818424fef4c58feebc49e35ebccd79e6a7450c810a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.41028594970703 seconds. +- Overall skill 0.328134; relative MASE 0.791714; relative WQL 0.570160. +- term skill: long=0.3561, medium=0.3699, short=0.3002. +- domain skill: Econ/Fin=0.1210, Energy=0.2038, Healthcare=0.2653, Nature=0.3940, Sales=0.2893, Transport=0.4160, Web/CloudOps=0.4518. +- frequency skill: A=0.3724, D=0.3122, H=0.3525, M=-0.0778, Q=0.2007, S=0.4142, T=0.3812, W=0.1775. +- variates skill: multivariate=0.3500, univariate=0.3102. +- Outcome: Main0.328133919 trails matched37M4000 0.341861940. Both use own random seed307, batch48, LR2e-4/96000, identical sampled windows and modern paired/slowAR/horizon recipe. This is early optimization, not evidence that larger capacity cannot improve. Continue planned8000/16000 while inspecting matched training loss. Static-compiler startup/abandoned duplicate launches were recorded separately. + +E93 input8/output4 seed401 training started at 2026-10-23T04:18:59Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 matched training-loss diagnostic at first4000: mean50-step-block losses37M/146M over steps1..400=.434227/.430111,401..1000=.397594/.402231,1001..2000=.381371/.386349,2001..3000=.374289/.377926,3001..4000=.361665/.366583. The larger model starts slightly better during warmup but trails after reachingLR2e-4. This is consistent with an optimization mismatch, not proof of its cause. First4000 training-loop times including static compilation:37M1106.1s,146M1563.7s; both share the sole H100. + +## E94 fresh146M with half learning rate — prepared +Hypothesis: the commonLR2e-4 is too aggressive at width1024, obscuring capacity benefits. Add one matched fresh146M arm withLR1e-4 only; same original random initialization SHA c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90, seed307, B48,96000-step cosine horizon,400 warmup, static compiled paired loss, allowed packed_sample/source weights, slowAR synthetic generator, requested-horizon augmentation, overflow fallback, optimizer/EMA, save/checkpoint cadence. All original E79 arms continue unchanged. Reuse the exact code and already verified width1024 maximum-shape/compiled-gradient fixtures; no architecture or memory change warrants rerunning them. Screen4000/8000/16000/24000, continuing longer only if supported. Queue after E89patch8control releases its allocation. No pretrained assets, new sources or generators. + +## E79 fresh37M at8000 +- Checkpoint SHA-256: `5e821b81ac42babdc67ed0f5368da07941be075784d1ded6ab6c65539458faf0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.999473094940186 seconds. +- Overall skill 0.353509; relative MASE 0.763149; relative WQL 0.547666. +- term skill: long=0.3727, medium=0.3917, short=0.3307. +- domain skill: Econ/Fin=0.1196, Energy=0.2092, Healthcare=0.3930, Nature=0.4203, Sales=0.3250, Transport=0.4394, Web/CloudOps=0.4807. +- frequency skill: A=0.3577, D=0.3366, H=0.3677, M=0.0393, Q=0.1747, S=0.4203, T=0.4060, W=0.2420. +- variates skill: multivariate=0.3701, univariate=0.3400. +- Outcome: Main0.353508836 improves4000 0.341861940, still below the mature published model. Continue declared16k/24k/48k; own random seed307/B48/LR2e-4/96k, no pretrained assets. Fresh146M is still before its matched8k. + +## E90 daily-weekly loss scale first1000 +- Checkpoint SHA-256: `e0e1e3967da656eaa8184317b080a5f2064081d0d53e969c4f8a4894fa92d4f2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.965925931930542 seconds. +- Overall skill 0.376961; relative MASE 0.744602; relative WQL 0.521322. +- term skill: long=0.3990, medium=0.4061, short=0.3567. +- domain skill: Econ/Fin=0.1300, Energy=0.2364, Healthcare=0.4663, Nature=0.4300, Sales=0.3344, Transport=0.4667, Web/CloudOps=0.4984. +- frequency skill: A=0.3661, D=0.3567, H=0.3951, M=0.1038, Q=0.1981, S=0.4227, T=0.4348, W=0.2267. +- variates skill: multivariate=0.3927, univariate=0.3641. +- Outcome: Main0.376961315 slightly exceeds matched overflow-only E801000 0.376804394. Too early for a method-selection claim; inspect3k/6k and frequency groups. Seed197/B64/LR2e-5, only exactdaily/weeklyseasonallosslag changes. + +## E88 late patch8 slowAR final12000 +- Checkpoint SHA-256: `81e020113b23e84d1df64458e7c1b4a4f6ad6ee24f7cdb601aeb3fbe5d20251f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.93403601646423 seconds. +- Overall skill 0.379111; relative MASE 0.744397; relative WQL 0.517873. +- term skill: long=0.4044, medium=0.4045, short=0.3590. +- domain skill: Econ/Fin=0.1445, Energy=0.2396, Healthcare=0.4185, Nature=0.4414, Sales=0.3428, Transport=0.4624, Web/CloudOps=0.5058. +- frequency skill: A=0.3764, D=0.3621, H=0.3953, M=0.0393, Q=0.1919, S=0.4250, T=0.4450, W=0.2233. +- variates skill: multivariate=0.3996, univariate=0.3623. +- Outcome: Final0.379111337 is below exact original E71final12000 0.379467684. Its small9k gain did not persist, and neither checkpoint exceeds selected6k parent0.381178739. Reject the late slowAR continuation; no new package or earlier-cutoff selection. Resumed8000->12000 completed in1415.491672loopseconds, preserving original optimizer/EMA/RNG/prefetched batch; seed197/B64/same globalcosine. E93 starts in the released allocation. + +E92 robust normalization seed197 training started at 2026-10-23T04:21:37Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E95 broader source coverage at fixed packed volume — preparation +Hypothesis: restricting each large source to eight shards and early record batches limits the useful diversity, especially for buildings (127shards) and each climate source (96shards). Prepare packed_stratified with the same95allowlisted directories,24Mpoint/source soft cap, min16, maxcrop131072 as packed_sample. Select a uniform shuffled order of flattened series across every shard and record batch; take the first finite crops until the cap. Keep exact per-row frequency, exclude all-missing crops, and use independent deterministic per-series crop RNG. Thus coverage, row-frequency handling and empty-crop filtering are declared changes; this is not a claim that each can be isolated if actual mixed-frequency cases occur. Source mixture probabilities will remain those from packed_sample in any training comparison. No external data or validation values enter packing. + +Packer fixtures cover scalar, variable-channel and fixed-channel Arrow targets, null parents/variates, all-missing series, differing row frequencies and long crops:44retained series replay exactly, two fresh outputs have identical hashes,0.240463CPU seconds, zero updates. Initial fixture caught Arrow boolean conversion requiring zero_copy_only=False; fixed before any real-data packing. Per-directory receipts record selected source coordinates, shard coverage, binary hashes and elapsed time; output-wide lock and final atomic meta.json prevent reading an incomplete pack. + +Planned first training comparison, contingent on the completed real-data audit: own E62 parent, seed197/B64/LR2e-5/12000 paired steps with the exact E80overflow-control model/data code, changing only the packed corpus while retaining source probabilities from packed_sample. Screen1k/3k/6k/12k. No fresh training is launched yet; prefer the E90allocation after it finishes. A later fresh-capacity/data comparison remains a separate decision. + +## E80 overflow-only final12000 +- Checkpoint SHA-256: `f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.899142265319824 seconds. +- Overall skill 0.377424; relative MASE 0.744802; relative WQL 0.520408. +- term skill: long=0.4025, medium=0.4056, short=0.3563. +- domain skill: Econ/Fin=0.1303, Energy=0.2363, Healthcare=0.4508, Nature=0.4285, Sales=0.3332, Transport=0.4665, Web/CloudOps=0.5051. +- frequency skill: A=0.3608, D=0.3513, H=0.3946, M=0.1037, Q=0.1974, S=0.4251, T=0.4405, W=0.2175. +- variates skill: multivariate=0.3963, univariate=0.3620. +- Outcome: Final0.377423946 effectively ties original E67paired12000 0.377427077; strongest main checkpoint remained3000. Numerical correction is still required for rare overflow but does not cause a consistent predictive gain by itself. Completed2264.013627training-loop seconds on sharedH100, seed197/B64/LR2e-5. E92robust normalization starts in its allocation. + +## E90 daily-weekly loss scale at3000 +- Checkpoint SHA-256: `a985b1af082ccd6e23a9ec3fd6d6bdd8e8f9ae44900d2c0e1f8d3737cd9fd8d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.59094786643982 seconds. +- Overall skill 0.378417; relative MASE 0.743144; relative WQL 0.519906. +- term skill: long=0.4018, medium=0.4067, short=0.3579. +- domain skill: Econ/Fin=0.1345, Energy=0.2395, Healthcare=0.4551, Nature=0.4311, Sales=0.3328, Transport=0.4655, Web/CloudOps=0.5031. +- frequency skill: A=0.3691, D=0.3557, H=0.3972, M=0.1020, Q=0.1974, S=0.4233, T=0.4378, W=0.2245. +- variates skill: multivariate=0.3966, univariate=0.3635. +- Outcome: Main0.378417277 trails matched E803000 0.378663825 after a small first1000 gain. Continue6000/12000 and inspect targeted frequency groups; no publication. Seed197/B64/LR2e-5. + +## E92 robust normalization first1000 +- Checkpoint SHA-256: `0067828e667139743a9908ff3a6d68f704197a1609935c64ae6f7a15c84884fa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.180058240890503 seconds. +- Overall skill 0.377596; relative MASE 0.742948; relative WQL 0.521418. +- term skill: long=0.3986, medium=0.4060, short=0.3580. +- domain skill: Econ/Fin=0.1327, Energy=0.2358, Healthcare=0.4628, Nature=0.4326, Sales=0.3487, Transport=0.4670, Web/CloudOps=0.4977. +- frequency skill: A=0.3673, D=0.3569, H=0.3949, M=0.1225, Q=0.1981, S=0.4216, T=0.4346, W=0.2284. +- variates skill: multivariate=0.3923, univariate=0.3656. +- Outcome: Main0.377596201 exceeds matched E801000 0.376804394 by0.000791807. Early evidence only; changes fixed context mean/RMS estimation to median-centered winsorized statistics, retaining original history normalization bounds. Continue3000/6000 and earlier cutoffs if the gain persists. Seed197/B64/LR2e-5. + +## E93 input8/output4 first1000 +- Checkpoint SHA-256: `0aecc5af0ac9b0caf9949bd6601f2fe4ad96c5fdc9e1287c1ff2237439367b7a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.963313579559326 seconds. +- Overall skill 0.379099; relative MASE 0.744060; relative WQL 0.518128. +- term skill: long=0.4046, medium=0.4041, short=0.3591. +- domain skill: Econ/Fin=0.1359, Energy=0.2378, Healthcare=0.4437, Nature=0.4406, Sales=0.3497, Transport=0.4667, Web/CloudOps=0.5000. +- frequency skill: A=0.3584, D=0.3472, H=0.3946, M=0.1244, Q=0.1932, S=0.4224, T=0.4398, W=0.2474. +- variates skill: multivariate=0.3943, univariate=0.3667. +- Outcome: Main0.379098968 exceeds fullpatch4 E891000 0.378250742 but trails matched patch8control1000 0.380274173. Keeping input8 retains initial accuracy; assess later recovery against both existing arms before an architectural conclusion. Seed401/B32/LR2e-5. + +E95 pack completed in109.068074s on two CPUworkers:95directories,342661series,952527771points (3.810GB), versus original357789series/958745103points. Identical softcaps, actualpointcount0.65%lower because overshoot/serieslengths differ. Building127/127shards, borg31/31, eachlargeclimate96/96 are represented. No selected candidate row differed from its shardfirst frequency;103all-missing crops excluded. Exact real-data audit replayed260series acrossall95dirs against independent Arrow row/var access, including frequencies and cropstarts; source probabilities bitwise equal to original. Seed461,7.897138CPU seconds, no validationdata/optimizerupdates. Training nowqueued afterE90PID8949 under the predeclared E80matched recipe. + +## E89 fullpatch4 at6000 +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 58.3371467590332 seconds. +- Overall skill 0.380541; relative MASE 0.742008; relative WQL 0.517151. +- term skill: long=0.4046, medium=0.4023, short=0.3625. +- domain skill: Econ/Fin=0.1470, Energy=0.2361, Healthcare=0.4746, Nature=0.4451, Sales=0.3448, Transport=0.4655, Web/CloudOps=0.4969. +- frequency skill: A=0.3637, D=0.3535, H=0.3958, M=0.1449, Q=0.2068, S=0.4213, T=0.4378, W=0.2471. +- variates skill: multivariate=0.3932, univariate=0.3703. +- Outcome: Main0.380540506 improves3000 0.379842915 and beats matched patch8control6000 0.377734884, but remains below selected starting E71patch8parent0.381178739. Check all three earlier cutoffs to assess stability and possible ensemble complementarity. Seed401/B32/LR2e-5; same original generator and fresh optimizer. + +## E93 input8/output4 at3000 +- Checkpoint SHA-256: `1b82ca84aca9aaa2b8b6b1f944a865b6aad7560257f88b053ea5f62bf63a4eb8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.112743854522705 seconds. +- Overall skill 0.379808; relative MASE 0.743342; relative WQL 0.517444. +- term skill: long=0.4052, medium=0.4025, short=0.3608. +- domain skill: Econ/Fin=0.1447, Energy=0.2358, Healthcare=0.4455, Nature=0.4421, Sales=0.3442, Transport=0.4692, Web/CloudOps=0.5011. +- frequency skill: A=0.3652, D=0.3489, H=0.3934, M=0.1161, Q=0.2001, S=0.4227, T=0.4417, W=0.2532. +- variates skill: multivariate=0.3949, univariate=0.3675. +- Outcome: Main0.379808189 nearly matches fullpatch4_3000 0.379842915 and exceeds matched patch8control3000 0.378945686. Much of the early finer-patch gain may be retained by output blocks alone, with7082MiB max-shape reserve versus11376MiB fullpatch4. Continue6000/12000; seed401/B32/LR2e-5. + +## E92 robust normalization at3000 +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.601238489151 seconds. +- Overall skill 0.378938; relative MASE 0.741788; relative WQL 0.519985. +- term skill: long=0.4019, medium=0.4060, short=0.3591. +- domain skill: Econ/Fin=0.1339, Energy=0.2386, Healthcare=0.4552, Nature=0.4314, Sales=0.3481, Transport=0.4662, Web/CloudOps=0.5030. +- frequency skill: A=0.3665, D=0.3532, H=0.3965, M=0.1254, Q=0.1981, S=0.4218, T=0.4381, W=0.2295. +- variates skill: multivariate=0.3961, univariate=0.3649. +- Outcome: Main0.378937598 exceeds matched overflow-only E803000 0.378663825 by0.000273773 and postlossE753000 0.378813891 by0.000123707. Small primary gain persists; check all three earlier cutoffs before any composition or selection. Same seed197/B64/LR2e-5. Float64 robust statistics replace the old normalization throughout both network and context loss-scale calculation. + +## E96 equal three-resolution ensemble — predeclared selection probe +Hypothesis: fullpatch4 E89EMA6000 adds complementary monthly/weekly behavior to the published E87patch16/patch8 pair. Test exactly equal1/3 quantile averaging after each member applies its own unchanged rules, ordered E83postloss+slowAR, E71patch8_6000, E89patch4_6000. No coefficient sweep, no additional optimization, no dataset/frequency selection. Every member must forecast every instance if packaged. Compare all four established cached cutoffs; require a complete public-contract replay and relocation/composition checks before any publication. E89patch4_6000 hash e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727; earlier cutoffs currently running. + +E94 fresh146M halfLR seed307 training started at 2026-10-23T04:36:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E96 main cached probe: skill0.384594982171353,relMASE0.737391433574142,relWQL0.513598773629635,CPU1.411123s; currentE87main0.383685556664058. Promising0.000909426 main improvement with fixed1/3 weights; assemble a separate candidate while the remaining earlier-cutoff predictions finish. No publication before full public-contract replay/checks. + +## E89 patch4_6000 backcast_evals +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 57.45131206512451 seconds. +- Overall skill 0.336072; relative MASE 0.796655; relative WQL 0.553314. +- term skill: long=0.4016, medium=0.3589, short=0.2999. +- domain skill: Econ/Fin=0.1775, Energy=0.2230, Healthcare=0.4006, Nature=0.3706, Sales=0.4131, Transport=0.3680, Web/CloudOps=0.4502. +- frequency skill: A=0.3160, D=0.3472, H=0.3715, M=0.2107, Q=0.2381, S=0.3496, T=0.3318, W=0.2614. +- variates skill: multivariate=0.3526, univariate=0.3226. +- Outcome: All three earlier cutoffs trail selected E71patch8_6000, so no standalone replacement. The predeclared equal three-model ensemble gains on main/earlier1/earlier2 and nearly ties earlier3; assess exact package replay. + +## E89 patch4_6000 backcast2_evals +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 50.43167591094971 seconds. +- Overall skill 0.360368; relative MASE 0.769660; relative WQL 0.531571. +- term skill: long=0.3665, medium=0.3905, short=0.3460. +- domain skill: Econ/Fin=0.1116, Energy=0.2401, Healthcare=0.3295, Nature=0.4708, Sales=0.5563, Transport=0.4201, Web/CloudOps=0.4365. +- frequency skill: A=0.2963, D=0.4200, H=0.3926, M=0.1575, Q=0.1533, S=0.2829, T=0.3608, W=0.2868. +- variates skill: multivariate=0.3615, univariate=0.3594. +- Outcome: All three earlier cutoffs trail selected E71patch8_6000, so no standalone replacement. The predeclared equal three-model ensemble gains on main/earlier1/earlier2 and nearly ties earlier3; assess exact package replay. + +## E89 patch4_6000 backcast3_evals +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 55.502692461013794 seconds. +- Overall skill 0.383331; relative MASE 0.748104; relative WQL 0.508326. +- term skill: long=0.3963, medium=0.3680, short=0.3844. +- domain skill: Econ/Fin=0.1767, Energy=0.3066, Healthcare=0.2424, Nature=0.4983, Sales=0.3975, Transport=0.5047, Web/CloudOps=0.3929. +- frequency skill: A=0.3000, D=0.4228, H=0.4042, M=0.1613, Q=0.2599, S=0.3033, T=0.4260, W=0.2276. +- variates skill: multivariate=0.3668, univariate=0.3960. +- Outcome: All three earlier cutoffs trail selected E71patch8_6000, so no standalone replacement. The predeclared equal three-model ensemble gains on main/earlier1/earlier2 and nearly ties earlier3; assess exact package replay. + +## E92 robust_3000 backcast_evals +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.711654901504517 seconds. +- Overall skill 0.335781; relative MASE 0.797334; relative WQL 0.553328. +- term skill: long=0.3997, medium=0.3581, short=0.3006. +- domain skill: Econ/Fin=0.1550, Energy=0.2286, Healthcare=0.4082, Nature=0.3646, Sales=0.3970, Transport=0.3731, Web/CloudOps=0.4489. +- frequency skill: A=0.3150, D=0.3499, H=0.3669, M=0.1858, Q=0.2309, S=0.3411, T=0.3343, W=0.2844. +- variates skill: multivariate=0.3520, univariate=0.3226. +- Outcome: Earlier cutoff is below matched E80overflow-only3000. The main gain does not repeat temporally; continue the declared6k/12k training but do not select or transfer this3k checkpoint. + +## E92 robust_3000 backcast2_evals +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.730652570724487 seconds. +- Overall skill 0.358075; relative MASE 0.771535; relative WQL 0.534088. +- term skill: long=0.3627, medium=0.3886, short=0.3441. +- domain skill: Econ/Fin=0.1063, Energy=0.2373, Healthcare=0.3471, Nature=0.4675, Sales=0.5490, Transport=0.4200, Web/CloudOps=0.4314. +- frequency skill: A=0.3543, D=0.4241, H=0.3906, M=0.1525, Q=0.1489, S=0.2804, T=0.3600, W=0.2550. +- variates skill: multivariate=0.3640, univariate=0.3532. +- Outcome: Earlier cutoff is below matched E80overflow-only3000. The main gain does not repeat temporally; continue the declared6k/12k training but do not select or transfer this3k checkpoint. + +## E92 robust_3000 backcast3_evals +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.396876335144043 seconds. +- Overall skill 0.387946; relative MASE 0.738909; relative WQL 0.506977. +- term skill: long=0.3950, medium=0.3615, short=0.3950. +- domain skill: Econ/Fin=0.1698, Energy=0.3214, Healthcare=0.2587, Nature=0.5024, Sales=0.3958, Transport=0.5033, Web/CloudOps=0.3888. +- frequency skill: A=0.3650, D=0.4381, H=0.4044, M=0.1203, Q=0.2538, S=0.2862, T=0.4293, W=0.2622. +- variates skill: multivariate=0.3739, univariate=0.3988. +- Outcome: Earlier cutoff is below matched E80overflow-only3000. The main gain does not repeat temporally; continue the declared6k/12k training but do not select or transfer this3k checkpoint. + +### E96 four-cutoff equal ensemble selection +{ + "valid_screen": { + "candidate": 0.384594982171353, + "E87": 0.38368555666405846, + "cpu_seconds": 1.4111226599197835, + "groups": { + "term": { + "short": 0.3668858469093572, + "medium": 0.4077230710992221, + "long": 0.40635338876251526 + }, + "domain": { + "Econ/Fin": 0.14395536397825648, + "Energy": 0.24582427470581425, + "Healthcare": 0.4767476122577817, + "Nature": 0.44212246483547213, + "Sales": 0.34646504369353526, + "Transport": 0.46693421316839256, + "Web/CloudOps": 0.5034023313828211 + }, + "freq": { + "A-DEC": 0.37656040036707195, + "Q-DEC": 0.20077338922637145, + "M": 0.1185115893357509, + "W-SUN": 0.10525031522270123, + "D": 0.36189985298754856, + "H": 0.40144834519193306, + "15T": 0.21610876368843102, + "W-FRI": 0.015068318308339101, + "10T": 0.6264434570332911, + "W-TUE": 0.6245141515082602, + "W-THU": 0.20878118292775294, + "W-WED": 0.32985721333447826, + "5T": 0.5176096384720621, + "10S": 0.4242433666861485 + } + } + }, + "valid_backcast": { + "candidate": 0.33975008510701665, + "E87": 0.33897078175106665, + "cpu_seconds": 1.2138579529710114, + "groups": { + "term": { + "short": 0.30570414138317814, + "medium": 0.3609015682591047, + "long": 0.4020582836765434 + }, + "domain": { + "Econ/Fin": 0.1743856017696448, + "Energy": 0.23046498734519416, + "Healthcare": 0.4113970603320174, + "Nature": 0.3716618234366038, + "Sales": 0.408030987603086, + "Transport": 0.3731794302285525, + "Web/CloudOps": 0.451509629697311 + }, + "freq": { + "A-DEC": 0.3279717662601809, + "Q-DEC": 0.2380599535136222, + "M": 0.19905386528004188, + "W-SUN": 0.04880471728272662, + "D": 0.35315023295661196, + "H": 0.3711978117933119, + "15T": 0.22358807419379623, + "W-FRI": 0.22824822674434042, + "10T": 0.322600023714811, + "W-TUE": 0.547413555209586, + "W-THU": 0.24438059706818105, + "W-WED": 0.3628856336883284, + "5T": 0.4412301876136191, + "10S": 0.3475276102698931 + } + } + }, + "valid_backcast2": { + "candidate": 0.36472017597795625, + "E87": 0.36315845377936284, + "cpu_seconds": 1.3266870640218258, + "groups": { + "term": { + "short": 0.35192307261410094, + "medium": 0.39289736169887557, + "long": 0.36886086281920194 + }, + "domain": { + "Econ/Fin": 0.11936723839740782, + "Energy": 0.24270008941522314, + "Healthcare": 0.34837441457268725, + "Nature": 0.4771559710187644, + "Sales": 0.556902251507494, + "Transport": 0.4248139750422676, + "Web/CloudOps": 0.43759149119826346 + }, + "freq": { + "A-DEC": 0.3311026308933668, + "Q-DEC": 0.15378540101465998, + "M": 0.16020062601089513, + "W-SUN": 0.06801117727416384, + "D": 0.4305843857907744, + "H": 0.3953546731641614, + "15T": 0.10577250483830014, + "W-FRI": 0.15138877778445536, + "10T": 0.5095975609862264, + "W-TUE": 0.10847360375070303, + "W-THU": 0.3459885667095576, + "W-WED": 0.5660655173116367, + "5T": 0.4731902812063754, + "10S": 0.28592028110498247 + } + } + }, + "valid_backcast3": { + "candidate": 0.389238119545644, + "E87": 0.3893067316884232, + "cpu_seconds": 1.2415199128445238, + "groups": { + "term": { + "short": 0.39417395687284207, + "medium": 0.36821605147108216, + "long": 0.396861173789945 + }, + "domain": { + "Econ/Fin": 0.18370373648624572, + "Energy": 0.31629238352886546, + "Healthcare": 0.2377535675450031, + "Nature": 0.5072143926034133, + "Sales": 0.40117499834543047, + "Transport": 0.5090476109622039, + "Web/CloudOps": 0.39339169169310506 + }, + "freq": { + "A-DEC": 0.3399962169002898, + "Q-DEC": 0.25825750036173534, + "M": 0.14131510737146213, + "W-SUN": 0.1672885644844745, + "D": 0.4408980632536098, + "H": 0.4067494659465881, + "15T": 0.2551059021117046, + "W-FRI": 0.016583036267497464, + "10T": 0.6063638743127748, + "W-TUE": 0.2532467022883038, + "W-THU": 0.3464821396686204, + "W-WED": 0.3777825141129817, + "5T": 0.46382868467749705, + "10S": 0.29461185618122454 + } + } + } +} +Three gains and effectively tied third cutoff justify full public-interface replay. Candidate descriptor1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b,110064120parameters. Every member retains its exact model code; shared postprocessing hashes checked during assembly. E87 remains published pending complete replay and checks. + +Fresh37M state preservation: wait for its complete recovery024000 state and archive model/EMA/Adam/allRNG/prefetchedbatch to random_capacity_512_recovery024000.pt. This is a zero-update checkpoint snapshot, not a new experiment or a changed active schedule. It preserves the option of a later controlled annealing comparison without repeating pretraining. No continuation is queued. + +Data preparation extension, no training scheduled: create packed_stratified_large with192Mpoint/source softcaps using the identical E95all-shard code/min16/maxcrop131072 and directory/per-series RNGs. Because global series order and crops are cap-independent, the24Mpack should be an exact per-source binary/record prefix of the192Mpack. Check that invariant before any future data-scaling experiment. This artifact is separate from E95training, which remains queued on the24Mpack. No new source directories/generators or validation data. Two CPUworkers; GPUtraining schedules unchanged. + +## E79 fresh146M at8000 +- Checkpoint SHA-256: `12ad3e4b1be6b38b31a3dee057805e2a532f48fe3723f6bcefb15ba63ca8ee97`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 39.91020727157593 seconds. +- Overall skill 0.343979; relative MASE 0.773251; relative WQL 0.556563. +- term skill: long=0.3755, medium=0.3854, short=0.3146. +- domain skill: Econ/Fin=0.1160, Energy=0.1969, Healthcare=0.3682, Nature=0.4144, Sales=0.3129, Transport=0.4343, Web/CloudOps=0.4719. +- frequency skill: A=0.3662, D=0.3440, H=0.3640, M=-0.0514, Q=0.1891, S=0.4174, T=0.3968, W=0.1930. +- variates skill: multivariate=0.3619, univariate=0.3293. +- Outcome: Main0.343979357 improves4000 0.328133919; still below matched37M8000 0.353508836, with a narrowing gap. Continue declared16k/24k; seed307/B48/LR2e-4/96k. E94halfLR is a separate matched optimization arm. + +## E79 fresh37M at16000 +- Checkpoint SHA-256: `a83c2bee0b284ab22ebb5107d79e2ff2ecd29a7de9a384d46d175dbffcf2c5b4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.48415732383728 seconds. +- Overall skill 0.355318; relative MASE 0.763624; relative WQL 0.544266. +- term skill: long=0.3802, medium=0.3960, short=0.3290. +- domain skill: Econ/Fin=0.1292, Energy=0.2122, Healthcare=0.3475, Nature=0.4103, Sales=0.3304, Transport=0.4455, Web/CloudOps=0.4937. +- frequency skill: A=0.3719, D=0.3210, H=0.3755, M=0.0179, Q=0.1815, S=0.4231, T=0.4098, W=0.2504. +- variates skill: multivariate=0.3787, univariate=0.3361. +- Outcome: Main0.355318072 improves8000 0.353508836 only modestly. Continue original96k schedule unchanged and preserve complete24kstate for a possible later annealing comparison. Seed307/B48/LR2e-4, own scratch initialization. + +## E90 daily-weekly loss scale at6000 +- Checkpoint SHA-256: `d6b3d3e30290a9360789d236565ecb0acf410d4605bb50821f30b7886ed2d349`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.801913261413574 seconds. +- Overall skill 0.378435; relative MASE 0.743624; relative WQL 0.519542. +- term skill: long=0.4018, medium=0.4074, short=0.3577. +- domain skill: Econ/Fin=0.1254, Energy=0.2397, Healthcare=0.4663, Nature=0.4297, Sales=0.3355, Transport=0.4644, Web/CloudOps=0.5032. +- frequency skill: A=0.3677, D=0.3561, H=0.3960, M=0.0989, Q=0.1934, S=0.4243, T=0.4382, W=0.2295. +- variates skill: multivariate=0.3971, univariate=0.3632. +- Outcome: Main0.378434765 slightly exceeds matched E806000 0.378288765, reversing its small3k deficit. Effect is inconsistent and small; finish12k, then assess targeted frequency groups. Seed197/B64/LR2e-5. + +## E89 patch8 control final12000 +- Checkpoint SHA-256: `80519b37e670050b23c231718210bf49aaa64b5396e301a44975140d8075a85a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.017725229263306 seconds. +- Overall skill 0.380847; relative MASE 0.742398; relative WQL 0.516367. +- term skill: long=0.4032, medium=0.4046, short=0.3626. +- domain skill: Econ/Fin=0.1449, Energy=0.2438, Healthcare=0.4363, Nature=0.4433, Sales=0.3387, Transport=0.4634, Web/CloudOps=0.5028. +- frequency skill: A=0.3691, D=0.3616, H=0.3940, M=0.0837, Q=0.1978, S=0.4249, T=0.4461, W=0.2290. +- variates skill: multivariate=0.3988, univariate=0.3662. +- Outcome: Final0.380847096 rebounds from6000 0.377734884 as the learning rate falls; still below initial selected E71parent0.381178739. Preserve as the final matched reference for fullpatch4 and input8/output4, which are still training. Seed401/B32/LR2e-5; do not infer final architectural superiority from the6k comparison alone. Released allocation to E94fresh146M halfLR. + +## Larger all-shard data preparation, no optimizer updates +Same fixed global-series order and crop rules as E95, raising only the per-directory cap from24M to192M points. Packed5,354,822,975points in1,059,868series across95allowed directories;125.173232s with2CPU workers. Independent260series Arrow replay plus binary/record-prefix checks for all95directories passed in19.984999s, seed461; source probabilities bitwise match the original source mixture. The24M pack is exactly a prefix within every source. Audit stratified_large_audit.json; no validation read and no training on this larger pack scheduled yet. + +E89patch8control final12000 training loop2729.052105s on shared singleH100; validation/hash/group results recorded above. No continuation of completed control. + +## E92 robust normalization at6000 +- Checkpoint SHA-256: `3c76ff01356bdf0de6219a0937fe43c25175caef19d4324b4e73c39310659fce`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.452584981918335 seconds. +- Overall skill 0.377780; relative MASE 0.743560; relative WQL 0.520681. +- term skill: long=0.4010, medium=0.4074, short=0.3568. +- domain skill: Econ/Fin=0.1250, Energy=0.2380, Healthcare=0.4626, Nature=0.4291, Sales=0.3516, Transport=0.4654, Web/CloudOps=0.5006. +- frequency skill: A=0.3659, D=0.3537, H=0.3957, M=0.1211, Q=0.1920, S=0.4237, T=0.4359, W=0.2278. +- variates skill: multivariate=0.3949, univariate=0.3638. +- Outcome: Main0.377780381 is below matched overflow-only E80at6000 0.378288765; earlier3k already regressed at all three cutoffs. Continue the predeclared final12k but no6k selection or composition. Seed197/B64/LR2e-5; normalization is the only changed factor. + +## E96 three-patch equal ensemble full public replay — selected +- Checkpoint SHA-256: `1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.380721; relative MASE 0.740204; relative WQL 0.518109. +- term skill: long=0.4003, medium=0.4066, short=0.3628. +- domain skill: Econ/Fin=0.1244, Energy=0.2393, Healthcare=0.4812, Nature=0.4421, Sales=0.3603, Transport=0.4671, Web/CloudOps=0.4951. +- frequency skill: A=0.2988, D=0.3660, H=0.3960, M=0.1437, Q=0.1866, S=0.4242, T=0.4364, W=0.2370. +- variates skill: multivariate=0.3947, univariate=0.3694. +- Outcome: Full validation skill0.380721445 improves E87by0.001091552; relativeMASE0.740203875 andrelativeWQL0.518108512 both improve. All97configs/151170instances,0failures,441.765573 inference seconds on shared singleH100. Every member forecasts every instance, equal1/3 weights fixed before replay; no extra training. Relocation bitwise/finite/ordered checks passed in33.315708s; independent third-member public replay10.848689s and bitwise three-member composition0.027575CPU s passed. Three of four selection cutoffs improve; third earlier loss0.0000686. Full55/97configs improve; descriptive dataset-bootstrap interval spans zero, so the small adaptive-validation gain is not a held-out significance claim. Publish the strongest complete replayable candidate; continue research. + +## E97 explicit weekly synthetic coverage — preparation +Hypothesis: the existing20% synthetic mixture omits[52,1]weekly seasonality, contributing to weak weekly transfer. Replace exactly a Bernoulli1/11 share of synthetic windows with the same own Fourier/trend/AR/intermittency/changepoint generator atperiods[52,1]. The total synthetic fraction remains20%; all ten original period families retain expected weight1/11 and the new weekly family gains1/11. Always consume the original generator first; independent RNGseed1000200 chooses/re-generates weekly windows, preserving every real row and non-replaced synthetic row and the original sampler/horizon streams bitwise. No other history/target-length change. Match E80overflow-only: ownE62 initialization,seed197/B64/LR2e-5/12000paired steps,original packed_sample/source probabilities/model/loss/runtime. Screen1/3/6/12k; require sampler stream/recovery checks before queueing after E92 completes. No validation used for generation or optimization; declare the new local generator if published. + +E97sampler check: {"seed": 467, "rows": 7680, "original_synthetic_rows": 1543, "replaced_weekly_rows": 134, "probability": 0.09090909090909091, "original_and_horizon_rng_bitwise_preserved": true, "unmodified_rows_bitwise_preserved": true, "finite_masks_unchanged": true, "all_numpy_rng_recovery_exact": true, "model_sha256": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", "model_bitwise_unchanged": true, "seconds": 3.6882259079720825, "optimizer_updates": 0, "validation_data_read": false} +Queue declared after E92PID9354, requiring its final recovery. Existing model code is byte-identical to E80, so no new GPU arithmetic fixture is needed for this data-only change. Full command is weekly_synth_queue.json; launcher weekly_synth/launch.py. + +## E93 input8/output4 at6000 +- Checkpoint SHA-256: `8afbf4d2008aa7d5dab4ecbdcd1685f1a59b8fcb739a39f65fa8ba4b8cb4be9d`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 36.958359479904175 seconds. +- Overall skill 0.380224; relative MASE 0.742564; relative WQL 0.517292. +- term skill: long=0.4044, medium=0.4022, short=0.3620. +- domain skill: Econ/Fin=0.1461, Energy=0.2357, Healthcare=0.4662, Nature=0.4406, Sales=0.3432, Transport=0.4673, Web/CloudOps=0.5003. +- frequency skill: A=0.3656, D=0.3580, H=0.3941, M=0.1089, Q=0.2009, S=0.4225, T=0.4400, W=0.2482. +- variates skill: multivariate=0.3938, univariate=0.3692. +- Outcome: Main0.380224037 is between matched fullpatch4at6000 0.380540506 and patch8control0.377734884, below selected starting E71parent0.381178739. The decoder-only refinement recovers most of the full-resolution gain at lower encoder cost; continue final12k before any ensemble replacement. Seed401/B32/LR2e-5, same original generator. + +## E98 completion of deliberately pruned E75 schedule — declared revisit +E75 was intentionally stopped at3653 after earlier-cutoff regressions; that decision and its stopfile remain intact. E89patch8control subsequently recovered from0.377734884 at6k to0.380847096 at12k as learning rate decayed, showing that an intermediate trough can conceal a late recovery. Revisit the incomplete E75 schedule under a separate output, postloss_completion, by preserving and restoring its exact3653 model/EMA/Adam/allRNG/prefetched state. Continue original steps3654..12000 with the unchanged12k cosine schedule,seed197/B64/LR2e-5,original data/generator and postprocessing-aware objective. No new recipe factor and no reset; this is a completion of a previously pruned experiment, not an independent replication. Model/data/torch_post code byte-match the original archived provenance. Compare6k/12k against E80overflow-only, and examine earlier cutoffs before any composition. Queue only after E93 releases its allocation; retain original postloss.stop and all negative results. + +E98exact restart snapshot: {"source": "/workspace/research/runs/postloss/recovery.pt", "output": "/workspace/research/postloss_recovery003653.pt", "step": 3653, "sha256": "7d81547596356906fbac3a9aa3d47f84c27eabf845ba26e2c3c74ec369923c01", "seconds": 1.7649966378230602, "preserves": "model, EMA, optimizer, all RNG states and prefetched batch", "optimizer_updates": 0} +Queued after E93PID9274; launcher postloss/launch_completion.py, completecommand postloss_completion_queue.json. No GPU fixture repeated because model/loss/data code is identical to already verified E75, and no new optimizer update occurred during preparation. + +## E79 fresh37M at24000 +- Checkpoint SHA-256: `fbdb51213b3cf165273c4ea83c2386ec0bd496b182e31d57f421eee29c0da28a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.551169872283936 seconds. +- Overall skill 0.357902; relative MASE 0.763517; relative WQL 0.539988. +- term skill: long=0.3831, medium=0.3912, short=0.3346. +- domain skill: Econ/Fin=0.1259, Energy=0.2164, Healthcare=0.3681, Nature=0.4073, Sales=0.3362, Transport=0.4526, Web/CloudOps=0.4919. +- frequency skill: A=0.3818, D=0.3384, H=0.3762, M=0.0189, Q=0.1970, S=0.4195, T=0.4130, W=0.2313. +- variates skill: multivariate=0.3766, univariate=0.3426. +- Outcome: Main0.357901602 improves16k0.355318072 but still trails the mature scratch lineage. Continue original96k schedule unchanged. Exact24k model/EMA/Adam/allRNG/prefetch snapshot preserved for a separately declared cooldown comparison; no continuation launched yet. Seed307/B48/LR2e-4/static compiled paired loss/slowAR original source mixture. + +E79small immutable24k snapshot: {"source": "/workspace/research/runs/random_capacity_512/recovery.pt", "output": "/workspace/research/random_capacity_512_recovery024000.pt", "step": 24000, "sha256": "32de72f3d09f8eee785c1d19a279541348de7ba129f79d62e5824e1223e19322", "seconds": 2.042371174087748, "preserves": "model, EMA, optimizer, all RNG states and prefetched batch", "optimizer_updates": 0} + +## E99 matched early cooldown of fresh37M model — declared +Hypothesis: E79fresh37M is held back by the still-high96k-schedule learning rate, rather than only a lack of capacity. Branch from the exact immutable24000 training state (SHA32de72f3d09f8eee785c1d19a279541348de7ba129f79d62e5824e1223e19322), preserving model/EMA/Adam/allRNG/prefetched batch. Change only the next12000-step learning-rate schedule: smoothly cosine-decay from the original step24000 rate0.00017656854249492381 to0.00001 at36000, with no optimizer reset or rewarmup. Original E79continues its96k schedule unchanged. Same seed307/B48/static compiled paired objective/slowAR generator/original pack and source probabilities. Compare candidate and original at global30000/36000; earlier windows only for a promising candidate. Queue after E89fullpatch4 releases its allocation. Default schedule arithmetic was verified bitwise at140000steps across three existing recipes; cooldown joins exactly and decreases monotonically. No GPU arithmetic or model change; reuse existing compiled/eager-gradient fixtures. +E99schedule checks: {"default_steps_bitwise_equal": 140000, "join_step": 24000, "join_lr": 0.00017656854249492381, "end_step": 36000, "end_lr": 1e-05, "schedule": "cosine from original step24000 rate to1e-5 by36000, no warmup/reset", "optimizer_updates": 0, "validation_data_read": false, "seconds": 0.14022667310200632} + +## E94 fresh146M halfLR first4000 +- Checkpoint SHA-256: `62c59ba50647d301fd5afd846b25c03271fe35b7d97fe63f5b2f7b931957090b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.465235233306885 seconds. +- Overall skill 0.336895; relative MASE 0.784082; relative WQL 0.560794. +- term skill: long=0.3621, medium=0.3772, short=0.3107. +- domain skill: Econ/Fin=0.1179, Energy=0.2132, Healthcare=0.2861, Nature=0.4034, Sales=0.2941, Transport=0.4230, Web/CloudOps=0.4607. +- frequency skill: A=0.3563, D=0.3278, H=0.3600, M=-0.0301, Q=0.1751, S=0.4173, T=0.3872, W=0.1853. +- variates skill: multivariate=0.3571, univariate=0.3204. +- Outcome: Lower LR1e-4 improves matched146M4k main0.328133919 to0.336895196, still below37Mcontrol0.341861940. All three terms improve over high-LR146M; large capacity is not yet better than the smaller model. Afterwarmup its matched training loss beats high-LR146M consistently and slightly beats37M by steps2001..4000. Continue8k/16k before selecting a larger-corpus fresh recipe. Same initial weights/seed307/B48/data/objective; only learning rate changed. + +E79/E94matched first4k loss/compute: {"random_capacity_512": {"1-400": 0.4342267720028758, "401-1000": 0.3975941499322653, "1001-2000": 0.381371116399765, "2001-3000": 0.37428912545740606, "3001-4000": 0.3616653003469109, "through4000_loop_seconds": 1106.1}, "random_capacity_1024": {"1-400": 0.4301105997338891, "401-1000": 0.40223139939208824, "1001-2000": 0.3863489354848862, "2001-3000": 0.3779264837577939, "3001-4000": 0.36658306304365396, "through4000_loop_seconds": 1563.7}, "random_capacity_1024_halflr": {"1-400": 0.4339301012828946, "401-1000": 0.39748335411151253, "1001-2000": 0.3812341860383749, "2001-3000": 0.3728542738109827, "3001-4000": 0.36091782905161385, "through4000_loop_seconds": 1064.5}}. Shared-H100 process times include differing compiler-cache warm-up and are not exclusiveGPU efficiency measurements. + +E95 all-shard corpus seed197 training started at 2026-10-23T04:58:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E90 daily-weekly loss scale final12000 +- Checkpoint SHA-256: `4c5641b649529f9ac36c8679289c64bacf0b30e11dae8428620a0d59e56ffabc`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.18997550010681 seconds. +- Overall skill 0.377373; relative MASE 0.744776; relative WQL 0.520511. +- term skill: long=0.4024, medium=0.4060, short=0.3561. +- domain skill: Econ/Fin=0.1328, Energy=0.2359, Healthcare=0.4455, Nature=0.4306, Sales=0.3355, Transport=0.4657, Web/CloudOps=0.5050. +- frequency skill: A=0.3617, D=0.3526, H=0.3946, M=0.1059, Q=0.1975, S=0.4251, T=0.4399, W=0.2154. +- variates skill: multivariate=0.3960, univariate=0.3621. +- Outcome: Final main0.377373344 is effectively tied but slightly below matched E80overflow-only0.377423946. The isolated seasonal-loss-lag change has no sustained overall gain across1k/3k/6k/12k. Seed197/B64/LR2e-5; completed2702.166704 shared-H100 training-loop seconds. No candidate publication; E95broader-source-coverage starts in the released allocation. + +## E100 equal probability-distribution pool — predeclared cached comparison +Hypothesis: E96quantile averaging omits dispersion due to disagreement among its three members. Keep exactly the E83/E71/E89fixed models and equalweights, but average their CDFs and invert for the nine deciles. Each member distribution is piecewise-linear through its predicted deciles, extended to probabilities0/1 by one adjacent endpoint spacing; repeated quantiles retain atoms. Evaluate all four cached cutoffs, with no coefficient/tail-setting sweep and zero optimizer updates. Every member still forecasts every instance. Initial local fixture found only5.55e-17roundoff around exactzero; enforcing the mathematical bound between member quantiles at each level corrected it before any validation read. Identical-member, uniform-mixture, sign/affine, finite/ordered and chunk-size checks passed: {"seed": 479, "identical_members_bitwise_identity": true, "uniform_mixture_exact_within_float32": true, "atoms_at_zero_preserved": true, "ordered_finite": true, "chunk_size_bitwise_independent": true, "sign_reflection_and_affine_equivariance": true, "optimizer_updates": 0, "seconds": 0.09868191904388368} + +## E95 all-shard source coverage first1000 +- Checkpoint SHA-256: `17b2a03d282c141dbd68ac7f68df4626802f1a0323fff313f1a28192c5068b5b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.06695008277893 seconds. +- Overall skill 0.377028; relative MASE 0.744820; relative WQL 0.521057. +- term skill: long=0.3997, medium=0.4068, short=0.3562. +- domain skill: Econ/Fin=0.1378, Energy=0.2376, Healthcare=0.4487, Nature=0.4311, Sales=0.3344, Transport=0.4669, Web/CloudOps=0.4993. +- frequency skill: A=0.3724, D=0.3543, H=0.3951, M=0.1080, Q=0.1986, S=0.4218, T=0.4370, W=0.2193. +- variates skill: multivariate=0.3940, univariate=0.3632. +- Outcome: Main0.377028371 exceeds matched E80at1000 0.376804394 by0.000223977. Medium/long improve while short is nearly unchanged; still below E62initialization0.377343216, so no selection claim yet. Continue3k/6k/12k. Seed197/B64/LR2e-5; pack coverage changes at nearly identical volume, same original source probabilities/model/loss/generator. + +E97 weekly synthetic coverage seed197 training started at 2026-10-23T05:06:47Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +### E100 probability-pool outcome — rejected +{"cutoff": "valid_screen", "skill_score": 0.38447708223972143, "rel_mase_gmean": 0.7377458188534619, "rel_wql_gmean": 0.5135487760227904, "groups": {"term": {"short": 0.36645074748329265, "medium": 0.40785519113120783, "long": 0.4067636672388967}, "domain": {"Econ/Fin": 0.14348007471775803, "Energy": 0.2450499585597603, "Healthcare": 0.4778661939355727, "Nature": 0.44167938695480613, "Sales": 0.34589247896287667, "Transport": 0.46735333815132574, "Web/CloudOps": 0.5036629603237621}, "freq": {"A-DEC": 0.37569899250005157, "Q-DEC": 0.20013922343000312, "M": 0.12148678908575261, "W-SUN": 0.10281895779812733, "D": 0.3613770705448509, "H": 0.40132102430667216, "15T": 0.21622161251725824, "W-FRI": 0.010849753325401168, "10T": 0.6253364743600922, "W-TUE": 0.6270406616896087, "W-THU": 0.2100424900094875, "W-WED": 0.3297769734384489, "5T": 0.5175830091172531, "10S": 0.424444633099896}}, "cpu_seconds": 59.980443592881784, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.384594982171353, "skill_difference": -0.00011789993163158208} +{"cutoff": "valid_backcast", "skill_score": 0.3396884750452879, "rel_mase_gmean": 0.7937686109009007, "rel_wql_gmean": 0.5492927082278539, "groups": {"term": {"short": 0.305359424616949, "medium": 0.3615421761351466, "long": 0.4019782542502155}, "domain": {"Econ/Fin": 0.17397857577775933, "Energy": 0.23077587806776068, "Healthcare": 0.4105170158829923, "Nature": 0.37090555838048966, "Sales": 0.40754241032517846, "Transport": 0.3735854351257373, "Web/CloudOps": 0.4515115490492597}, "freq": {"A-DEC": 0.3285015352119629, "Q-DEC": 0.23809442338781928, "M": 0.19846718923537676, "W-SUN": 0.044551228029835244, "D": 0.3527581961201992, "H": 0.37195542467805676, "15T": 0.22380832764902536, "W-FRI": 0.22713834170412128, "10T": 0.3209843494303689, "W-TUE": 0.5471337430335201, "W-THU": 0.24671528715780322, "W-WED": 0.36065042452889085, "5T": 0.440176624512733, "10S": 0.34765351732372307}}, "cpu_seconds": 57.84474289207719, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.33975008510701665, "skill_difference": -6.161006172877848e-05} +{"cutoff": "valid_backcast2", "skill_score": 0.3643569364713283, "rel_mase_gmean": 0.7656814703595871, "rel_wql_gmean": 0.5276895417390272, "groups": {"term": {"short": 0.35141014761082046, "medium": 0.3925477275360366, "long": 0.36889675295988844}, "domain": {"Econ/Fin": 0.11837724372992486, "Energy": 0.24257682706622608, "Healthcare": 0.3484957338430069, "Nature": 0.4765403493474547, "Sales": 0.5563991023520016, "Transport": 0.425156500116473, "Web/CloudOps": 0.43670286593915697}, "freq": {"A-DEC": 0.32966975290636025, "Q-DEC": 0.15381819951222442, "M": 0.15901923467685497, "W-SUN": 0.06330956349285344, "D": 0.43027727492156853, "H": 0.39548623856812215, "15T": 0.10618336189249866, "W-FRI": 0.14996401232455647, "10T": 0.5090292906528928, "W-TUE": 0.11021265661815505, "W-THU": 0.34484214889524656, "W-WED": 0.565895835912684, "5T": 0.47197167812560914, "10S": 0.2855930392816969}}, "cpu_seconds": 55.48255044897087, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.36472017597795625, "skill_difference": -0.000363239506627977} +{"cutoff": "valid_backcast3", "skill_score": 0.3894908456851319, "rel_mase_gmean": 0.7395191359520792, "rel_wql_gmean": 0.5040051154624993, "groups": {"term": {"short": 0.3944986218711739, "medium": 0.3683905810196345, "long": 0.3969887061132117}, "domain": {"Econ/Fin": 0.18408496490995196, "Energy": 0.3168114104271367, "Healthcare": 0.23983131130227353, "Nature": 0.5064220935312094, "Sales": 0.40140535360155616, "Transport": 0.5096985006120188, "Web/CloudOps": 0.393462743970424}, "freq": {"A-DEC": 0.34218212975771833, "Q-DEC": 0.25834447555512075, "M": 0.14460929216407215, "W-SUN": 0.16537651572223833, "D": 0.4408650435087358, "H": 0.40698403946159434, "15T": 0.25514902945862916, "W-FRI": 0.019067740904430974, "10T": 0.6070205489033722, "W-TUE": 0.25089200168813297, "W-THU": 0.3450365084609506, "W-WED": 0.378097845878244, "5T": 0.46374932773306954, "10S": 0.2954018250276097}}, "cpu_seconds": 54.93674235115759, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.389238119545644, "skill_difference": 0.0002527261394879021} +Probability pooling loses main and the first two earlier cutoffs, improving only the third. Retain E96 equal quantile averaging; no full replay or runtime publication. Zero optimizer updates; full CPU comparison time228.244479s, local fixture seed479. + +## E101 own-ensemble distillation — prepared, not queued + + +Prepared design, not yet queued. Complete the listed checks and record the exact experiment before launch. No external models, weights or data. + +Hypothesis: the larger fresh model can learn useful conditional forecasts faster when its proper real-target objective is supplemented by dense quantile targets from our own mature scratch-trained ensemble. This differs from the failed direct width conversions and protected random feature grafts: all student parameters begin at the same random initialization as E94. + +Match E94 exactly: own random_capacity_1024_initial.pt, seed307, batch48 distinct windows/96 signed rows, learning rate1e-4,96000-step schedule,400warmup, compiled paired-sign loss, original packed_sample/source probabilities,20% own slow-AR synthetic generator, original requested-horizon stream. Only the additional teacher loss changes. E94 remains the real-target-only control. + +Teacher: frozen E96 three members, descriptor1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b. Use each member's sign-averaged normalized neural quantiles BEFORE fixed postprocessing, then equal averaging. All members share the same ordinary-row normalization at training shapes (contexts are multiples of512); verify that. Pass the same per-row available forecast lengths to each member's partial-target mask. Mask teacher loss on rows with any nonfinite member normalization/output; retain the original real-target objective on those rows. The student loss and runtime remain the original E94 neural objective and fixed inference rules, so there is no simultaneous postprocessing-aware-loss change. + +Add coefficient0.5 times a teacher L1 objective: per valid target step,0.5*mean(abs(student_quantiles-teacher_quantiles)) +0.25*abs(student_median-teacher_median); average over the same valid target positions and apply the same context seasonal-error weight, normalized over teacher-valid rows. No coefficient sweep. The real-target objective is unchanged and retains weight1. Teacher targets are constants, with no gradients or updates to teacher weights. All teacher windows come only from the allowed sampler; no validation inputs or labels enter training. + +Compute teacher targets outside the compiled student objective. Student model state/config must retain exactly E94 keys and parameter count; teacher modules must not be registered on the student or enter its optimizer/EMA/checkpoints. Record teacher descriptor and all three checkpoint hashes in training args/lineage, and automatically declare own-teacher pseudo-target generation in sources_used on publication. Archive teacher code and generation code in provenance; deployed inference loads only the student. + +Required checks: zero teacher coefficient reproduces original loss/gradients on identical own-generated fixtures; teacher sign averaging/normalization matches independent raw-member forward passes; teacher parameters remain unchanged and have no gradients; student gradients finite; complete sampler/RNG recovery unchanged; eager/compiled gradient comparison; maximum-shape memory including student EMA/Adam and teacher weights. Initial fixture has zero optimizer updates. Runtime is unchanged random_capacity_inference. + +Potential allocation: queue only after both E99cooldown and E97weekly training finish, using their queue processes/checkpoint dependencies rather than unknown future trainer PIDs. Their released combined memory is sufficient for146M student plus frozen teacher. Watch4/8/16/24k before deciding longer allocation. Do not launch until code, checks, exact recipe declaration and source-lineage handling are complete. + +CPUfixture: {"seed": 487, "seconds": 5.1773834731429815, "teacher_descriptor_sha256": "1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b", "teacher_parameters": 110064120, "teacher_weights_frozen_bitwise": true, "teacher_gradients_absent": true, "independent_raw_member_average_bitwise": true, "ordinary_normalization_bitwise_same": true, "overflow_teacher_row_excluded_only_from_auxiliary": true, "sign_reflection_equivariant": true, "zero_coefficient_loss_and_gradients_bitwise_control": true, "student_state_keys_unchanged": true, "sampler_code_bitwise_control": true, "all_student_gradients_finite": true, "real_loss": 7.174529552459717, "combined_loss": 7.284832954406738, "optimizer_updates": 0, "validation_data_read": false} +Frozen teacher assets copied to distill_teacher_E96; descriptor unchanged. No student optimizer updates yet. + +## E92 robust normalization final12000 — rejected +- Checkpoint SHA-256: `25be8396d4a8c6ea98c67bca79060c4979a2829661016f0ed51b4e98c897c688`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.238795042037964 seconds. +- Overall skill 0.377099; relative MASE 0.744448; relative WQL 0.521199. +- term skill: long=0.4035, medium=0.4066, short=0.3549. +- domain skill: Econ/Fin=0.1295, Energy=0.2365, Healthcare=0.4448, Nature=0.4270, Sales=0.3471, Transport=0.4672, Web/CloudOps=0.5036. +- frequency skill: A=0.3570, D=0.3466, H=0.3946, M=0.1215, Q=0.1971, S=0.4235, T=0.4392, W=0.2223. +- variates skill: multivariate=0.3955, univariate=0.3620. +- Outcome: Final main0.377099312 is below matched overflow-only E80final0.377423946. The3k main gain did not transfer to any earlier cutoff, and6k/final main also regress. Reject this normalization change; retain ordinary statistics with the overflow-only fallback. Seed197/B64/LR2e-5, no new sources/generator. E97weekly-synthetic run has started in the released allocation. + +E92finalcompute: {"completed_step": 12000, "training_process_loop_seconds": 2692.7444765449036} + +## E79 fresh37M at30000, E99 future matched control +- Checkpoint SHA-256: `7965d1fe4b831143de6280ae873ec61a8024dbb6a14da5dfae1ef58098c33a59`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.895771265029907 seconds. +- Overall skill 0.358564; relative MASE 0.761438; relative WQL 0.540346. +- term skill: long=0.3844, medium=0.3900, short=0.3358. +- domain skill: Econ/Fin=0.1162, Energy=0.2193, Healthcare=0.3709, Nature=0.4110, Sales=0.3395, Transport=0.4511, Web/CloudOps=0.4907. +- frequency skill: A=0.3754, D=0.3312, H=0.3793, M=0.0636, Q=0.1845, S=0.4178, T=0.4155, W=0.2110. +- variates skill: multivariate=0.3768, univariate=0.3436. +- Outcome: Main0.358563990 improves24k0.357901602 by0.000662387 under the original96k schedule. This is the exact global30k control for the separately queued E99cooldown; no E99outcome yet. Seed307/B48/LR2e-4; continue unchanged original schedule. + +## E79 fresh146M at16000 +- Checkpoint SHA-256: `959ff6c885777e971d4ee25729d3406485404a69a0bbfe320959506b180e9e35`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 39.40332913398743 seconds. +- Overall skill 0.349499; relative MASE 0.768924; relative WQL 0.550316. +- term skill: long=0.3865, medium=0.3939, short=0.3166. +- domain skill: Econ/Fin=0.1199, Energy=0.2111, Healthcare=0.2664, Nature=0.4047, Sales=0.3301, Transport=0.4402, Web/CloudOps=0.4965. +- frequency skill: A=0.3766, D=0.3221, H=0.3700, M=-0.0589, Q=0.1818, S=0.4218, T=0.4156, W=0.1984. +- variates skill: multivariate=0.3768, univariate=0.3269. +- Outcome: Main0.349499286 improves8k0.343979357 but still trails matched37M16k0.355318072. Gap narrows to0.005818787; no capacity advantage established. Same seed307/B48/LR2e-4; continue24k while E94halfLR comparison matures. + +## E95 all-shard source coverage at3000 +- Checkpoint SHA-256: `ed98a18948ae0ad7cc18f1e2eb653f9af6bd6545ad81daa897b167b5ccf529ce`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.239446878433228 seconds. +- Overall skill 0.376742; relative MASE 0.745627; relative WQL 0.520972. +- term skill: long=0.4002, medium=0.4075, short=0.3552. +- domain skill: Econ/Fin=0.1328, Energy=0.2374, Healthcare=0.4444, Nature=0.4331, Sales=0.3350, Transport=0.4645, Web/CloudOps=0.5005. +- frequency skill: A=0.3721, D=0.3540, H=0.3968, M=0.0980, Q=0.1953, S=0.4214, T=0.4362, W=0.2177. +- variates skill: multivariate=0.3948, univariate=0.3620. +- Outcome: Main0.376741687 falls below matched E80at3000 0.378663825, reversing the small1k advantage. Broader uniform source coverage has not shown a sustained benefit in this mature-model continuation. Continue declared6k/12k before any data-mixture conclusion. Seed197/B64/LR2e-5, nearly matched packed volume and identical source probabilities. + +E98 complete original E75 schedule training started at 2026-10-23T05:11:48Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E101GPUfixture: {"initialization_seed": 307, "fixture_seed": 491, "optimizer_updates": 0, "maximum_shape_memory": {"batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "student_parameters": 146477344, "teacher_parameters": 110064120, "loss": 0.7845079898834229, "teacher_valid_fraction": 1.0, "peak_allocated_mib": 10583.0390625, "peak_reserved_mib": 11116.0}, "eager_loss": 0.3347933888435364, "compiled_loss": 0.3347933888435364, "gradient_cosine": 0.9999896108063672, "max_gradient_difference": 6.866455078125e-05, "teacher_gradients_absent": true, "compile_comparison_seconds": 54.64838738180697, "total_seconds": 79.89753107703291, "source": "allowed packed_sample and own slowAR generator only; frozen scratch-trained E96 neural teacher"} +Checks passed, zero optimizer updates. E101nowqueued after E99queuePID10701 and E97queuePID10513 both end, requiring their saved recovery checkpoints. These are dependency-launcher PIDs, not unknown future trainer PIDs. Exact recipe/command in distill_ensemble_queue.json; immutable teacher package distill_teacher_E96. Compare E94real-target-only at matching checkpoints. Student inference uses unchanged random_capacity_inference and contains no teacher dependency. + +## E93 input8/output4 final12000 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.806113958358765 seconds. +- Overall skill 0.381712; relative MASE 0.740742; relative WQL 0.516077. +- term skill: long=0.4058, medium=0.4052, short=0.3629. +- domain skill: Econ/Fin=0.1468, Energy=0.2396, Healthcare=0.4600, Nature=0.4409, Sales=0.3373, Transport=0.4706, Web/CloudOps=0.5017. +- frequency skill: A=0.3633, D=0.3624, H=0.3942, M=0.1027, Q=0.1968, S=0.4248, T=0.4434, W=0.2445. +- variates skill: multivariate=0.3961, univariate=0.3700. +- Outcome: Final main0.381711986 exceeds matched E89patch8control12k0.380847096 and starting selected E71parent0.381178739. The smaller output blocks help at the final schedule; check all three earlier cutoffs and matched fullpatch4 final before any selection or architectural conclusion. Training loop3153.565149s, sharedH100; seed401/B32/LR2e-5, unchanged generator. E98exactpostloss completion started in the released allocation. + +## E97 weekly synthetic coverage first1000 +- Checkpoint SHA-256: `abd335075c429adc73f20e1e291146903a767a3e5c5a52669768863d5585031a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.452547311782837 seconds. +- Overall skill 0.378319; relative MASE 0.743092; relative WQL 0.520107. +- term skill: long=0.3993, medium=0.4061, short=0.3590. +- domain skill: Econ/Fin=0.1270, Energy=0.2360, Healthcare=0.4896, Nature=0.4309, Sales=0.3352, Transport=0.4671, Web/CloudOps=0.4981. +- frequency skill: A=0.3664, D=0.3562, H=0.3957, M=0.1213, Q=0.1976, S=0.4232, T=0.4346, W=0.2365. +- variates skill: multivariate=0.3927, univariate=0.3666. +- Outcome: Main0.378319040 exceeds matched E80at1000 0.376804394 by0.001514645. Monthly skill rises0.10610to0.12127 and weekly0.22573to0.23646; most overall gain is short-term. Original real and unchanged synthetic windows/RNG remain bitwise matched. Continue3k/6k/12k before selection. Seed197/B64/LR2e-5, independentweeklyseed1000200, total20%synthetic unchanged. + +## E94 fresh146M halfLR at8000 +- Checkpoint SHA-256: `650a1a4177cae63f3ceab8a2255fbd2f9d281a7e83e8d380a34bb956bd690884`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 38.053096294403076 seconds. +- Overall skill 0.347153; relative MASE 0.771841; relative WQL 0.552198. +- term skill: long=0.3712, medium=0.3767, short=0.3259. +- domain skill: Econ/Fin=0.1161, Energy=0.2093, Healthcare=0.3516, Nature=0.4137, Sales=0.3243, Transport=0.4423, Web/CloudOps=0.4676. +- frequency skill: A=0.3714, D=0.3436, H=0.3637, M=0.0157, Q=0.1571, S=0.4182, T=0.3966, W=0.2130. +- variates skill: multivariate=0.3599, univariate=0.3368. +- Outcome: Main0.347153427 beats matched high-LR146M8k0.343979357, but remains below37M8k0.353508836. The rate benefit persists but shrinks versus4k; continue16k/24k before choosing a larger-corpus fresh recipe. Same owninit/seed307/B48/96k, only LR differs from E79wide. + +## E102 fixed E96 third-member replacement with E93final — predeclared +Replace only the fullpatch4 EMA6000 member with split input8/output4 EMA12000. Retain E83patch16 and E71patch8_6000, ordered equal1/3 quantile averaging after each unchanged member rule. Every member forecasts every instance. No new optimization, no coefficient sweep or configuration-specific selection. Compare all four established cached cutoffs, requiring full public replay and relocation/composition checks before publication. E93final individual main0.381711986 exceeds its control and parent; earlier cutoffs are currently running. The E101teacher remains the immutable E96 ensemble regardless of this selection result. + +E99 fresh37M early cooldown training started at 2026-10-23T05:15:29Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E89 fullpatch4 final12000 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 51.19871735572815 seconds. +- Overall skill 0.381640; relative MASE 0.741276; relative WQL 0.515825. +- term skill: long=0.4055, medium=0.4047, short=0.3631. +- domain skill: Econ/Fin=0.1486, Energy=0.2408, Healthcare=0.4740, Nature=0.4424, Sales=0.3396, Transport=0.4680, Web/CloudOps=0.4971. +- frequency skill: A=0.3603, D=0.3552, H=0.3960, M=0.1392, Q=0.2025, S=0.4227, T=0.4401, W=0.2492. +- variates skill: multivariate=0.3948, univariate=0.3709. +- Outcome: Final main0.381640078 exceeds matched patch8control0.380847096, essentially ties the cheaper E93input8/output4 final0.381711986, and exceeds selected starting E71parent0.381178739. Training loop5066.016522s on sharedH100, seed401/B32/LR2e-5; actual memory advantage of E93 is supported by maximum-shape checks, while process timings are concurrent rather than exclusive. Evaluate all three earlier cutoffs before choosing a replacement for E96thirdmember. E99cooldown starts in the released allocation. + +## E103 fixed E96 third-member replacement with E89final — predeclared +Test the completed fullpatch4 EMA12000 as the third member, retaining E83patch16/E71patch8 and equal1/3 quantile averaging with unchanged per-member rules. This is the counterpart to E102splitpatch-final replacement, motivated by the near-tie of the matched architecture continuations at12k. No coefficient or per-config choice; every member forecasts every instance. Compare all four cached cutoffs against E96/E102 before selecting the next full replay. No additional optimizer updates. + +Recovery-provenance maintenance: trainer now carries immutable external resume snapshots in parent_checkpoints across subsequent restarts from a run's own mutable recovery.pt. This preserves E98/E99prefix ancestry after another operator recovery and avoids linking mutable source-run recovery files. Metadata only, no training arithmetic changed. CURRENT snapshots now explicitly record the known compiler environment for compiled jobs, including those whose launchers passed it via subprocess environment rather than an env command prefix. No credentials were read. + +### E102 four-cutoff replacement results +{"cutoff": "valid_screen", "skill_score": 0.38490788212550675, "rel_mase_gmean": 0.7369849187976256, "rel_wql_gmean": 0.5133596411831329, "groups": {"term": {"short": 0.3670856470642414, "medium": 0.4084718855262034, "long": 0.40650615955402314}, "domain": {"Econ/Fin": 0.1435289463184154, "Energy": 0.2468980568665663, "Healthcare": 0.4746000842796365, "Nature": 0.44061471938672714, "Sales": 0.3438839562187085, "Transport": 0.4681588575437192, "Web/CloudOps": 0.5046164356104859}, "freq": {"A-DEC": 0.37543835684208393, "Q-DEC": 0.19718024023430158, "M": 0.10850755704828396, "W-SUN": 0.10914931929038174, "D": 0.364713649661322, "H": 0.40088295006065944, "15T": 0.21696396975859744, "W-FRI": 0.016303274872958684, "10T": 0.6274098133659913, "W-TUE": 0.6163821514248893, "W-THU": 0.20854279501175432, "W-WED": 0.32935722968495507, "5T": 0.5196886329209323, "10S": 0.42527389349857736}}, "cpu_seconds": 1.1513165449723601, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.384594982171353, "difference": 0.0003128999541537336} +{"cutoff": "valid_backcast", "skill_score": 0.3397943577904946, "rel_mase_gmean": 0.7942938342926791, "rel_wql_gmean": 0.5487534602272348, "groups": {"term": {"short": 0.3060609208737005, "medium": 0.36022438378162913, "long": 0.40207177797998805}, "domain": {"Econ/Fin": 0.17314936720715002, "Energy": 0.2319064310330724, "Healthcare": 0.40898749701599635, "Nature": 0.3714427052655884, "Sales": 0.4054545766888219, "Transport": 0.37346761267845907, "Web/CloudOps": 0.4512796397157435}, "freq": {"A-DEC": 0.32636255116793356, "Q-DEC": 0.2369053047170233, "M": 0.1881408754401731, "W-SUN": 0.05514520346862939, "D": 0.35254747200062386, "H": 0.37162220001802326, "15T": 0.2225810499701737, "W-FRI": 0.23076747912755158, "10T": 0.32531767521178967, "W-TUE": 0.5449536336522042, "W-THU": 0.2550583257373391, "W-WED": 0.36148774693113794, "5T": 0.441771392840713, "10S": 0.34781169339869}}, "cpu_seconds": 0.9792960570193827, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.33975008510701665, "difference": 4.427268347795277e-05} +{"cutoff": "valid_backcast2", "skill_score": 0.3650870167535245, "rel_mase_gmean": 0.7649173761305604, "rel_wql_gmean": 0.527003973075039, "groups": {"term": {"short": 0.3525196178413804, "medium": 0.3930479998451024, "long": 0.3688394487554716}, "domain": {"Econ/Fin": 0.12187550267974279, "Energy": 0.24171273109616453, "Healthcare": 0.3558210371956918, "Nature": 0.4786187053429537, "Sales": 0.5559745534466993, "Transport": 0.42514365668969034, "Web/CloudOps": 0.4369290048270271}, "freq": {"A-DEC": 0.3369941826448156, "Q-DEC": 0.15634597829751584, "M": 0.16659776433783968, "W-SUN": 0.07034227201826782, "D": 0.4307838193118658, "H": 0.3947195332904091, "15T": 0.10843788342786231, "W-FRI": 0.15292520112219465, "10T": 0.5097026958567001, "W-TUE": 0.1163232645897253, "W-THU": 0.349832844039044, "W-WED": 0.5634413265331784, "5T": 0.4725475721543746, "10S": 0.2849619587969022}}, "cpu_seconds": 1.3131735338829458, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.36472017597795625, "difference": 0.00036684077556825567} +{"cutoff": "valid_backcast3", "skill_score": 0.38962589808404846, "rel_mase_gmean": 0.7393031561148107, "rel_wql_gmean": 0.5039293302189662, "groups": {"term": {"short": 0.3950146881429296, "medium": 0.3683351816334438, "long": 0.3962356024661119}, "domain": {"Econ/Fin": 0.1866323514229733, "Energy": 0.31708138786412254, "Healthcare": 0.2340457735690984, "Nature": 0.5075633858787092, "Sales": 0.3999844088004907, "Transport": 0.5091845709202749, "Web/CloudOps": 0.3939387141464573}, "freq": {"A-DEC": 0.35740138324250814, "Q-DEC": 0.2545638826926907, "M": 0.14196420345262517, "W-SUN": 0.1692422167486961, "D": 0.44092551174968075, "H": 0.4060276831713958, "15T": 0.2544847257167575, "W-FRI": 0.03945021050804143, "10T": 0.6073743483329828, "W-TUE": 0.25124832856283164, "W-THU": 0.3470992258549631, "W-WED": 0.3775958266712779, "5T": 0.46513388285277635, "10S": 0.29273333259972834}}, "cpu_seconds": 0.9749888752121478, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.389238119545644, "difference": 0.00038777853840443743} + +### E103 four-cutoff replacement results +{"cutoff": "valid_screen", "skill_score": 0.38500541763348517, "rel_mase_gmean": 0.7370491942191689, "rel_wql_gmean": 0.5131520925694101, "groups": {"term": {"short": 0.36722493789915567, "medium": 0.40845783827201154, "long": 0.4066128546537624}, "domain": {"Econ/Fin": 0.14488968734284446, "Energy": 0.2473756772173874, "Healthcare": 0.4777300437443104, "Nature": 0.4411115514129288, "Sales": 0.3448077959265311, "Transport": 0.46774095296357987, "Web/CloudOps": 0.5033387584756153}, "freq": {"A-DEC": 0.37541665630455645, "Q-DEC": 0.19911678292032942, "M": 0.11881300866622979, "W-SUN": 0.1096477052731838, "D": 0.362528588146091, "H": 0.4015705047657928, "15T": 0.21804762920144782, "W-FRI": 0.016363727924622262, "10T": 0.6271485862780906, "W-TUE": 0.6209733756670539, "W-THU": 0.20999017480896343, "W-WED": 0.3297749874361884, "5T": 0.5175349566789766, "10S": 0.42462313787098094}}, "cpu_seconds": 1.0732698428910226, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.384594982171353, "difference": 0.00041043546213215265} +{"cutoff": "valid_backcast", "skill_score": 0.3398214546118604, "rel_mase_gmean": 0.7942044163673427, "rel_wql_gmean": 0.5487701941828703, "groups": {"term": {"short": 0.305847769661334, "medium": 0.3615040967825627, "long": 0.40146856729517433}, "domain": {"Econ/Fin": 0.17464373027255042, "Energy": 0.23108171914379005, "Healthcare": 0.41082426569988595, "Nature": 0.3718443434112704, "Sales": 0.40646820364012926, "Transport": 0.3728762819285243, "Web/CloudOps": 0.4515441161888809}, "freq": {"A-DEC": 0.32427594695442885, "Q-DEC": 0.23945276396724646, "M": 0.19719617479508833, "W-SUN": 0.052844558516275786, "D": 0.35260466772957, "H": 0.3721367040211806, "15T": 0.2223065777034271, "W-FRI": 0.22845992938029724, "10T": 0.3234396022330981, "W-TUE": 0.5459245154169383, "W-THU": 0.24711082469129164, "W-WED": 0.36312061525273154, "5T": 0.4404099962380955, "10S": 0.3485327044406994}}, "cpu_seconds": 0.9945498188026249, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.33975008510701665, "difference": 7.13695048437657e-05} +{"cutoff": "valid_backcast2", "skill_score": 0.3647180336171173, "rel_mase_gmean": 0.7654029032858002, "rel_wql_gmean": 0.5272820041297973, "groups": {"term": {"short": 0.3518878749308295, "medium": 0.3927580540668256, "long": 0.3691077522689188}, "domain": {"Econ/Fin": 0.12218990276622621, "Energy": 0.24251138907504843, "Healthcare": 0.34933847363414383, "Nature": 0.4781212829897, "Sales": 0.55694372735719, "Transport": 0.4243899770061409, "Web/CloudOps": 0.43650428576145894}, "freq": {"A-DEC": 0.33629748314335295, "Q-DEC": 0.1560373253956937, "M": 0.16237816345656342, "W-SUN": 0.07189010798504825, "D": 0.43022756178029165, "H": 0.39543965655443114, "15T": 0.10619855263453626, "W-FRI": 0.15256288862137302, "10T": 0.5099262713842705, "W-TUE": 0.11275167806759523, "W-THU": 0.3476561865337633, "W-WED": 0.565409644514056, "5T": 0.4712731877671763, "10S": 0.2859728774327921}}, "cpu_seconds": 0.9891702111344784, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.36472017597795625, "difference": -2.142360838952584e-06} +{"cutoff": "valid_backcast3", "skill_score": 0.38952531921448574, "rel_mase_gmean": 0.7397344287798532, "rel_wql_gmean": 0.5038015284686523, "groups": {"term": {"short": 0.39470492326109163, "medium": 0.3679378045902095, "long": 0.39702622151428124}, "domain": {"Econ/Fin": 0.18635232828843817, "Energy": 0.3167555032477224, "Healthcare": 0.2321529881554648, "Nature": 0.5080109601079104, "Sales": 0.40020731613048277, "Transport": 0.5096409724474877, "Web/CloudOps": 0.3934863582665823}, "freq": {"A-DEC": 0.34966366686932726, "Q-DEC": 0.25774901005566275, "M": 0.13921842550571784, "W-SUN": 0.1678888068666432, "D": 0.4412824281729495, "H": 0.40605210717475726, "15T": 0.2556303886920226, "W-FRI": 0.03145225561173515, "10T": 0.6068260917454812, "W-TUE": 0.2595682801406983, "W-THU": 0.3474528636749996, "W-WED": 0.3763281957599267, "5T": 0.4644139584813969, "10S": 0.29384233335279064}}, "cpu_seconds": 1.3381098771933466, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.389238119545644, "difference": 0.00028719966884172} +Next full replay: E102 improves all four cutoffs and has the cheaper input8 encoder. E103 is slightly stronger on main/first earlier but weaker thanE102 onsecond/third; secondearlier effectivelyties E96. E103is retained as a cached alternative, without a claimed full-suite result. No new optimizer updates in either ensemble composition. + +## E97 weekly synthetic coverage at3000 +- Checkpoint SHA-256: `a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.279794216156006 seconds. +- Overall skill 0.380663; relative MASE 0.740647; relative WQL 0.517896. +- term skill: long=0.4025, medium=0.4068, short=0.3617. +- domain skill: Econ/Fin=0.1317, Energy=0.2379, Healthcare=0.4904, Nature=0.4332, Sales=0.3335, Transport=0.4661, Web/CloudOps=0.5036. +- frequency skill: A=0.3690, D=0.3546, H=0.3977, M=0.1269, Q=0.1964, S=0.4224, T=0.4386, W=0.2419. +- variates skill: multivariate=0.3970, univariate=0.3674. +- Outcome: Main0.380663183 exceeds matched E80at3000 0.378663825 by0.001999358, sustaining the1k gain. Earlier cutoffs are now running; no independent-model publication yet. Seed197/B64/LR2e-5, exact original real/non-replaced synthetic streams preserved, weekly replacement1/11 of20%synthetic. + +## E104 transfer the matched weekly-synthesis correction — predeclared +Hypothesis: E97weekly3000 minus E80overflow-control3000 isolates the new weekly synthetic coverage and can improve E83, while retaining E83postprocessing-aware and slowAR contributions. Apply exactly coefficient1: E83postloss_slow_ar_delta6k + E97weekly_synthEMA3000 - E80overflow_controlEMA3000. All model keys/configurations align; all weights were trained here on allowed data, with the delta pair sharing seed197/B64/LR2e-5 and original sampler/horizon streams. No coefficient sweep or optimizer updates. E97earlier results are not yet available at declaration. Evaluate the fixed composition at all four cutoffs and then its fixed equal1/3 ensemble with E71patch8_6000 and E93splitpatch_12000, replacing only E102firstmember. Use unchanged postloss_inference numerical fallback and fixed rules. This is a predictive composition test, with full public replay/checks required for any publication. E101teacher remains frozen E96. + +## E93 split patch final earlier cutoff1 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 35.36992645263672 seconds. +- Overall skill 0.336872; relative MASE 0.797481; relative WQL 0.551410. +- term skill: long=0.4020, medium=0.3579, short=0.3016. +- domain skill: Econ/Fin=0.1748, Energy=0.2280, Healthcare=0.3931, Nature=0.3699, Sales=0.4068, Transport=0.3691, Web/CloudOps=0.4509. +- frequency skill: A=0.3160, D=0.3464, H=0.3726, M=0.1800, Q=0.2360, S=0.3514, T=0.3341, W=0.2756. +- variates skill: multivariate=0.3569, univariate=0.3205. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E93 split patch final earlier cutoff2 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 31.873882293701172 seconds. +- Overall skill 0.361104; relative MASE 0.770556; relative WQL 0.529731. +- term skill: long=0.3665, medium=0.3913, short=0.3470. +- domain skill: Econ/Fin=0.1207, Energy=0.2377, Healthcare=0.3430, Nature=0.4729, Sales=0.5545, Transport=0.4214, Web/CloudOps=0.4356. +- frequency skill: A=0.3185, D=0.4195, H=0.3908, M=0.1553, Q=0.1616, S=0.2820, T=0.3625, W=0.2958. +- variates skill: multivariate=0.3609, univariate=0.3613. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E93 split patch final earlier cutoff3 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 33.14549136161804 seconds. +- Overall skill 0.385555; relative MASE 0.745119; relative WQL 0.506687. +- term skill: long=0.3946, medium=0.3685, short=0.3886. +- domain skill: Econ/Fin=0.1861, Energy=0.3097, Healthcare=0.2354, Nature=0.5014, Sales=0.3950, Transport=0.5057, Web/CloudOps=0.3950. +- frequency skill: A=0.3543, D=0.4270, H=0.4025, M=0.1610, Q=0.2496, S=0.2977, T=0.4286, W=0.2436. +- variates skill: multivariate=0.3696, univariate=0.3979. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E89 full patch4 final earlier cutoff1 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 55.011173486709595 seconds. +- Overall skill 0.336345; relative MASE 0.797972; relative WQL 0.551947. +- term skill: long=0.3997, medium=0.3611, short=0.3004. +- domain skill: Econ/Fin=0.1781, Energy=0.2248, Healthcare=0.3992, Nature=0.3709, Sales=0.4088, Transport=0.3668, Web/CloudOps=0.4509. +- frequency skill: A=0.3067, D=0.3457, H=0.3740, M=0.2061, Q=0.2429, S=0.3533, T=0.3298, W=0.2654. +- variates skill: multivariate=0.3532, univariate=0.3226. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E89 full patch4 final earlier cutoff2 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 54.35282373428345 seconds. +- Overall skill 0.359845; relative MASE 0.771620; relative WQL 0.531089. +- term skill: long=0.3668, medium=0.3902, short=0.3451. +- domain skill: Econ/Fin=0.1192, Energy=0.2393, Healthcare=0.3219, Nature=0.4739, Sales=0.5564, Transport=0.4186, Web/CloudOps=0.4338. +- frequency skill: A=0.3129, D=0.4161, H=0.3924, M=0.1622, Q=0.1597, S=0.2850, T=0.3585, W=0.2927. +- variates skill: multivariate=0.3606, univariate=0.3592. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E89 full patch4 final earlier cutoff3 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 54.33600902557373 seconds. +- Overall skill 0.384241; relative MASE 0.747472; relative WQL 0.507256. +- term skill: long=0.3960, medium=0.3667, short=0.3865. +- domain skill: Econ/Fin=0.1847, Energy=0.3079, Healthcare=0.2301, Nature=0.5006, Sales=0.3948, Transport=0.5062, Web/CloudOps=0.3930. +- frequency skill: A=0.3322, D=0.4254, H=0.4016, M=0.1568, Q=0.2587, S=0.3002, T=0.4273, W=0.2401. +- variates skill: multivariate=0.3670, univariate=0.3975. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E95 all-shard coverage at6000 +- Checkpoint SHA-256: `78a3c47718545643662029245141e6d39e64cf0853d2502f20222123ce3cd5c7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.874247789382935 seconds. +- Overall skill 0.376043; relative MASE 0.746531; relative WQL 0.521508. +- term skill: long=0.4012, medium=0.4068, short=0.3538. +- domain skill: Econ/Fin=0.1318, Energy=0.2380, Healthcare=0.4414, Nature=0.4294, Sales=0.3318, Transport=0.4670, Web/CloudOps=0.4991. +- frequency skill: A=0.3714, D=0.3507, H=0.3948, M=0.0936, Q=0.1963, S=0.4213, T=0.4386, W=0.2145. +- variates skill: multivariate=0.3939, univariate=0.3614. +- Outcome: Skill0.376043220 falls below matched E80control6000 0.378288765. Continue the declared12000 schedule; broader coverage at fixed volume has not improved the mature model. + +## E98 original postloss schedule at6000 +- Checkpoint SHA-256: `7f1a2200b0f6a2cd63a378b001010e4a4a9776eba76c800ee1d61c23fc8bf9cb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.866560697555542 seconds. +- Overall skill 0.377594; relative MASE 0.744160; relative WQL 0.520572. +- term skill: long=0.4019, medium=0.4066, short=0.3564. +- domain skill: Econ/Fin=0.1081, Energy=0.2440, Healthcare=0.4585, Nature=0.4289, Sales=0.3383, Transport=0.4638, Web/CloudOps=0.5007. +- frequency skill: A=0.3681, D=0.3493, H=0.3983, M=0.0713, Q=0.1895, S=0.4227, T=0.4403, W=0.2264. +- variates skill: multivariate=0.3955, univariate=0.3630. +- Outcome: Exact optimizer/RNG continuation from originalE75step3653; no reset. Skill0.377594313 is below E75at3000 0.378813891 and E80at6000 0.378288765. Continue to predeclared12000; no checkpoint replacement. + +## E79 fresh37M original schedule at36000 +- Checkpoint SHA-256: `06778302f2e405ecd30fd00407523d03be8756c7a6029c38a26360cbeb98becf`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.79560947418213 seconds. +- Overall skill 0.364859; relative MASE 0.756433; relative WQL 0.533298. +- term skill: long=0.3873, medium=0.3910, short=0.3457. +- domain skill: Econ/Fin=0.1266, Energy=0.2248, Healthcare=0.4265, Nature=0.4125, Sales=0.3402, Transport=0.4559, Web/CloudOps=0.4912. +- frequency skill: A=0.3896, D=0.3497, H=0.3830, M=0.0639, Q=0.1985, S=0.4187, T=0.4195, W=0.2201. +- variates skill: multivariate=0.3809, univariate=0.3518. +- Outcome: Original96k schedule control, seed307/B48/LR2e-4. Skill0.364859034 improves on30k0.358563990; compare E99cooldown at the same step when available. + +## E105 nested corpus volume at fixed source probabilities — predeclared +Hypothesis: the mature model may benefit from more distinct allowed series beyond the all-shard coverage change. Compare against E95 using the exactly nested packed_stratified_large instead of packed_stratified. Source probabilities stay bitwise those of packed_sample, all95directories, all model/optimizer/EMA/horizon settings unchanged: ownE62initial SHA22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, seed197/B64/LR2e-5/12000steps, paired loss, overflow_control code, postloss_inference runtime. Per-directory softcap192M versus24M points; total5,354,822,975points/1,059,868series versus952,527,771points/342,661series. Same global series order and per-series crop rules, exact binary/record prefix checked for all95dirs. stratified_large_audit.json replays260actualseries and verifies source probabilities, seed461,19.984999CPU seconds,0optimizerupdates/no validationreads. More series changes the sampler trajectory; this is a single-seed volume comparison, not identical sampled rows. E95at6000 currently trails E80; E105 tests whether volume recovers that deficit. Queue after E95 in its allocation. Screens1000/3000/6000/12000; earlier cutoffs and full replay required before publication. No added training data sources or new generator. + +## E106 spectral smoothness prior in synthetic residuals — preparation +Hypothesis: the original white/AR1 synthetic residuals underrepresent smooth stochastic changes. Replace only the noise residual in half of synthetic windows (total synthetic share unchanged20%) with a unit-marginal-variance stationary Gaussian draw generated here by FFT. Equal kernel-family prior: Matérn nu0.5/1.5/2.5 or squared-exponential; length scale10**U(0,4) steps. Generate a periodic FFT field of next-power-of-two length at least4times the window and keep its prefix; normalize by theoretical spectral variance, never by realized future values. Keep the original Fourier components, trend, changepoint, intermittent and positivity transforms, periods and observed masks. Always consume the original residual RNG before replacement; independent spectral seed1100200 preserves the full original sampler/horizon streams and all non-replaced rows. This differs from E14's multi-family whole-series replacement and E78's four-AR-component sum. Comparator E80: ownE62initial SHA22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, seed197/B64/LR2e-5/12000steps, paired loss, oldpacked_sample/sourceweights, overflow-safe model unchanged. CPU distribution/RNG checks required before launch; no validation in generator or training. Queue after E98 when checks pass. Screen1000/3000/6000/12000 and earlier cutoffs for promising checkpoints; no coefficient sweep. +E106 CPU audit passed: seed499,7680paired candidate/control windows,1535synthetic rows,743spectral replacements. All non-replaced rows, period labels, finite masks and original/horizon RNG states are bitwise unchanged; saving/restoring all NumPy states replays the next batch exactly. Model file byte-identical toE80 SHA44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499. Four kernel-family empirical variances/autocovariances over1024draws each match their declared discrete spectral covariances within0.005 (tolerance0.045); extreme length scales1/10000 and window lengths8/40/5120 remain finite. Sampler comparison4.179206CPU seconds,total4.517388seconds,0optimizerupdates/no validationread. Receipt spectral_synth_checks.json. Queued after E98queue10664; full training metadata and publisher generator provenance added. + +## E102 split-patch replacement full public replay +- Checkpoint SHA-256: `2dedb7fd1052bf72a38fc005cc8c89f65d42a50260830de0f0efbb5f16a30b4f`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.381163; relative MASE 0.739673; relative WQL 0.517741. +- term skill: long=0.4007, medium=0.4074, short=0.3631. +- domain skill: Econ/Fin=0.1245, Energy=0.2404, Healthcare=0.4799, Nature=0.4407, Sales=0.3581, Transport=0.4683, Web/CloudOps=0.4964. +- frequency skill: A=0.2968, D=0.3691, H=0.3956, M=0.1343, Q=0.1868, S=0.4253, T=0.4379, W=0.2354. +- variates skill: multivariate=0.3952, univariate=0.3698. +- Outcome: Fixed equal1/3 ensemble E83patch16/E71patch8_6000/E93input8output4_12000. Full skill0.38116304998662165 exceeds E96full0.3807214453622526 by0.00044160462436904; zero failures across97configurations/151170instances. Inference358.197612shared-H100 seconds. Relocation already bitwise; independent component/composition checks pending before atomic publication. Validation selection only; no held-out reward claim. + +E102 final checks all passed before publication: split_ensemble_validation_receipt.json completes allfive steps in510.069582wall seconds including lock waits. Public inference358.197612seconds. Relocated three-example inference is bitwise identical/finite/ordered,31.745146seconds. Independent public third-member replay plus orderedfloat32 component mean exactly match bundled output for three complete actual configurations; see split_patch_composition_replay.json and split_ensemble_composition_checks.json. Descriptor2dedb7fd1052bf72a38fc005cc8c89f65d42a50260830de0f0efbb5f16a30b4f;110,068,216parameters. Selected for atomic publication over E96. Allfour diagnostic cutoffs improve; full-term skills long0.400651,medium0.407396,short0.363109. Descriptive group/config comparison and cluster bootstrap saved in split_ensemble_comparison.json; no held-out significance claim. E101teacher remains immutable E96. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/model1.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/model1.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/model1.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..39b209306784e29bafb2d2428dfb3e940b5ff2dd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/model_manifest.json @@ -0,0 +1,659 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36800800, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "weights_sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "model.py": "d4b76fb1a63789e091b114dd947abe30be3e47c2e2e9d41cecb3e3353af86ac5" + }, + "checkpoint_composition": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 32768, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/model.py new file mode 100644 index 0000000000000000000000000000000000000000..014b585df72cc69852a8eedf302320b52fe55aad --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/model.py @@ -0,0 +1,216 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/torch_post.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/torch_post.py new file mode 100644 index 0000000000000000000000000000000000000000..e19586bcc1677d56cedb6ce02c2f57797157f5f3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/postloss/torch_post.py @@ -0,0 +1,112 @@ +"""Differentiable forecast transforms with the package's fixed context rules. + +Context statistics are constants with respect to model parameters. Gradients +flow only through the forecast, including the continuity correction's anchor. +""" +import torch + + +@torch.no_grad() +def context_statistics(ctx, periods, horizon): + x=ctx.double(); finite=torch.isfinite(x); clean=torch.where(finite,x,0.) + b,c=x.shape; device=x.device + pos=torch.arange(c,device=device)[None,:] + count=finite.sum(-1).clamp(min=1) + mean=clean.sum(-1)/count + variance=(torch.where(finite,x-mean[:,None],0.).square()).sum(-1)/count + positive=((x>=0)|~finite).all(-1) + zeros=((x==0)&finite).sum(-1) + zero_active=positive&(zeros>=4)&(zeros/count>=.1) + cutoff=torch.where(zero_active,.4*variance.sqrt(),0.) + first=torch.where(finite,pos,c).min(-1).values + length=c-first + phase=torch.arange(max(1,c//3),device=device)[None,:] + future=torch.arange(horizon,device=device)[None,:] + z=torch.tensor([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0, + .2533471031,.5244005127,.8416212336,1.2815515655],device=device) + best_weight=torch.zeros(b,device=device,dtype=torch.float64) + prior=torch.zeros(b,horizon,9,device=device,dtype=torch.float64) + prior_valid=torch.zeros(b,horizon,device=device,dtype=torch.bool) + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + cycles=(length[:,None]//p).clamp(max=8) + history=finite&(pos>=c-cycles*p) + n=history.sum(-1).clamp(min=1) + center=(clean*history).sum(-1)/n + var=torch.where(history,x-center[:,None],0.).square().sum(-1)/n + previous=pos-p;safe=previous.clamp(min=0) + pairs=(previous>=c-cycles*p)&(previous>=0)&finite&finite.gather(1,safe) + pairs_count=pairs.sum(-1) + difference=clean-clean.gather(1,safe) + mse=(difference.square()*pairs).sum(-1)/pairs_count.clamp(min=1) + weight=(1-mse/(var+1e-12)/.25).clamp(0,.98) + eligible=(p[:,0]>=2)&(cycles[:,0]>=3)&(pairs_count>=p[:,0]) + weight=torch.where(eligible,weight,0.) + values=[];observed=[] + for cycle in range(4): + idx=c-p+phase-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(phase=0)&(cycle0 + template=(values*observed).sum(0)/nphase.clamp(min=1) + ntemplate=phase_valid.sum(-1).clamp(min=1) + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent=finite&(pos>=c-p) + nr=recent.sum(-1).clamp(min=1) + recent_mean=(clean*recent).sum(-1)/nr + template=template+(recent_mean-template_mean)[:,None] + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent_var=torch.where(recent,x-recent_mean[:,None],0.).square().sum(-1)/nr + template_var=((template-template_mean[:,None]).square()*phase_valid).sum(-1)/ntemplate + used_cycles=cycles[:,0].clamp(min=1,max=4) + noise=mse/2 + target_var=(recent_var-noise).clamp(min=0) + base_var=(template_var-noise/used_cycles).clamp(min=0) + ratio=(target_var/base_var.clamp(min=1e-12)).sqrt().clamp(.5,2.) + align=nr>=torch.maximum(torch.full_like(nr,2),.75*p[:,0]) + ratio=torch.where(align,ratio,1.) + template=template_mean[:,None]+(template-template_mean[:,None])*ratio[:,None] + sigma=(noise*(1+1/used_cycles)).sqrt() + index=(future%p).clamp(max=phase.shape[-1]-1) + selected=template.gather(1,index) + valid=phase_valid.gather(1,index) + q=selected[:,:,None]+sigma[:,None,None]*z[None,None,:] + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + choose=weight>best_weight + prior=torch.where(choose[:,None,None],q,prior) + prior_valid=torch.where(choose[:,None],valid,prior_valid) + best_weight=torch.maximum(best_weight,weight) + seasonal_weight=best_weight[:,None]*prior_valid + + recent=x[:,-512:];seen=torch.isfinite(recent) + n=seen.sum(-1).clamp(min=1);clean_recent=torch.where(seen,recent,0.) + center=clean_recent.sum(-1)/n + var=torch.where(seen,recent-center[:,None],0.).square().sum(-1)/n + differences=recent[:,1:]-recent[:,:-1] + diff_seen=torch.isfinite(differences);nd=diff_seen.sum(-1) + mse=torch.where(diff_seen,differences,0.).square().sum(-1)/nd.clamp(min=1) + tail=differences[:,-8:] + tail_seen=torch.isfinite(tail);nt=tail_seen.sum(-1) + sorted_tail=torch.where(tail_seen,tail,float('inf')).sort(-1).values + if tail.shape[-1]: + lo=((nt-1).clamp(min=0)//2)[:,None];hi=(nt//2).clamp(max=tail.shape[-1]-1)[:,None] + median=(sorted_tail.gather(1,lo)+sorted_tail.gather(1,hi))[:,0]/2 + else:median=torch.zeros(b,device=device,dtype=x.dtype) + continuity_weight=(1-mse/(var+1e-12)/.5).clamp(0,.95) + active=(nd>=8)&(nt>0)&seen[:,-1] + continuity_weight=torch.where(active,continuity_weight,0.) + anchor=torch.where(active,recent[:,-1]+median,0.) + return seasonal_weight,prior,continuity_weight,anchor,positive,cutoff + + +def apply_fixed(ctx,periods,quant): + """Quantiles are raw-scale tensors of shape (batch,horizon,9).""" + weight,prior,cweight,anchor,positive,cutoff=context_statistics(ctx,periods,quant.shape[1]) + q=torch.where(positive[:,None,None],quant.clamp(min=0),quant) + q=((1-weight[:,:,None])*q+weight[:,:,None]*prior).float() + bias=(cweight*(anchor-q[:,0,4])).float() + decay=torch.exp(-torch.arange(q.shape[1],device=q.device,dtype=torch.float64)/24) + q=(q.double()+bias[:,None,None]*decay[None,:,None]).float() + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return torch.where((q>=0)&(q8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..0b3bbf29f7f2d96a4e8c89e54f635c0171fe0446 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member0/training/recovery/train.py @@ -0,0 +1,130 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +a=ap.parse_args();sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='overflow_control':a.normalization_overflow_fallback=True +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':[a.initialize_ema] if a.initialize_ema else []} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=0 and step>a.reset_at else step + lr=a.lr*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/a.steps))) + for group in opt.param_groups:group['lr']=lr*group['lr_multiplier'] + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16): + loss=objective(model,x,y,p,paired=a.loss_mode=='paired') if a.loss_mode else objective(model,x,y,p) + loss.backward();norm=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(norm): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.monotonic()-started,1), + 'lr':lr,'grad_norm':float(norm),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with (out/'log.jsonl').open('a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=(a.stop_file and Path(a.stop_file).exists()) or (a.halt_after and step>=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..59444191c77e10f6bbad7d5a3c54d0c0aca5f55c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member1/training/recovery/train.py @@ -0,0 +1,132 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +a=ap.parse_args();sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='overflow_control':a.normalization_overflow_fallback=True +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':[a.initialize_ema] if a.initialize_ema else []} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=0 and step>a.reset_at else step + lr=a.lr*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/a.steps))) + for group in opt.param_groups:group['lr']=lr*group['lr_multiplier'] + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16): + loss=objective(model,x,y,p,paired=a.loss_mode=='paired') if a.loss_mode else objective(model,x,y,p) + loss.backward();norm=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(norm): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.monotonic()-started,1), + 'lr':lr,'grad_norm':float(norm),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with (out/'log.jsonl').open('a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=(a.stop_file and Path(a.stop_file).exists()) or (a.halt_after and step>=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..6f6d33214074e6d30f01bfd72b918a07caac71a3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/model_manifest.json @@ -0,0 +1,647 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36601928, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404" + ], + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "training_lineage": [ + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 8192, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3b3f245d67e92b6c65f92dabee2e389c9e3dbffc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/recovery/train.py @@ -0,0 +1,175 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':([a.initialize_ema] if a.initialize_ema else [])+(teacher.checkpoints if teacher else [])} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..9a16c87c0cf45b0efb1b2e56008a821c8391b471 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/convert.py @@ -0,0 +1,13 @@ +"""Convert the already locally trained patch8 model to input8/output4 without external assets.""" +import argparse,hashlib,json,time +from pathlib import Path +import torch +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +torch.set_num_threads(1);started=time.monotonic();ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==8 +x=state['query.0.weight'].reshape(d,8,9);state['query.0.weight']=(x[:,:4]+x[:,4:]).reshape(d,36) +x=state['recency.weight'].reshape(d,8,4);state['recency.weight']=(x[:,:4]+x[:,4:]).reshape(d,16) +state['head.weight']=state['head.weight'].reshape(8,18,d)[:4].reshape(72,d).clone();state['head.bias']=state['head.bias'].reshape(8,18)[:4].reshape(72).clone() +ck['config']['patch']=4;ck['config']['input_patch']=8 +conversion={'method':'retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates','exact_function_preservation':False,'parent_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest()} +ck.update(step=0,args={'packed':ck['args']['packed'],'initialize_from':str(Path(a.input).resolve()),'converted':True},parent_checkpoints=[str(Path(a.input).resolve())],conversion=conversion) +torch.save(ck,a.output);receipt={**conversion,'checkpoint_sha256':hashlib.sha256(Path(a.output).read_bytes()).hexdigest(),'parameters':sum(v.numel() for v in state.values()),'cpu_seconds':time.monotonic()-started,'optimizer_updates':0};Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2));print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/model.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/member2/training/split_patch/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..8579e276dd57a0c103bd91cc0ef918b0314ed7cc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S052/provenance/publish.py @@ -0,0 +1,103 @@ +"""Assemble and atomically publish a complete three-member, fixed-weight package.""" +import argparse +import ctypes +import hashlib +import json +import os +import shutil +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ap = argparse.ArgumentParser() +ap.add_argument('--member', action='append', required=True) +ap.add_argument('--out', required=True) +ap.add_argument('--report') +ap.add_argument('--experiments', default='/workspace/research/direct_v1/EXPERIMENTS.md') +a = ap.parse_args() +assert len(a.member) == 3 +final = Path(a.out) +stage = final.parent / f'.{final.name}-staging-{os.getpid()}' +shutil.rmtree(stage, ignore_errors=True) +stage.mkdir(parents=True) + +def digest(path): + h = hashlib.sha256() + with Path(path).open('rb') as f: + for block in iter(lambda: f.read(8 * 1024 * 1024), b''): + h.update(block) + return h.hexdigest() + +for name in ('infer.sh', 'predict.py', 'model.py', 'seasonal.py', 'continuity.py', + 'zero_mass.py', 'ts_io.py'): + shutil.copy2(HERE / 'runtime' / name, stage / name) +shutil.copy2('/opt/runtime/requirements.txt', stage / 'requirements.txt') +shutil.copy2(a.experiments, stage / 'EXPERIMENTS.md') +members, sources, lineage = [], set(), {} +for i, source in enumerate(map(Path, a.member)): + manifest = json.loads((source / 'model_manifest.json').read_text()) + assert manifest['pretrained_assets'] == [] + for shared in ['seasonal.py','continuity.py','zero_mass.py']: + assert digest(source/shared)==digest(stage/shared),'Members must retain identical fixed postprocessing rules' + name = f'member{i}.pt' + model_code = f'model{i}.py' + shutil.copy2(source / 'model.py', stage / model_code) + assert digest(stage / model_code) == manifest['runtime_code_sha256']['model.py'] + shutil.copy2(source / 'weights.pt', stage / name) + assert digest(stage / name) == manifest['weights_sha256'] + members.append({'weights': name, 'weights_sha256': manifest['weights_sha256'], + 'parameters': manifest['parameters'], 'config': manifest['config'], 'model_code': model_code}) + sources.update(manifest['sources_used']) + for item in manifest['training_lineage']: + lineage.setdefault(item['sha256'], item) + dst = stage / 'provenance' / f'member{i}' + dst.mkdir(parents=True) + shutil.copy2(source / 'model_manifest.json', dst / 'model_manifest.json') + shutil.copytree(source / 'provenance', dst / 'training') +shutil.copy2(__file__, stage / 'provenance' / 'publish.py') +descriptor = {'members': members, 'weights': [1/3]*3, + 'composition': 'mean after each member applies its fixed inference rules'} +(stage / 'config.json').write_text(json.dumps(descriptor, indent=2) + '\n') +identifier = digest(stage / 'config.json') +manifest = { + 'name': 'direct-seasonal-three-patch-foundation', 'contract': 'timeseries-forecast/v1', + 'parameters': sum(m['parameters'] for m in members), 'pretrained_assets': [], + 'sources_used': sorted(sources), 'members': members, + 'checkpoint_sha256': identifier, + 'checkpoint_digest_method': 'SHA-256 of config.json, including ordered member weight hashes', + 'training_lineage': list(lineage.values()), 'ensemble_weights': [1/3]*3, + 'every_member_forecasts_every_instance': True, + 'postprocessing_order': 'each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4; then equal quantile average', + 'runtime_code_sha256': {p.name: digest(p) for p in stage.iterdir() if p.suffix in ('.py', '.sh')}, + 'notes': 'All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation.', +} +(stage / 'model_manifest.json').write_text(json.dumps(manifest, indent=2) + '\n') +if a.report: + report = json.loads(Path(a.report).read_text()) + assert report['checkpoint_sha256'] == identifier + shutil.copy2(a.report, stage / 'validation_report.json') +else: + report = {'status': 'candidate validation pending'} + (stage / 'validation_report.json').write_text(json.dumps(report) + '\n') +if final.resolve() == Path('/workspace/submission').resolve(): + assert a.report and report['n_configs'] == 97 and report['n_instances'] == 151170 + assert report['n_failed'] == 0 +patch_sizes = ', '.join(str(m['config'].get('input_patch', m['config']['patch'])) + '/' + str(m['config']['patch']) for m in members) +(stage / 'README.md').write_text(f'''# Three-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains three locally trained models totaling {manifest['parameters']:,} parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed equal weights of 1/3 each. + +The three members use up to 4,096 history observations. Their history/forecast patch sizes are {patch_sizes}, in member order. Each member retains its own original model implementation and normalization; the first has a float64 fallback for nonfinite float32 context statistics. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary uses a fixed width of 128 observations. The zero projection threshold is 0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. +''') +if final.exists(): + libc = ctypes.CDLL(None, use_errno=True) + if libc.renameat2(-100, os.fsencode(stage), -100, os.fsencode(final), 2): + raise OSError(ctypes.get_errno(), os.strerror(ctypes.get_errno())) + shutil.rmtree(stage) +else: + os.replace(stage, final) +print(json.dumps({'out': str(final), 'checkpoint_sha256': identifier, + 'parameters': manifest['parameters']})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/EXPERIMENTS.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/EXPERIMENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..1bac8c1314ff12cce47550191d49d89dcbd6ed51 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/EXPERIMENTS.md @@ -0,0 +1,6345 @@ +# Experiments + +All learned weights are initialized here from scratch. Validation windows are used only for selection and diagnostics. Screen evaluations span all 97 configurations, sampling at most 192 instances per configuration with seed 2026 and recomputing Seasonal Naive on exactly that subset. Full validation uses the supplied reference. Neither scale is the held-out reward scale. + +## E0: contract bootstrap +- Hypothesis: maintain a runnable package while training the first candidate. +- Changed factor: none; provided Seasonal Naive formula, with no learned parameters. +- Seed: deterministic. Measured compute: no training. +- Checkpoint hash: not applicable. +- Outcome: provisional package published with atomic directory exchange. + +## E1: direct long-horizon quantile forecasting +- Hypothesis: a direct horizon objective and explicit seasonal context features reduce long-horizon median drift and the underestimation of uncertainty from short-patch autoregression. +- Changed factors relative to the supplied baseline: 6,758,720-parameter encoder/decoder (4 encoder and 3 decoder layers, width 256), 32-point patches, variable 512–4096-point context, direct 32/128/512/1024-step objectives, monotone nine-quantile head. Context features contain recent levels, fixed damped slope and four-cycle primary/secondary seasonal averages; all weights are globally fixed at inference. +- Corpus: all 95 mounted allow-listed directories, deterministic source-capped sample totaling 958,745,103 points / 3.835 GB and 357,789 series. Shortest retained series: 16 points. At most eight shuffled shards per source, up to approximately 24M points/source. Series exceeding 131,072 points are cropped at a random position. Packing took under two minutes on six workers. +- Mixture: directory weight proportional to capped points^0.25, climate multiplier 0.35, low-frequency competition-source multiplier 3. Synthetic proportion 20%. Exact logic is in provenance/data.py. +- Synthetic generator: newly generated damped trends, Fourier seasonality, AR noise, intermittent demand and changepoints. No downloaded synthetic assets. +- Training seed: 17. AdamW 3e-4, batch 128, 400-step warmup, cosine decay, bf16, one H100. Run planned for 12,000 steps with snapshots every 1,000 steps. +- Control: randomly initialized model with zero output projection (fixed seasonal mixture and fixed initial interval widths) saved at step 0 to distinguish learning from the forecasting prior. +- Completed 12,000 steps in 349.9 seconds on one H100. Measured group skills, checkpoint hashes and outcomes are recorded below. + +## Known limits and next decisions +- This first run jointly changes the architecture and objective; it does not isolate their individual causal contributions. +- The initial corpus pack samples shuffled shards but takes early Arrow record batches within each selected shard. Later runs should test a wider source sample if validation plateaus. +- 10-second daily seasonality exceeds the 4,096-point encoder window. Longer fixed context summaries are a planned ablation after initial diagnostics. + +## E1 control, step 0, screening +- Checkpoint SHA-256: `81be0f24c44a558e29dffcabb4ac15ae3c944e1afe2860851683d155f920ec2f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.037512302398682 seconds. +- Overall skill 0.000921; relative MASE 1.194471; relative WQL 0.835649. +- term skill: long=0.0466, medium=0.0284, short=-0.0280. +- domain skill: Econ/Fin=-1.0735, Energy=-0.1019, Healthcare=-0.0966, Nature=0.2991, Sales=0.3167, Transport=0.2140, Web/CloudOps=-0.1294. +- frequency skill: A=-0.6469, D=0.1541, H=0.1205, M=-0.3393, Q=-0.5490, S=-2.2691, T=0.1079, W=-0.0412. +- variates skill: multivariate=0.0528, univariate=-0.0424. +- Outcome: Untrained seasonal-mixture prior barely exceeds Seasonal Naive overall and fails badly on 10-second and low-frequency configurations. + +## E1 step 1000, seed 17, screening +- Checkpoint SHA-256: `ebdd9eaa223c2bb6e38b8faec6f465a227fcd735b654a26f3b617a757addb0d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.581991195678711 seconds. +- Overall skill 0.210443; relative MASE 0.932765; relative WQL 0.668336. +- term skill: long=0.2339, medium=0.2517, short=0.1848. +- domain skill: Econ/Fin=-0.1600, Energy=0.0730, Healthcare=-0.0312, Nature=0.3679, Sales=0.2919, Transport=0.3892, Web/CloudOps=0.2547. +- frequency skill: A=0.3078, D=0.2651, H=0.3157, M=-0.3962, Q=0.0682, S=-0.6697, T=0.2839, W=0.0983. +- variates skill: multivariate=0.2140, univariate=0.2076. +- Outcome: Improves the control by 0.2095 screening skill after about 34 seconds on one H100. Selected for first neural publication and full validation. + +## E1 step 1000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.206132; relative MASE 0.931220; relative WQL 0.676774. +- term skill: long=0.2265, medium=0.2444, short=0.1829. +- domain skill: Econ/Fin=-0.1543, Energy=0.0590, Healthcare=-0.0112, Nature=0.3688, Sales=0.3043, Transport=0.3878, Web/CloudOps=0.2461. +- frequency skill: A=0.2746, D=0.2676, H=0.3116, M=-0.3493, Q=0.0397, S=-0.6697, T=0.2712, W=0.1025. +- variates skill: multivariate=0.2097, univariate=0.2033. +- Outcome: Full 151,170-instance validation skill 0.2061, with no failed configurations. Package inference took 29.5 seconds while training shared the sole GPU. First neural publication verified. + +## E1 step 2000, screening +- Checkpoint SHA-256: `a513ac4f03aceb93a860d5e5eca70010c0101fdea794df4a9a8ae472647fb9c9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.98806357383728 seconds. +- Overall skill 0.249671; relative MASE 0.890745; relative WQL 0.632048. +- term skill: long=0.2727, medium=0.2872, short=0.2257. +- domain skill: Econ/Fin=-0.0533, Energy=0.1151, Healthcare=0.1665, Nature=0.4084, Sales=0.2984, Transport=0.3867, Web/CloudOps=0.2855. +- frequency skill: A=0.3280, D=0.2894, H=0.3291, M=-0.1483, Q=0.1703, S=-0.4627, T=0.3239, W=0.1185. +- variates skill: multivariate=0.2588, univariate=0.2423. +- Outcome: Improves screening skill to 0.2497 after 66.8 seconds of training; candidate for replacement. + +## E1 step 3000, screening +- Checkpoint SHA-256: `74da538d2365426496a12c965c0c0cdc1d3962a798bd2e2c5fed950c1f663f30`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.051600933074951 seconds. +- Overall skill 0.246085; relative MASE 0.894210; relative WQL 0.635631. +- term skill: long=0.2835, medium=0.2774, short=0.2187. +- domain skill: Econ/Fin=-0.1111, Energy=0.1198, Healthcare=-0.0532, Nature=0.3956, Sales=0.3188, Transport=0.4123, Web/CloudOps=0.3004. +- frequency skill: A=0.3478, D=0.2585, H=0.3298, M=-0.3174, Q=0.1517, S=-0.6889, T=0.3620, W=0.1126. +- variates skill: multivariate=0.2552, univariate=0.2388. +- Outcome: Slight regression to 0.2461 relative to step 2000. Negative checkpoint-selection result; not selected. + +## E2 fixed longer-history feature ablation, step 2000 seed 17 +- Checkpoint SHA-256: `25ac85db67c041c92870e2ea2e8b198bb768f5c5ed64f42b78d6ec207ffe3a18`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.066685438156128 seconds. +- Overall skill 0.249089; relative MASE 0.890661; relative WQL 0.633088. +- term skill: long=0.2741, medium=0.2855, short=0.2248. +- domain skill: Econ/Fin=-0.0532, Energy=0.1146, Healthcare=0.1651, Nature=0.4048, Sales=0.2986, Transport=0.3880, Web/CloudOps=0.2859. +- frequency skill: A=0.3273, D=0.2892, H=0.3291, M=-0.1495, Q=0.1705, S=-0.4627, T=0.3228, W=0.1166. +- variates skill: multivariate=0.2572, univariate=0.2426. +- Outcome: No training. Changed only history available to seasonal summaries from 4,096 to 16,384 points, with the encoder unchanged. Skill decreased 0.24967 to 0.24909. Rejected. Validation 10-second histories are shorter than one daily cycle, so additional history cannot supply that feature. + +## E1 step 4000, screening +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.961170196533203 seconds. +- Overall skill 0.266471; relative MASE 0.874789; relative WQL 0.615080. +- term skill: long=0.2537, medium=0.2846, short=0.2643. +- domain skill: Econ/Fin=-0.0360, Energy=0.1306, Healthcare=0.1810, Nature=0.3894, Sales=0.3301, Transport=0.4253, Web/CloudOps=0.3121. +- frequency skill: A=0.3647, D=0.2978, H=0.3375, M=-0.0981, Q=0.1458, S=-0.2890, T=0.3375, W=0.1196. +- variates skill: multivariate=0.2648, univariate=0.2678. +- Outcome: Best ungated checkpoint so far; improved short-horizon performance, with some long-horizon regression. + +## E1 step 6000, screening +- Checkpoint SHA-256: `f38cdb1b49938007c20bdfdfa7c4fc7d7aba6516192f388f37088891411eab7f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.802650451660156 seconds. +- Overall skill 0.258313; relative MASE 0.878300; relative WQL 0.626324. +- term skill: long=0.2951, medium=0.3035, short=0.2254. +- domain skill: Econ/Fin=-0.0599, Energy=0.1417, Healthcare=0.2750, Nature=0.3683, Sales=0.3181, Transport=0.4116, Web/CloudOps=0.2761. +- frequency skill: A=0.3490, D=0.2962, H=0.3475, M=-0.0679, Q=0.1442, S=-0.6390, T=0.3416, W=0.0785. +- variates skill: multivariate=0.2482, univariate=0.2662. +- Outcome: Overall regression relative to step 4000 despite improvement on medium and long horizons. Not selected by overall skill. + +## E3 seasonal confidence gate, step 4000 seed 17 +- Checkpoint SHA-256: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.475942373275757 seconds. +- Overall skill 0.301779; relative MASE 0.827721; relative WQL 0.588981. +- term skill: long=0.3338, medium=0.3656, short=0.2627. +- domain skill: Econ/Fin=-0.0087, Energy=0.1326, Healthcare=0.1954, Nature=0.3891, Sales=0.3285, Transport=0.4242, Web/CloudOps=0.4509. +- frequency skill: A=0.3647, D=0.2945, H=0.3455, M=-0.0632, Q=0.1395, S=0.3700, T=0.3389, W=0.1159. +- variates skill: multivariate=0.3379, univariate=0.2716. +- Outcome: No additional training. Fixed gate: weight=clip(1 - mean squared seasonal difference / (0.25 * context variance), 0, 0.98). Blend neural quantiles with a last-four-cycle seasonal mean and Gaussian intervals based on seasonal differences. Each instance uses only its own context; no optimized or adapted parameters. Skill increases 0.26647 to 0.30178; selected for full validation. + +## E3 step 4000 gate, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.296168; relative MASE 0.830141; relative WQL 0.596742. +- term skill: long=0.3262, medium=0.3621, short=0.2569. +- domain skill: Econ/Fin=-0.0444, Energy=0.1210, Healthcare=0.2106, Nature=0.3890, Sales=0.3389, Transport=0.4244, Web/CloudOps=0.4426. +- frequency skill: A=0.2806, D=0.2946, H=0.3404, M=-0.0364, Q=0.1048, S=0.3700, T=0.3291, W=0.1093. +- variates skill: multivariate=0.3332, univariate=0.2652. +- Outcome: Selected and published. Full validation skill 0.296168 versus 0.206132 for the initial neural package; no failures. Full inference took 39.8 seconds while sharing one GPU with training. This is validation skill, not a held-out reward claim. + +## E1 step 8000, seed 17, ungated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.500704050064087 seconds. +- Overall skill 0.276275; relative MASE 0.864160; relative WQL 0.606113. +- term skill: long=0.2954, medium=0.3094, short=0.2557. +- domain skill: Econ/Fin=-0.0085, Energy=0.1522, Healthcare=0.1826, Nature=0.3866, Sales=0.3192, Transport=0.4212, Web/CloudOps=0.3315. +- frequency skill: A=0.3679, D=0.3262, H=0.3533, M=-0.2016, Q=0.1316, S=-0.4192, T=0.3605, W=0.1103. +- variates skill: multivariate=0.2735, univariate=0.2785. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 8000, seed 17, gated screening +- Checkpoint SHA-256: `ebbae91cb50acf1b1436fcbcdce1637195dd6e5006580d3d8e94a4e102aed0ad`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.228765964508057 seconds. +- Overall skill 0.312772; relative MASE 0.813977; relative WQL 0.580216. +- term skill: long=0.3671, medium=0.3752, short=0.2645. +- domain skill: Econ/Fin=-0.0003, Energy=0.1512, Healthcare=0.1999, Nature=0.3863, Sales=0.3176, Transport=0.4184, Web/CloudOps=0.4791. +- frequency skill: A=0.3679, D=0.3227, H=0.3559, M=-0.1576, Q=0.1357, S=0.3651, T=0.3604, W=0.1062. +- variates skill: multivariate=0.3530, univariate=0.2790. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, ungated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 6.094600439071655 seconds. +- Overall skill 0.285838; relative MASE 0.855761; relative WQL 0.595993. +- term skill: long=0.2974, medium=0.3249, short=0.2658. +- domain skill: Econ/Fin=0.0083, Energy=0.1537, Healthcare=0.1904, Nature=0.3858, Sales=0.3164, Transport=0.4217, Web/CloudOps=0.3674. +- frequency skill: A=0.3494, D=0.3058, H=0.3594, M=-0.1439, Q=0.1128, S=-0.2516, T=0.3685, W=0.1234. +- variates skill: multivariate=0.2917, univariate=0.2812. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 10000, seed 17, gated screening +- Checkpoint SHA-256: `3845afb6035396030b9a5182037287db092814d68caa4c96a7c415eb1d3b3a0a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.704133749008179 seconds. +- Overall skill 0.317743; relative MASE 0.805746; relative WQL 0.577695. +- term skill: long=0.3656, medium=0.3815, short=0.2718. +- domain skill: Econ/Fin=0.0087, Energy=0.1540, Healthcare=0.2110, Nature=0.3855, Sales=0.3148, Transport=0.4194, Web/CloudOps=0.4916. +- frequency skill: A=0.3494, D=0.3033, H=0.3612, M=-0.1027, Q=0.1231, S=0.3756, T=0.3699, W=0.1199. +- variates skill: multivariate=0.3600, univariate=0.2821. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, ungated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 5.807793855667114 seconds. +- Overall skill 0.284471; relative MASE 0.856118; relative WQL 0.598027. +- term skill: long=0.2877, medium=0.3155, short=0.2710. +- domain skill: Econ/Fin=0.0294, Energy=0.1544, Healthcare=0.2252, Nature=0.3903, Sales=0.3151, Transport=0.4273, Web/CloudOps=0.3413. +- frequency skill: A=0.3430, D=0.3172, H=0.3585, M=-0.1807, Q=0.1231, S=-0.2708, T=0.3565, W=0.1685. +- variates skill: multivariate=0.2854, univariate=0.2837. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E1 step 12000, seed 17, gated screening +- Checkpoint SHA-256: `629130a69f89561219b286c1e805d89b8b4662fce0e4b75e731e8764d9066e98`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.750269889831543 seconds. +- Overall skill 0.315453; relative MASE 0.812477; relative WQL 0.576760. +- term skill: long=0.3585, medium=0.3794, short=0.2715. +- domain skill: Econ/Fin=0.0081, Energy=0.1534, Healthcare=0.2414, Nature=0.3899, Sales=0.3136, Transport=0.4251, Web/CloudOps=0.4722. +- frequency skill: A=0.3430, D=0.3141, H=0.3577, M=-0.1400, Q=0.1249, S=0.3722, T=0.3572, W=0.1641. +- variates skill: multivariate=0.3552, univariate=0.2820. +- Outcome: Included in final checkpoint selection; compare to weight-averaged result below. + +## E4 stochastic weight average, seed 17, gated screening +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.737564325332642 seconds. +- Overall skill 0.320612; relative MASE 0.803931; relative WQL 0.574139. +- term skill: long=0.3654, medium=0.3823, short=0.2769. +- domain skill: Econ/Fin=0.0210, Energy=0.1663, Healthcare=0.2341, Nature=0.3839, Sales=0.3192, Transport=0.4246, Web/CloudOps=0.4812. +- frequency skill: A=0.3645, D=0.3114, H=0.3584, M=-0.0937, Q=0.1411, S=0.3729, T=0.3725, W=0.1398. +- variates skill: multivariate=0.3557, univariate=0.2913. +- Outcome: Arithmetic weight average of steps 8000, 9000, 10000, 11000 and 12000. Total underlying training 349.9 seconds on one H100 for 12,000 steps / 1,536,000 windows. Averaging uses no validation labels or training updates. Screening skill 0.320612 exceeds the best individual checkpoint 0.317743; selected for full validation. + +## E3 confidence and quantile-width sweep +- Fixed global settings, selected only on validation; no model updates. Seed and checkpoint: E1 step 8000, seed 17. +- Measured CPU time: 10.7 seconds. The original threshold 0.25 and width multiplier 1.0 won; no tuned change was adopted. +- (variance threshold, width multiplier) (0.25, 1.0): skill 0.312772; term skills {'short': 0.2645319168347662, 'medium': 0.37524061562171485, 'long': 0.36711552655262625}. +- (variance threshold, width multiplier) (0.5, 1.0): skill 0.311338; term skills {'short': 0.26128183571880415, 'medium': 0.3766834137570718, 'long': 0.36686872500364487}. +- (variance threshold, width multiplier) (0.25, 0.75): skill 0.310114; term skills {'short': 0.26357949467631236, 'medium': 0.3710044838302994, 'long': 0.36223509497654094}. +- (variance threshold, width multiplier) (0.1, 1.0): skill 0.309380; term skills {'short': 0.2645827018541862, 'medium': 0.3687788042390393, 'long': 0.3590704635989247}. +- (variance threshold, width multiplier) (0.25, 1.25): skill 0.308716; term skills {'short': 0.25806263726485956, 'medium': 0.3732424245969126, 'long': 0.3664492202082874}. +- (variance threshold, width multiplier) (0.5, 0.75): skill 0.308480; term skills {'short': 0.2599791649373039, 'medium': 0.3724274186615034, 'long': 0.36196930941343286}. +- (variance threshold, width multiplier) (0.5, 1.25): skill 0.307830; term skills {'short': 0.25575126666422066, 'medium': 0.3747816871597687, 'long': 0.3663051398261168}. +- (variance threshold, width multiplier) (0.1, 0.75): skill 0.306923; term skills {'short': 0.26386190560263856, 'medium': 0.3650190620286501, 'long': 0.35398875275507513}. +- (variance threshold, width multiplier) (0.1, 1.25): skill 0.305043; term skills {'short': 0.2579337472130613, 'medium': 0.36611831669487493, 'long': 0.3583403545682865}. +- (variance threshold, width multiplier) (1.0, 1.0): skill 0.300332; term skills {'short': 0.24300377373135085, 'medium': 0.37515035650362993, 'long': 0.3625716315021771}. +- (variance threshold, width multiplier) (1.0, 0.75): skill 0.297470; term skills {'short': 0.24163138399697548, 'medium': 0.37101264403024414, 'long': 0.3577626408389879}. +- (variance threshold, width multiplier) (1.0, 1.25): skill 0.296900; term skills {'short': 0.23759298244372884, 'medium': 0.3732464838258517, 'long': 0.3619922948184182}. +- (variance threshold, width multiplier) (0.0, 1.0): skill 0.276275; term skills {'short': 0.25565045294773825, 'medium': 0.30935443355536374, 'long': 0.29541709470756516}. +- (variance threshold, width multiplier) (0.0, 0.75): skill 0.274035; term skills {'short': 0.2552205537396286, 'medium': 0.30589300644316675, 'long': 0.289930620063797}. +- (variance threshold, width multiplier) (0.0, 1.25): skill 0.271354; term skills {'short': 0.2486798921582145, 'medium': 0.30569315727356094, 'long': 0.29429049771287774}. + +## E5 capacity and exponential averaging +- Hypothesis: increased capacity reduces residual errors after direct-horizon training; exponential weight averaging reduces checkpoint noise. +- Changed factors: width 512, six encoder and four decoder layers, 37,002,816 parameters; 24,000-step schedule at 2e-4; seed 23. Same source sample, mixture, synthetic generator, batch 128 and horizon distribution as E1. Training-only EMA decay min(0.999, 1-1/(step+1)). +- Completed on the sole H100; raw and EMA snapshots were evaluated across all 97 configurations. No causal claim isolates size from seed/schedule changes. + +## E4 averaged small model, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.315325; relative MASE 0.806359; relative WQL 0.581354. +- term skill: long=0.3584, medium=0.3790, short=0.2715. +- domain skill: Econ/Fin=-0.0034, Energy=0.1557, Healthcare=0.2457, Nature=0.3833, Sales=0.3308, Transport=0.4241, Web/CloudOps=0.4729. +- frequency skill: A=0.2978, D=0.3142, H=0.3526, M=-0.0698, Q=0.1192, S=0.3729, T=0.3632, W=0.1318. +- variates skill: multivariate=0.3509, univariate=0.2856. +- Outcome: Full validation skill 0.315325, relative MASE 0.806359 and relative WQL 0.581354, all 97 configurations valid. Inference took 37.2 seconds while sharing one H100 with training. Selected over the step-4000 gated package. + +## E6 sign symmetry, averaged small model, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.13059401512146 seconds. +- Overall skill 0.328463; relative MASE 0.794174; relative WQL 0.567837. +- term skill: long=0.3740, medium=0.3863, short=0.2861. +- domain skill: Econ/Fin=0.0049, Energy=0.1627, Healthcare=0.2543, Nature=0.3978, Sales=0.3314, Transport=0.4439, Web/CloudOps=0.4889. +- frequency skill: A=0.2986, D=0.3191, H=0.3677, M=-0.0077, Q=0.1661, S=0.3711, T=0.3792, W=0.1244. +- variates skill: multivariate=0.3628, univariate=0.2998. +- Outcome: No additional training. Average the forecasts from x and negated x with quantile order reversed, then apply positivity and the same fixed seasonal gate. Screening skill rises 0.320612 to 0.328463. Hypothesis: sign symmetry reduces finite-sample neural bias. Selected for full validation. + +## E6 sign symmetry, averaged small model, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.323978; relative MASE 0.795773; relative WQL 0.574292. +- term skill: long=0.3666, medium=0.3832, short=0.2823. +- domain skill: Econ/Fin=-0.0072, Energy=0.1517, Healthcare=0.2646, Nature=0.3974, Sales=0.3433, Transport=0.4439, Web/CloudOps=0.4816. +- frequency skill: A=0.2459, D=0.3222, H=0.3623, M=0.0177, Q=0.1587, S=0.3711, T=0.3705, W=0.1158. +- variates skill: multivariate=0.3586, univariate=0.2951. +- Outcome: Full validation skill 0.323978 versus 0.315325 without sign symmetry. Relative MASE 0.795773, relative WQL 0.574292, zero failed configurations, 42.3 seconds of inference. Selected for atomic publication. + +## E7 coarse temporal resolution at inference, small averaged model +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.896855354309082 seconds. +- Overall skill 0.320862; relative MASE 0.803289; relative WQL 0.574174. +- term skill: long=0.3616, medium=0.3660, short=0.2861. +- domain skill: Econ/Fin=0.0049, Energy=0.1601, Healthcare=0.2543, Nature=0.4043, Sales=0.3314, Transport=0.4281, Web/CloudOps=0.4698. +- frequency skill: A=0.2986, D=0.3191, H=0.3444, M=-0.0077, Q=0.1661, S=0.3686, T=0.3804, W=0.1244. +- variates skill: multivariate=0.3567, univariate=0.2909. +- Outcome: Negative result: for horizons >=400, average the sign-symmetric prediction with a four-step-aggregated prediction from the same weights, then apply the unchanged seasonal gate. Screening skill falls from 0.328463 to 0.320862, so this is rejected. No training or fitted context parameters. + +## E8 median and predictable-series loss weighting +- Hypothesis: optimizing median error explicitly and weighting by context seasonal error aligns pretraining with MASE and quantile loss. +- Initial weights: E4 averaged small model, trained here from random initialization; no external pretrained assets. +- Changed factor: loss = mean over valid steps of 0.5 times mean pinball loss plus 0.25 times absolute median error, weighted per instance by clip(1/(0.25 + normalized context seasonal absolute difference), 0.25, 4). Weights are normalized across the batch. Training-only calculation; inference model unchanged. +- Seed 31, batch 256, 6,000 steps, AdamW 1e-4 with 400-step warmup and cosine decay, same source sample and synthetic generator. EMA as E5. +- Compute: 272.9 seconds elapsed on the sole H100, shared concurrently with E5. Underlying initial pretraining used 349.9 seconds. + +## E8 step 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `e7cb5c4b4f04ba1ca873bc725f5e4345874520a96cbd3f079e4f631fd3c46d50`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.978966474533081 seconds. +- Overall skill 0.331642; relative MASE 0.791898; relative WQL 0.564091. +- term skill: long=0.3735, medium=0.3891, short=0.2910. +- domain skill: Econ/Fin=-0.0197, Energy=0.1668, Healthcare=0.2894, Nature=0.4040, Sales=0.3301, Transport=0.4439, Web/CloudOps=0.4906. +- frequency skill: A=0.2646, D=0.3158, H=0.3714, M=0.0669, Q=0.1387, S=0.3726, T=0.3764, W=0.1424. +- variates skill: multivariate=0.3652, univariate=0.3036. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 1000, seed 31, symmetric screening +- Checkpoint SHA-256: `dab309aff5a3a28936391b84b3ebd9d5dfc208e53c1e1602e4f5c599e3004c33`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.16230034828186 seconds. +- Overall skill 0.332263; relative MASE 0.790121; relative WQL 0.564310. +- term skill: long=0.3745, medium=0.3873, short=0.2925. +- domain skill: Econ/Fin=0.0051, Energy=0.1638, Healthcare=0.2952, Nature=0.4011, Sales=0.3311, Transport=0.4450, Web/CloudOps=0.4919. +- frequency skill: A=0.3239, D=0.3220, H=0.3698, M=0.0488, Q=0.1636, S=0.3751, T=0.3783, W=0.1317. +- variates skill: multivariate=0.3653, univariate=0.3047. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `111cf52c0662c60aebb44355135a65675a09d898995deeb4dd2f8f2b66339a0f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.85259199142456 seconds. +- Overall skill 0.326318; relative MASE 0.796087; relative WQL 0.570097. +- term skill: long=0.3658, medium=0.3826, short=0.2873. +- domain skill: Econ/Fin=-0.0159, Energy=0.1477, Healthcare=0.3155, Nature=0.4038, Sales=0.3247, Transport=0.4419, Web/CloudOps=0.4862. +- frequency skill: A=0.2949, D=0.3163, H=0.3678, M=0.0654, Q=0.1519, S=0.3722, T=0.3655, W=0.1286. +- variates skill: multivariate=0.3573, univariate=0.3006. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 2000, seed 31, symmetric screening +- Checkpoint SHA-256: `5fa525d923b4af5949f2415cf0ad0b325dae7623f07aae06b3131bdbda08c209`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.634822130203247 seconds. +- Overall skill 0.332843; relative MASE 0.789360; relative WQL 0.563874. +- term skill: long=0.3745, medium=0.3875, short=0.2936. +- domain skill: Econ/Fin=0.0007, Energy=0.1627, Healthcare=0.3135, Nature=0.4026, Sales=0.3309, Transport=0.4452, Web/CloudOps=0.4913. +- frequency skill: A=0.3152, D=0.3249, H=0.3696, M=0.0640, Q=0.1700, S=0.3757, T=0.3784, W=0.1261. +- variates skill: multivariate=0.3645, univariate=0.3065. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `8ce9867a6005c28005b32d163254c088279f2a46febeadc433b403aeffc29066`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.403828620910645 seconds. +- Overall skill 0.333292; relative MASE 0.789778; relative WQL 0.562816. +- term skill: long=0.3723, medium=0.3857, short=0.2961. +- domain skill: Econ/Fin=-0.0157, Energy=0.1603, Healthcare=0.3279, Nature=0.4080, Sales=0.3286, Transport=0.4450, Web/CloudOps=0.4921. +- frequency skill: A=0.2821, D=0.3254, H=0.3697, M=0.0826, Q=0.1490, S=0.3718, T=0.3810, W=0.1182. +- variates skill: multivariate=0.3645, univariate=0.3073. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 4000, seed 31, symmetric screening +- Checkpoint SHA-256: `e61535b34efac923328f1dd464f5ab8ab05913438f86125d8b933f1b166281d9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.288180112838745 seconds. +- Overall skill 0.334221; relative MASE 0.787768; relative WQL 0.562681. +- term skill: long=0.3735, medium=0.3879, short=0.2964. +- domain skill: Econ/Fin=-0.0016, Energy=0.1638, Healthcare=0.3235, Nature=0.4037, Sales=0.3295, Transport=0.4477, Web/CloudOps=0.4916. +- frequency skill: A=0.3041, D=0.3326, H=0.3704, M=0.0629, Q=0.1674, S=0.3746, T=0.3813, W=0.1128. +- variates skill: multivariate=0.3653, univariate=0.3084. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 step 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `15833e7668d9cd11ed55a4820b4700d71c6f734415d11490c7e8beb654abfa12`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.2668559551239 seconds. +- Overall skill 0.334430; relative MASE 0.788174; relative WQL 0.562038. +- term skill: long=0.3762, medium=0.3886, short=0.2953. +- domain skill: Econ/Fin=-0.0108, Energy=0.1611, Healthcare=0.3518, Nature=0.4037, Sales=0.3298, Transport=0.4457, Web/CloudOps=0.4924. +- frequency skill: A=0.2760, D=0.3360, H=0.3690, M=0.0736, Q=0.1605, S=0.3759, T=0.3813, W=0.1132. +- variates skill: multivariate=0.3660, univariate=0.3081. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E8 ema 6000, seed 31, symmetric screening +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.340764284133911 seconds. +- Overall skill 0.335038; relative MASE 0.787307; relative WQL 0.561630. +- term skill: long=0.3762, medium=0.3878, short=0.2968. +- domain skill: Econ/Fin=-0.0053, Energy=0.1637, Healthcare=0.3401, Nature=0.4031, Sales=0.3292, Transport=0.4464, Web/CloudOps=0.4934. +- frequency skill: A=0.2894, D=0.3329, H=0.3693, M=0.0767, Q=0.1622, S=0.3763, T=0.3828, W=0.1162. +- variates skill: multivariate=0.3659, univariate=0.3094. +- Outcome: EMA at 6000 is best overall and selected for full validation; raw checkpoints show greater variance. + +## E9 neural context 512 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.416622161865234 seconds. +- Overall skill 0.320871; relative MASE 0.803968; relative WQL 0.573675. +- term skill: long=0.3740, medium=0.3863, short=0.2718. +- domain skill: Econ/Fin=0.0457, Energy=0.1466, Healthcare=0.2113, Nature=0.3887, Sales=0.3285, Transport=0.4330, Web/CloudOps=0.4911. +- frequency skill: A=0.2986, D=0.2904, H=0.3587, M=-0.0099, Q=0.1658, S=0.3756, T=0.3687, W=0.1716. +- variates skill: multivariate=0.3665, univariate=0.2822. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 1024 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.072535276412964 seconds. +- Overall skill 0.329251; relative MASE 0.796444; relative WQL 0.564891. +- term skill: long=0.3740, medium=0.3863, short=0.2876. +- domain skill: Econ/Fin=0.0323, Energy=0.1629, Healthcare=0.1832, Nature=0.3978, Sales=0.3361, Transport=0.4415, Web/CloudOps=0.4998. +- frequency skill: A=0.2986, D=0.3031, H=0.3649, M=-0.0077, Q=0.1661, S=0.3761, T=0.3907, W=0.1240. +- variates skill: multivariate=0.3738, univariate=0.2915. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E9 neural context 2048 for horizons <=128, seed 17 +- Checkpoint SHA-256: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.426023244857788 seconds. +- Overall skill 0.329063; relative MASE 0.794285; relative WQL 0.566744. +- term skill: long=0.3740, medium=0.3863, short=0.2872. +- domain skill: Econ/Fin=0.0227, Energy=0.1628, Healthcare=0.2235, Nature=0.3975, Sales=0.3314, Transport=0.4448, Web/CloudOps=0.4931. +- frequency skill: A=0.2986, D=0.3154, H=0.3656, M=-0.0077, Q=0.1661, S=0.3738, T=0.3847, W=0.1224. +- variates skill: multivariate=0.3651, univariate=0.2989. +- Outcome: Only the neural input is shortened; the seasonal confidence gate retains 4096 points. 512 loses skill; 1024/2048 improve by less than 0.001 over the control. Not adopted pending a larger effect. + +## E10 fixed 50/50 ensemble diagnostic +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 4.082070589065552 seconds. +- Overall skill 0.332712; relative MASE 0.791350; relative WQL 0.562676. +- term skill: long=0.3746, medium=0.3901, short=0.2921. +- domain skill: Econ/Fin=-0.0029, Energy=0.1641, Healthcare=0.3036, Nature=0.4055, Sales=0.3288, Transport=0.4500, Web/CloudOps=0.4870. +- frequency skill: A=0.2971, D=0.3243, H=0.3712, M=0.0353, Q=0.1843, S=0.3742, T=0.3778, W=0.1385. +- variates skill: multivariate=0.3658, univariate=0.3052. +- Outcome: Average of E8 EMA4000 and E5 EMA12000, both with sign symmetry and the same fixed seasonal gate. Skill 0.332712 is below E8 alone (0.334221). Rejected for now; both members would forecast every instance. + +## E8 EMA6000, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.330109; relative MASE 0.789610; relative WQL 0.568323. +- term skill: long=0.3687, medium=0.3851, short=0.2920. +- domain skill: Econ/Fin=-0.0223, Energy=0.1525, Healthcare=0.3475, Nature=0.4024, Sales=0.3415, Transport=0.4461, Web/CloudOps=0.4860. +- frequency skill: A=0.2370, D=0.3358, H=0.3639, M=0.0960, Q=0.1447, S=0.3763, T=0.3738, W=0.1061. +- variates skill: multivariate=0.3616, univariate=0.3039. +- Outcome: Full validation skill 0.330109, relative MASE 0.789610, relative WQL 0.568323, zero failed configurations. Inference took 48.1 seconds while sharing the one H100. Improves the previous published 0.323978 and is selected for atomic publication. + +## E11 matched corpus-coverage experiment +- Hypothesis: broader source coverage improves generalization after the initial model has plateaued. +- Expanded sample: 95 directories, 1,032,415 series, 5,653,290,832 points (22.613 GB), versus 357,789 series and 958,745,103 points (3.835 GB). Per-source cap rises from 24M to 192M points, Arrow record batches are shuffled within each selected shard, and the per-series crop cap rises from 131,072 to 1,048,576. The same deterministic directory-hash seeds and at most eight sampled shards per directory are used. +- Two matched continuations start from E8 EMA6000: original sample control and expanded sample. Both use seed 41, batch 256, the E8 loss, 6,000 steps, AdamW 1e-4 and the same schedule/EMA. Training uses only corpus/synthetic data. +- Runs share the single H100 with E5; CPU threads are limited to three per new trainer. Completed matched runs: control 363.4 s, expanded 364.8 s; the expanded corpus did not improve either matched checkpoint. Detailed results are below. + +## E12 fixed continuity correction +- Hypothesis: a direct-horizon head can miss the immediate level of a smooth history, and a small decaying correction should reduce short-horizon error. No training or context fitting. E8 EMA6000 weights, seed 31. +- Fixed formula: ratio=mean(square(first differences))/variance over the last 512 points; w=clip(1-ratio/0.5,0,0.95); bias=w*(last value + median of the last eight differences - first forecast median). Add bias*exp(-step/tau) to each quantile, then retain the existing positivity rule. Skip sparse missing-value differences. +- Initial diagnostic needed a missing-value guard; invalid intermediate scores were discarded. A positivity-lookback mismatch in the probe was also corrected so tau=0 exactly reproduces the control. +- CPU sweep took 6.0 seconds; final verified control and all candidate scores follow. Tau 24 selected for package/full validation. +- tau=0: skill 0.335038, relative MASE 0.787307, relative WQL 0.561630, group skills {'term': {'short': 0.2967927346774093, 'medium': 0.38776799350809343, 'long': 0.37616349665047677}, 'domain': {'Econ/Fin': -0.005273788909573085, 'Energy': 0.16374587322817125, 'Healthcare': 0.34007707190705616, 'Nature': 0.4030815329292825, 'Sales': 0.32924485226314826, 'Transport': 0.4464324047455728, 'Web/CloudOps': 0.4934311796492926}, 'freq': {'A-DEC': 0.2893784388532201, 'Q-DEC': 0.16218093798601307, 'M': 0.07665328507242941, 'W-SUN': -0.31450314757766273, 'D': 0.332876404786148, 'H': 0.3693479345200832, '15T': 0.14228566862247327, 'W-FRI': 0.032405497411887585, '10T': 0.4887742379514316, 'W-TUE': 0.309664207244038, 'W-THU': 0.14794979612329628, 'W-WED': 0.29198895648742507, '5T': 0.5120305409377247, '10S': 0.3762720731817548}}. +- tau=2: skill 0.337508, relative MASE 0.783332, relative WQL 0.560293, group skills {'term': {'short': 0.30112159439110886, 'medium': 0.3882128168958763, 'long': 0.3763449044348186}, 'domain': {'Econ/Fin': 0.012010642573481944, 'Energy': 0.1687336419481582, 'Healthcare': 0.33847751009406857, 'Nature': 0.4038059435050727, 'Sales': 0.32920024652725177, 'Transport': 0.4463400575252827, 'Web/CloudOps': 0.4950030531002031}, 'freq': {'A-DEC': 0.2973561434987757, 'Q-DEC': 0.17698071591831765, 'M': 0.07233297868059718, 'W-SUN': -0.2582996069171355, 'D': 0.3346112879714367, 'H': 0.36855118351366944, '15T': 0.14569114456054433, 'W-FRI': 0.021432593572035197, '10T': 0.5064176027092252, 'W-TUE': 0.3132256284193611, 'W-THU': 0.1516542652623164, 'W-WED': 0.29198895648742507, '5T': 0.5121886153783087, '10S': 0.38181456512243606}}. +- tau=8: skill 0.339730, relative MASE 0.781190, relative WQL 0.558067, group skills {'term': {'short': 0.30468677533784194, 'medium': 0.3890128603479147, 'long': 0.3768542253336602}, 'domain': {'Econ/Fin': 0.04357586882889164, 'Energy': 0.17060177779549268, 'Healthcare': 0.3292576172809155, 'Nature': 0.4040895491577191, 'Sales': 0.32915095007230155, 'Transport': 0.4455718893158739, 'Web/CloudOps': 0.498582535356759}, 'freq': {'A-DEC': 0.30427943534005153, 'Q-DEC': 0.18739632573970566, 'M': 0.05811644843967234, 'W-SUN': -0.14993519310493708, 'D': 0.33691177813304396, 'H': 0.36800946318922256, '15T': 0.15562275067857723, 'W-FRI': 0.015293948848938421, '10T': 0.5022238811405833, 'W-TUE': 0.308852394109824, 'W-THU': 0.16531962754891327, 'W-WED': 0.29198895648742507, '5T': 0.5124270255950129, '10S': 0.3959332124123227}}. +- tau=24: skill 0.341604, relative MASE 0.780976, relative WQL 0.555056, group skills {'term': {'short': 0.30735425505077896, 'medium': 0.38984232067302926, 'long': 0.37791322023985785}, 'domain': {'Econ/Fin': 0.07789629542475163, 'Energy': 0.16814859423491146, 'Healthcare': 0.32219860777640197, 'Nature': 0.4027938268275436, 'Sales': 0.32911299366848257, 'Transport': 0.4440214473788372, 'Web/CloudOps': 0.505502554697025}, 'freq': {'A-DEC': 0.30701454754159097, 'Q-DEC': 0.18894276751813088, 'M': 0.04173508991923269, 'W-SUN': -0.06710914169849702, 'D': 0.33891978173454174, 'H': 0.36806701600948255, '15T': 0.16691265843751302, 'W-FRI': 0.011149977535114819, '10T': 0.48062823437029445, 'W-TUE': 0.3054618645258299, 'W-THU': 0.17135723270801106, 'W-WED': 0.29198895648742507, '5T': 0.5128629288387704, '10S': 0.42606586812368186}}. +- tau=64: skill 0.340824, relative MASE 0.783313, relative WQL 0.554713, group skills {'term': {'short': 0.3064164746371565, 'medium': 0.38779908004530583, 'long': 0.3787937309532532}, 'domain': {'Econ/Fin': 0.09969949435020342, 'Energy': 0.15974598777640392, 'Healthcare': 0.3189527251466179, 'Nature': 0.4009254556920715, 'Sales': 0.32909545704191134, 'Transport': 0.44166143132149305, 'Web/CloudOps': 0.5103628293774518}, 'freq': {'A-DEC': 0.3079352359976604, 'Q-DEC': 0.18879190434187287, 'M': 0.03049481695615497, 'W-SUN': -0.03231570437562303, 'D': 0.33992332397958547, 'H': 0.36593420410508737, '15T': 0.1654947222236236, 'W-FRI': 0.009213828856730832, '10T': 0.46016772262416383, 'W-TUE': 0.3040006089982843, 'W-THU': 0.17343046632698478, 'W-WED': 0.29198895648742507, '5T': 0.5128850832828526, '10S': 0.4486615108502494}}. +- tau=128: skill 0.338292, relative MASE 0.786639, relative WQL 0.556618, group skills {'term': {'short': 0.3043668884529205, 'medium': 0.38176748757743373, 'long': 0.37868472074438897}, 'domain': {'Econ/Fin': 0.10637792737302931, 'Energy': 0.1531270206619928, 'Healthcare': 0.31816668045459984, 'Nature': 0.39985518410953147, 'Sales': 0.3290895550941987, 'Transport': 0.4399018505526925, 'Web/CloudOps': 0.5082609219137205}, 'freq': {'A-DEC': 0.3082114553822066, 'Q-DEC': 0.1886335736447592, 'M': 0.026327746733658897, 'W-SUN': -0.021307580325764297, 'D': 0.34025742210101806, 'H': 0.3625439077766571, '15T': 0.1628300810039216, 'W-FRI': 0.00856370190545519, '10T': 0.4513327819863723, 'W-TUE': 0.30351149262807786, 'W-THU': 0.1740816133131421, 'W-WED': 0.29198895648742507, '5T': 0.512369368619311, '10S': 0.44352723463256316}}. + +## E12 continuity prior, full validation +- Checkpoint SHA-256: `see model_manifest.json`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.336914; relative MASE 0.783869; relative WQL 0.560914. +- term skill: long=0.3705, medium=0.3876, short=0.3028. +- domain skill: Econ/Fin=0.0580, Energy=0.1590, Healthcare=0.3286, Nature=0.4018, Sales=0.3415, Transport=0.4438, Web/CloudOps=0.4980. +- frequency skill: A=0.2499, D=0.3408, H=0.3619, M=0.0606, Q=0.1682, S=0.4261, T=0.3809, W=0.1368. +- variates skill: multivariate=0.3731, univariate=0.3066. +- Outcome: Full validation skill 0.336914 versus 0.330109 without the correction, relative MASE 0.783869 and relative WQL 0.560914; zero failures. Package inference took 69.8 seconds while three trainers shared the sole H100. Selected for atomic publication. + +## E11 corpus_control_ema1000 +- Checkpoint SHA-256: `f81bf26e2a17265332fdb3b29204d140703d7c3e9d9abdd7e3297715a7b1153a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.393452167510986 seconds. +- Overall skill 0.335216; relative MASE 0.787169; relative WQL 0.561427. +- term skill: long=0.3757, medium=0.3878, short=0.2973. +- domain skill: Econ/Fin=-0.0001, Energy=0.1627, Healthcare=0.3427, Nature=0.4053, Sales=0.3297, Transport=0.4460, Web/CloudOps=0.4926. +- frequency skill: A=0.3085, D=0.3314, H=0.3702, M=0.0765, Q=0.1659, S=0.3764, T=0.3820, W=0.1191. +- variates skill: multivariate=0.3656, univariate=0.3100. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_control_ema3000 +- Checkpoint SHA-256: `c72daec0504f6082965d689dd9a9f1a7005ac0d9694fb8d4de3d2622db9d615b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.011096715927124 seconds. +- Overall skill 0.334832; relative MASE 0.787218; relative WQL 0.562040. +- term skill: long=0.3765, medium=0.3877, short=0.2963. +- domain skill: Econ/Fin=0.0014, Energy=0.1632, Healthcare=0.3213, Nature=0.4049, Sales=0.3317, Transport=0.4468, Web/CloudOps=0.4939. +- frequency skill: A=0.2922, D=0.3214, H=0.3695, M=0.0723, Q=0.1640, S=0.3781, T=0.3850, W=0.1283. +- variates skill: multivariate=0.3670, univariate=0.3081. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_control_ema6000 +- Checkpoint SHA-256: `fa23c895ff4926b3d0df6d15267718a1dda41ad9386abbfef1306becb262da1c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.355180501937866 seconds. +- Overall skill 0.334809; relative MASE 0.788444; relative WQL 0.561205. +- term skill: long=0.3770, medium=0.3879, short=0.2960. +- domain skill: Econ/Fin=-0.0139, Energy=0.1615, Healthcare=0.3361, Nature=0.4053, Sales=0.3305, Transport=0.4466, Web/CloudOps=0.4951. +- frequency skill: A=0.2945, D=0.3215, H=0.3707, M=0.0639, Q=0.1501, S=0.3778, T=0.3855, W=0.1254. +- variates skill: multivariate=0.3680, univariate=0.3071. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema1000 +- Checkpoint SHA-256: `8c0f66d7a2377fa37b4d3358c89ae9b5786a6f5f0223b1480fb7a0b20b17ebc8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.571230411529541 seconds. +- Overall skill 0.333782; relative MASE 0.789135; relative WQL 0.562448. +- term skill: long=0.3749, medium=0.3867, short=0.2955. +- domain skill: Econ/Fin=-0.0143, Energy=0.1614, Healthcare=0.3302, Nature=0.4029, Sales=0.3292, Transport=0.4472, Web/CloudOps=0.4938. +- frequency skill: A=0.2932, D=0.3308, H=0.3695, M=0.0696, Q=0.1628, S=0.3754, T=0.3818, W=0.1103. +- variates skill: multivariate=0.3653, univariate=0.3075. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema3000 +- Checkpoint SHA-256: `51586b5ce1a426dc2f3adf42aba9599b731b62ab316159dafe681e77317015a2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.598361253738403 seconds. +- Overall skill 0.333836; relative MASE 0.789352; relative WQL 0.562201. +- term skill: long=0.3750, medium=0.3869, short=0.2954. +- domain skill: Econ/Fin=-0.0087, Energy=0.1631, Healthcare=0.3250, Nature=0.4036, Sales=0.3303, Transport=0.4468, Web/CloudOps=0.4922. +- frequency skill: A=0.3132, D=0.3259, H=0.3690, M=0.0696, Q=0.1693, S=0.3752, T=0.3829, W=0.1162. +- variates skill: multivariate=0.3659, univariate=0.3071. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E11 corpus_expanded_ema6000 +- Checkpoint SHA-256: `b82b9da6afa6b7ec864a5c4f9829a2a68b29f0923d0c556a998b9d79623d9ba9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.799206972122192 seconds. +- Overall skill 0.333432; relative MASE 0.790380; relative WQL 0.562151. +- term skill: long=0.3759, medium=0.3881, short=0.2938. +- domain skill: Econ/Fin=-0.0272, Energy=0.1621, Healthcare=0.3299, Nature=0.4047, Sales=0.3298, Transport=0.4459, Web/CloudOps=0.4936. +- frequency skill: A=0.3024, D=0.3227, H=0.3691, M=0.0639, Q=0.1574, S=0.3794, T=0.3834, W=0.1166. +- variates skill: multivariate=0.3662, univariate=0.3061. +- Outcome: Matched comparison: original sample control stays near the parent model; expanded corpus is consistently slightly worse. Neither continuation is selected. Compute: control 363.4 s, expanded 364.8 s elapsed while sharing one H100. + +## E5 direct_large_ema12000_gate +- Checkpoint SHA-256: `202e23ba9d7560bf2bd67a609d024449facabdfd338c9268bc013ff6b613168f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.02167820930481 seconds. +- Overall skill 0.314336; relative MASE 0.813757; relative WQL 0.577734. +- term skill: long=0.3670, medium=0.3868, short=0.2623. +- domain skill: Econ/Fin=-0.0160, Energy=0.1404, Healthcare=0.2477, Nature=0.3897, Sales=0.3170, Transport=0.4355, Web/CloudOps=0.4760. +- frequency skill: A=0.3627, D=0.3141, H=0.3649, M=-0.1520, Q=0.1593, S=0.3730, T=0.3518, W=0.1342. +- variates skill: multivariate=0.3564, univariate=0.2788. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema16000_gate +- Checkpoint SHA-256: `8ba1220059af5a85180b3ad740402a48b2d38172598510da796339378e529a73`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.176010131835938 seconds. +- Overall skill 0.322612; relative MASE 0.806599; relative WQL 0.568877. +- term skill: long=0.3668, medium=0.3875, short=0.2777. +- domain skill: Econ/Fin=0.0042, Energy=0.1444, Healthcare=0.3056, Nature=0.3937, Sales=0.3266, Transport=0.4361, Web/CloudOps=0.4847. +- frequency skill: A=0.3573, D=0.3049, H=0.3646, M=-0.0462, Q=0.1603, S=0.3803, T=0.3607, W=0.1797. +- variates skill: multivariate=0.3644, univariate=0.2874. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema20000_gate +- Checkpoint SHA-256: `1ec9d54fa1270442b0023da3f7fc23f5fa5291e58210a55f63878983afccc606`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.57221269607544 seconds. +- Overall skill 0.324943; relative MASE 0.805088; relative WQL 0.566028. +- term skill: long=0.3666, medium=0.3878, short=0.2821. +- domain skill: Econ/Fin=0.0218, Energy=0.1439, Healthcare=0.2912, Nature=0.4039, Sales=0.3250, Transport=0.4352, Web/CloudOps=0.4880. +- frequency skill: A=0.3533, D=0.3058, H=0.3660, M=-0.0485, Q=0.1544, S=0.3756, T=0.3665, W=0.1840. +- variates skill: multivariate=0.3678, univariate=0.2887. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema2000_gate +- Checkpoint SHA-256: `bea7fbebdc754a6cef068a4b835e644d896305e928b4a63974c731874dc49028`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.918560028076172 seconds. +- Overall skill 0.279056; relative MASE 0.848285; relative WQL 0.612718. +- term skill: long=0.3485, medium=0.3540, short=0.2185. +- domain skill: Econ/Fin=-0.0871, Energy=0.1232, Healthcare=0.1986, Nature=0.3855, Sales=0.3094, Transport=0.3731, Web/CloudOps=0.4269. +- frequency skill: A=0.3054, D=0.2729, H=0.3360, M=-0.1424, Q=0.1034, S=0.3706, T=0.2968, W=0.1303. +- variates skill: multivariate=0.3283, univariate=0.2373. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema24000_gate +- Checkpoint SHA-256: `e5bb7f70c0adbf61b4292cfc40a419e6757854a255ef0c47d3d47c7f2d68b7a2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.641167879104614 seconds. +- Overall skill 0.323234; relative MASE 0.806197; relative WQL 0.568114. +- term skill: long=0.3665, medium=0.3864, short=0.2795. +- domain skill: Econ/Fin=0.0385, Energy=0.1492, Healthcare=0.2588, Nature=0.4037, Sales=0.3217, Transport=0.4347, Web/CloudOps=0.4807. +- frequency skill: A=0.3645, D=0.3062, H=0.3653, M=-0.0563, Q=0.1548, S=0.3766, T=0.3656, W=0.1664. +- variates skill: multivariate=0.3653, univariate=0.2877. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema4000_gate +- Checkpoint SHA-256: `2f45a9ce8bed8e0e3ebe37ba98ac36ab8b9a630a615856760f46c0763fa78b5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.853939056396484 seconds. +- Overall skill 0.296679; relative MASE 0.830007; relative WQL 0.595971. +- term skill: long=0.3569, medium=0.3692, short=0.2413. +- domain skill: Econ/Fin=-0.0411, Energy=0.1331, Healthcare=0.1511, Nature=0.3889, Sales=0.3253, Transport=0.4031, Web/CloudOps=0.4590. +- frequency skill: A=0.3534, D=0.2760, H=0.3509, M=-0.1255, Q=0.1495, S=0.3734, T=0.3314, W=0.1185. +- variates skill: multivariate=0.3480, univariate=0.2530. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_ema8000_gate +- Checkpoint SHA-256: `1b15662821b8c7a20d973f548dacabd237f470ffd1c75457c0b92011d3f0cc88`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.06697702407837 seconds. +- Overall skill 0.310188; relative MASE 0.816631; relative WQL 0.582688. +- term skill: long=0.3619, medium=0.3788, short=0.2604. +- domain skill: Econ/Fin=-0.0143, Energy=0.1404, Healthcare=0.2015, Nature=0.3934, Sales=0.3255, Transport=0.4210, Web/CloudOps=0.4744. +- frequency skill: A=0.3680, D=0.2929, H=0.3581, M=-0.0609, Q=0.1607, S=0.3679, T=0.3513, W=0.1178. +- variates skill: multivariate=0.3533, univariate=0.2739. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step12000_gate +- Checkpoint SHA-256: `8788d76e331dcd9cca1d6dab37db34b4c8b1257fc83da49b532c11643cd0ebfa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.492464065551758 seconds. +- Overall skill 0.304901; relative MASE 0.821804; relative WQL 0.587930. +- term skill: long=0.3555, medium=0.3694, short=0.2575. +- domain skill: Econ/Fin=-0.0110, Energy=0.1063, Healthcare=0.2456, Nature=0.3830, Sales=0.2991, Transport=0.4416, Web/CloudOps=0.4763. +- frequency skill: A=0.3131, D=0.3025, H=0.3517, M=-0.0499, Q=0.1271, S=0.3821, T=0.3324, W=0.1350. +- variates skill: multivariate=0.3451, univariate=0.2712. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step16000_gate +- Checkpoint SHA-256: `beb43e784be8db8ee5ec14e83fa9c68f7ce897790441453eb6d72cceedb80650`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.434912919998169 seconds. +- Overall skill 0.311197; relative MASE 0.820659; relative WQL 0.578132. +- term skill: long=0.3577, medium=0.3731, short=0.2667. +- domain skill: Econ/Fin=-0.0270, Energy=0.1289, Healthcare=0.2653, Nature=0.3904, Sales=0.3264, Transport=0.4341, Web/CloudOps=0.4732. +- frequency skill: A=0.3445, D=0.2986, H=0.3593, M=-0.0768, Q=0.1596, S=0.3715, T=0.3463, W=0.1472. +- variates skill: multivariate=0.3513, univariate=0.2775. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step20000_gate +- Checkpoint SHA-256: `9332e5088244bd4a2a1ad5b6470a108ebaa6bc387a525202f6bf954d9796b1a6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.937657117843628 seconds. +- Overall skill 0.319529; relative MASE 0.811224; relative WQL 0.570793. +- term skill: long=0.3661, medium=0.3842, short=0.2737. +- domain skill: Econ/Fin=0.0113, Energy=0.1395, Healthcare=0.3332, Nature=0.3983, Sales=0.3058, Transport=0.4236, Web/CloudOps=0.4804. +- frequency skill: A=0.3483, D=0.3114, H=0.3599, M=-0.0666, Q=0.1435, S=0.3671, T=0.3551, W=0.1967. +- variates skill: multivariate=0.3633, univariate=0.2825. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step2000_gate +- Checkpoint SHA-256: `f16c3270e2d4adafc8dbc1416687932a81b040bed29ad21887f7f8953437ba86`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.376563549041748 seconds. +- Overall skill 0.284757; relative MASE 0.840864; relative WQL 0.608389. +- term skill: long=0.3356, medium=0.3611, short=0.2319. +- domain skill: Econ/Fin=-0.0840, Energy=0.1152, Healthcare=0.2242, Nature=0.3840, Sales=0.3264, Transport=0.3898, Web/CloudOps=0.4386. +- frequency skill: A=0.2579, D=0.2746, H=0.3418, M=-0.0497, Q=0.1253, S=0.3787, T=0.2935, W=0.1458. +- variates skill: multivariate=0.3309, univariate=0.2458. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step24000_gate +- Checkpoint SHA-256: `b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 7.831688165664673 seconds. +- Overall skill 0.326279; relative MASE 0.802486; relative WQL 0.565617. +- term skill: long=0.3671, medium=0.3874, short=0.2845. +- domain skill: Econ/Fin=0.0453, Energy=0.1487, Healthcare=0.3262, Nature=0.4087, Sales=0.3234, Transport=0.4251, Web/CloudOps=0.4821. +- frequency skill: A=0.3544, D=0.3106, H=0.3612, M=-0.0014, Q=0.1548, S=0.3765, T=0.3668, W=0.1910. +- variates skill: multivariate=0.3662, univariate=0.2927. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step4000_gate +- Checkpoint SHA-256: `a085c48b8bac06dba51118942d58b632dfc8fd934455232b2f1f7c7329f1ae76`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.682147979736328 seconds. +- Overall skill 0.291006; relative MASE 0.830831; relative WQL 0.605023. +- term skill: long=0.3451, medium=0.3504, short=0.2444. +- domain skill: Econ/Fin=-0.0403, Energy=0.0877, Healthcare=0.2367, Nature=0.3707, Sales=0.3185, Transport=0.4275, Web/CloudOps=0.4638. +- frequency skill: A=0.2862, D=0.2949, H=0.3327, M=-0.1134, Q=0.1567, S=0.3705, T=0.3243, W=0.1248. +- variates skill: multivariate=0.3352, univariate=0.2538. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E5 direct_large_step8000_gate +- Checkpoint SHA-256: `7c0ca8d6f3023ecefc12818560b9bac64e044102cb27d478978c48ce82276c38`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 8.785595417022705 seconds. +- Overall skill 0.307945; relative MASE 0.812528; relative WQL 0.589444. +- term skill: long=0.3650, medium=0.3688, short=0.2592. +- domain skill: Econ/Fin=-0.0843, Energy=0.1539, Healthcare=0.1762, Nature=0.3845, Sales=0.3220, Transport=0.4223, Web/CloudOps=0.4730. +- frequency skill: A=0.3235, D=0.2684, H=0.3578, M=-0.0688, Q=0.1156, S=0.3591, T=0.3615, W=0.1148. +- variates skill: multivariate=0.3471, univariate=0.2751. +- Outcome: 37M capacity run from random initialization; seed 23. Final run: 24,000 steps / 3,072,000 windows in 1073.9 s elapsed on the sole H100, shared with other experiments. Most checkpoints lag the small model; EMA reduces checkpoint variance. Final raw checkpoint is stronger than final EMA in gated inference, so it will receive a full inference-rule comparison. + +## E13/E14 matched large-model continuations +- Parent: raw E5 step 24000 (random-init pretraining here, seed 23), selected after final gated and sign-symmetric/continuity comparisons. +- Three runs share seed 43, batch 256, 6,000 steps, AdamW 8e-5 with 400-step warmup/cosine decay, the original packed sample, and the E8 median/seasonal-error-weighted objective. All use EMA. GPU: the one H100; three CPU threads per trainer. +- large_loss: unchanged synthetic generator, control for applying E8 loss to the larger model. +- large_synth: replace half of the 20% synthetic windows with newly generated integrated colored innovations, stochastic local-linear trends with level shifts, or sharp periodic pulses with slowly drifting amplitude. Generator is in large_synth/data.py; no external synthetic assets. +- large_sign: independently negate each sampled context and target with probability 0.5. Context seasonal scales are sign-invariant. Data RNG is shared with augmentation, so later draws diverge from the control despite the matched seed; this is a single-seed comparison. +- All inference rules remain fixed (sign symmetry, seasonal confidence gate and 24-step continuity). Results pending. + +## E15 final-checkpoint ensemble +- Hypothesis: the differently trained small and large models have complementary median and distribution errors. Fixed equal weights, both members forecast every instance. E8 EMA6000 (seed31 continuation of seed17) plus E5 raw24000 (seed23). Same fixed inference rules applied separately before averaging. +- Cached prediction diagnostic skill 0.344733 exceeds the small model 0.341604 and large model 0.343219. Actual bundled inference and full validation are required before publication. + +## E15 actual bundled ensemble screening +- Checkpoint SHA-256: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.611496925354004 seconds. +- Overall skill 0.344715; relative MASE 0.780210; relative WQL 0.550363. +- term skill: long=0.3780, medium=0.3928, short=0.3118. +- domain skill: Econ/Fin=0.0849, Energy=0.1725, Healthcare=0.3305, Nature=0.4119, Sales=0.3307, Transport=0.4448, Web/CloudOps=0.5036. +- frequency skill: A=0.2873, D=0.3348, H=0.3699, M=0.0563, Q=0.1938, S=0.4258, T=0.3912, W=0.1713. +- variates skill: multivariate=0.3825, univariate=0.3130. +- Outcome: Actual package inference skill 0.344715, within 0.000019 of cached averaging; zero failures. The difference comes from numerical batching. Full package inference remains required. + +## E15 bundled ensemble, full validation +- Checkpoint SHA-256: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.340239; relative MASE 0.782773; relative WQL 0.556081. +- term skill: long=0.3706, medium=0.3906, short=0.3076. +- domain skill: Econ/Fin=0.0668, Energy=0.1633, Healthcare=0.3369, Nature=0.4112, Sales=0.3436, Transport=0.4446, Web/CloudOps=0.4963. +- frequency skill: A=0.2315, D=0.3371, H=0.3638, M=0.0773, Q=0.1704, S=0.4258, T=0.3837, W=0.1660. +- variates skill: multivariate=0.3783, univariate=0.3083. +- Outcome: Full skill 0.340239, relative MASE 0.782773, relative WQL 0.556081, zero failed configurations. Improves the previous published 0.336914. Relocated package inference took 119.3 seconds while three 37M trainers shared the sole H100. Repeated example calls were bitwise identical, finite and monotone. Selected for atomic publication. + +## E16 earlier-window diagnostic +- Hypothesis: a second cutoff reveals whether gains on single-series configurations are stable over time. +- Constructed the immediately preceding nonoverlapping window from each selected validation context (never used for training). All 97 configurations remain; short histories with fewer than H+8 points are omitted. Seasonal-error scales use the available capped prefix and Seasonal Naive is recomputed on that same input, so these are diagnostic scores on a separate scale. +- The small E8 EMA6000 model improves from 0.308552 without continuity to 0.314127 with it. The large parent scores 0.312321; the first sign-augmented checkpoint scores 0.312240. Thus continuity is supported at both cutoffs, while the first sign-augmentation gain does not yet repeat on the earlier cutoff. No weights or rules are adapted on the diagnostic contexts. + +## Full-validation checkpoint identity audit +- valid-report-1000.json: `ebdd9eaa223c2bb6e38b8faec6f465a227fcd735b654a26f3b617a757addb0d3`, skill 0.206132. +- valid-report-4000-gate.json: `f1b4e5f798688a56a693daf799fa21e69ec21c9c1710cae8dafbdb833c9ee069`, skill 0.296168. +- valid-report-swa-gate.json: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`, skill 0.315325. +- valid-report-symmetric.json: `a346a09ba0b8d196b58acc22a76f7944109b2bba04ea2b7cf7566de24aa2d8db`, skill 0.323978. +- valid-report-objective.json: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`, skill 0.330109. +- valid-report-continuity.json: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`, skill 0.336914. +- valid-report-ensemble.json: `91cb9b3fc2422fc376ecab7813213a7156b6baee963da620f06e82f1aaeaea39`, skill 0.340239. + +## E13/E14 large_loss_ema1000_continuity +- Checkpoint SHA-256: `872c92ee27b0d63f310b7be7434ffe3d5342b19a42d48fefd0a468b87501b28e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.880280256271362 seconds. +- Overall skill 0.342546; relative MASE 0.782779; relative WQL 0.552194. +- term skill: long=0.3792, medium=0.3907, short=0.3082. +- domain skill: Econ/Fin=0.0879, Energy=0.1741, Healthcare=0.2781, Nature=0.4155, Sales=0.3277, Transport=0.4454, Web/CloudOps=0.5007. +- frequency skill: A=0.2788, D=0.3141, H=0.3715, M=0.0511, Q=0.1869, S=0.4248, T=0.3925, W=0.1774. +- variates skill: multivariate=0.3827, univariate=0.3087. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_loss_ema3000_continuity +- Checkpoint SHA-256: `18c2788192e4028dd45255512b1c4bcddf12a50eb813e34fa0987b8949d75f15`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.631194829940796 seconds. +- Overall skill 0.345993; relative MASE 0.778768; relative WQL 0.549233. +- term skill: long=0.3793, medium=0.3902, short=0.3147. +- domain skill: Econ/Fin=0.0850, Energy=0.1714, Healthcare=0.3423, Nature=0.4181, Sales=0.3281, Transport=0.4479, Web/CloudOps=0.5015. +- frequency skill: A=0.2956, D=0.3232, H=0.3727, M=0.0705, Q=0.1917, S=0.4274, T=0.3904, W=0.1972. +- variates skill: multivariate=0.3829, univariate=0.3150. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_loss_ema6000_continuity +- Checkpoint SHA-256: `f5c7327b365832e8bd2d1b7b01e61c334f5bf620f5cae5f4d45feef2041090e8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.797317266464233 seconds. +- Overall skill 0.346864; relative MASE 0.778052; relative WQL 0.548275. +- term skill: long=0.3803, medium=0.3907, short=0.3157. +- domain skill: Econ/Fin=0.0848, Energy=0.1765, Healthcare=0.3460, Nature=0.4171, Sales=0.3275, Transport=0.4491, Web/CloudOps=0.4990. +- frequency skill: A=0.2988, D=0.3201, H=0.3724, M=0.0715, Q=0.1909, S=0.4236, T=0.3942, W=0.2029. +- variates skill: multivariate=0.3831, univariate=0.3165. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema1000_continuity +- Checkpoint SHA-256: `393950048f9d0487869b7aa5e6bd01e7ea1715dba16b1367ee8be353eac7f408`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.772316932678223 seconds. +- Overall skill 0.347448; relative MASE 0.776694; relative WQL 0.548252. +- term skill: long=0.3829, medium=0.3908, short=0.3157. +- domain skill: Econ/Fin=0.0975, Energy=0.1743, Healthcare=0.3647, Nature=0.4116, Sales=0.3348, Transport=0.4489, Web/CloudOps=0.5001. +- frequency skill: A=0.3764, D=0.3250, H=0.3728, M=0.0605, Q=0.1918, S=0.4294, T=0.3920, W=0.1973. +- variates skill: multivariate=0.3811, univariate=0.3193. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema3000_continuity +- Checkpoint SHA-256: `24a38240b540c1311317103b880d4be47e17b7de883f535ef95977a3acc596dd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.933598279953003 seconds. +- Overall skill 0.348060; relative MASE 0.775887; relative WQL 0.547794. +- term skill: long=0.3822, medium=0.3909, short=0.3171. +- domain skill: Econ/Fin=0.1095, Energy=0.1761, Healthcare=0.3575, Nature=0.4106, Sales=0.3331, Transport=0.4503, Web/CloudOps=0.5000. +- frequency skill: A=0.3842, D=0.3252, H=0.3741, M=0.0510, Q=0.1966, S=0.4324, T=0.3901, W=0.2089. +- variates skill: multivariate=0.3815, univariate=0.3201. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_sign_ema6000_continuity +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.297121286392212 seconds. +- Overall skill 0.349298; relative MASE 0.774499; relative WQL 0.546694. +- term skill: long=0.3853, medium=0.3928, short=0.3172. +- domain skill: Econ/Fin=0.1160, Energy=0.1799, Healthcare=0.3608, Nature=0.4057, Sales=0.3338, Transport=0.4511, Web/CloudOps=0.5017. +- frequency skill: A=0.3836, D=0.3247, H=0.3752, M=0.0334, Q=0.1968, S=0.4300, T=0.3937, W=0.2168. +- variates skill: multivariate=0.3827, univariate=0.3214. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema1000_continuity +- Checkpoint SHA-256: `c04fc8cad141754a2cb540b636cc3ac7744554cc85e201b4b291e777b2aee196`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.066582441329956 seconds. +- Overall skill 0.343871; relative MASE 0.781301; relative WQL 0.551010. +- term skill: long=0.3732, medium=0.3938, short=0.3118. +- domain skill: Econ/Fin=0.1001, Energy=0.1746, Healthcare=0.2638, Nature=0.4169, Sales=0.3281, Transport=0.4461, Web/CloudOps=0.5042. +- frequency skill: A=0.3050, D=0.3243, H=0.3716, M=-0.0066, Q=0.1903, S=0.4298, T=0.3943, W=0.1851. +- variates skill: multivariate=0.3847, univariate=0.3094. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema3000_continuity +- Checkpoint SHA-256: `aa73bdf3e3b2d44e69c716f2dc788789949b96d69f4cd92c2b0169bfd4dc89ce`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.854033946990967 seconds. +- Overall skill 0.343138; relative MASE 0.782085; relative WQL 0.551689. +- term skill: long=0.3690, medium=0.3946, short=0.3119. +- domain skill: Econ/Fin=0.1103, Energy=0.1771, Healthcare=0.2214, Nature=0.4199, Sales=0.3279, Transport=0.4472, Web/CloudOps=0.5016. +- frequency skill: A=0.2856, D=0.3228, H=0.3725, M=0.0162, Q=0.1940, S=0.4277, T=0.3929, W=0.1727. +- variates skill: multivariate=0.3849, univariate=0.3079. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E13/E14 large_synth_ema6000_continuity +- Checkpoint SHA-256: `f23469b8d187d0304e0accdc424ddd2233ed87dd77b97500176eec73644e0591`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.708917140960693 seconds. +- Overall skill 0.343184; relative MASE 0.781828; relative WQL 0.551793. +- term skill: long=0.3706, medium=0.3947, short=0.3112. +- domain skill: Econ/Fin=0.1127, Energy=0.1747, Healthcare=0.2160, Nature=0.4195, Sales=0.3267, Transport=0.4485, Web/CloudOps=0.5041. +- frequency skill: A=0.2764, D=0.3186, H=0.3736, M=0.0181, Q=0.1970, S=0.4302, T=0.3934, W=0.1723. +- variates skill: multivariate=0.3851, univariate=0.3077. +- Outcome: Matched large-model continuation. Final EMA6000: sign augmentation wins (0.349298) over revised-loss control (0.346864) and richer synthetic generator (0.343184). Compute: control 618.3 s, synthetic 613.1 s, sign 617.9 s elapsed while sharing one H100. + +## E16 earlier-window diagnostic large_loss6000 +- Checkpoint SHA-256: `f5c7327b365832e8bd2d1b7b01e61c334f5bf620f5cae5f4d45feef2041090e8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.924073696136475 seconds. +- Overall skill 0.311219; relative MASE 0.824887; relative WQL 0.575132. +- term skill: long=0.3825, medium=0.3465, short=0.2673. +- domain skill: Econ/Fin=0.1171, Energy=0.2168, Healthcare=0.3670, Nature=0.3256, Sales=0.3803, Transport=0.3468, Web/CloudOps=0.4260. +- frequency skill: A=0.2543, D=0.3358, H=0.3410, M=0.1505, Q=0.2187, S=0.3402, T=0.3096, W=0.2343. +- variates skill: multivariate=0.3301, univariate=0.2958. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_parent +- Checkpoint SHA-256: `b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 15.111237525939941 seconds. +- Overall skill 0.312321; relative MASE 0.824141; relative WQL 0.573812. +- term skill: long=0.3880, medium=0.3443, short=0.2678. +- domain skill: Econ/Fin=0.1255, Energy=0.2150, Healthcare=0.3460, Nature=0.3326, Sales=0.3821, Transport=0.3403, Web/CloudOps=0.4349. +- frequency skill: A=0.2124, D=0.3388, H=0.3399, M=0.1428, Q=0.2091, S=0.3387, T=0.3160, W=0.2326. +- variates skill: multivariate=0.3359, univariate=0.2930. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_sign1000 +- Checkpoint SHA-256: `393950048f9d0487869b7aa5e6bd01e7ea1715dba16b1367ee8be353eac7f408`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 14.428916931152344 seconds. +- Overall skill 0.312240; relative MASE 0.821151; relative WQL 0.576037. +- term skill: long=0.3855, medium=0.3437, short=0.2691. +- domain skill: Econ/Fin=0.1296, Energy=0.2106, Healthcare=0.3560, Nature=0.3340, Sales=0.3905, Transport=0.3466, Web/CloudOps=0.4302. +- frequency skill: A=0.3161, D=0.3390, H=0.3442, M=0.1574, Q=0.2111, S=0.3426, T=0.3054, W=0.2304. +- variates skill: multivariate=0.3287, univariate=0.2988. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_sign6000 +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.61752462387085 seconds. +- Overall skill 0.318367; relative MASE 0.813893; relative WQL 0.570866. +- term skill: long=0.3826, medium=0.3453, short=0.2811. +- domain skill: Econ/Fin=0.1456, Energy=0.2164, Healthcare=0.3902, Nature=0.3427, Sales=0.3912, Transport=0.3501, Web/CloudOps=0.4291. +- frequency skill: A=0.3181, D=0.3498, H=0.3477, M=0.1673, Q=0.2198, S=0.3427, T=0.3048, W=0.2686. +- variates skill: multivariate=0.3320, univariate=0.3073. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic large_synth6000 +- Checkpoint SHA-256: `f23469b8d187d0304e0accdc424ddd2233ed87dd77b97500176eec73644e0591`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 9.829549789428711 seconds. +- Overall skill 0.311804; relative MASE 0.824530; relative WQL 0.574404. +- term skill: long=0.3704, medium=0.3520, short=0.2715. +- domain skill: Econ/Fin=0.1602, Energy=0.2091, Healthcare=0.3496, Nature=0.3283, Sales=0.3808, Transport=0.3477, Web/CloudOps=0.4301. +- frequency skill: A=0.2270, D=0.3331, H=0.3416, M=0.1436, Q=0.2168, S=0.3434, T=0.3110, W=0.2438. +- variates skill: multivariate=0.3289, univariate=0.2979. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic small_continuity +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 12.578126668930054 seconds. +- Overall skill 0.314127; relative MASE 0.818301; relative WQL 0.574876. +- term skill: long=0.3797, medium=0.3430, short=0.2755. +- domain skill: Econ/Fin=0.1152, Energy=0.2137, Healthcare=0.3801, Nature=0.3283, Sales=0.3845, Transport=0.3460, Web/CloudOps=0.4366. +- frequency skill: A=0.2537, D=0.3362, H=0.3448, M=0.1858, Q=0.2208, S=0.3366, T=0.3083, W=0.2433. +- variates skill: multivariate=0.3331, univariate=0.2986. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E16 earlier-window diagnostic small_no_continuity +- Checkpoint SHA-256: `70a3768d667df75f0d6565e831cdca8cf7c179c8546252e5902f7b7ec68ab7aa`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 11.378507137298584 seconds. +- Overall skill 0.308552; relative MASE 0.826361; relative WQL 0.578561. +- term skill: long=0.3803, medium=0.3416, short=0.2654. +- domain skill: Econ/Fin=0.0571, Energy=0.2115, Healthcare=0.3152, Nature=0.3257, Sales=0.3845, Transport=0.3471, Web/CloudOps=0.4427. +- frequency skill: A=0.2363, D=0.3288, H=0.3546, M=0.1261, Q=0.1813, S=0.3403, T=0.3019, W=0.2031. +- variates skill: multivariate=0.3334, univariate=0.2881. +- Outcome: Model selection only. Seasonal Naive is recomputed on the earlier cutoff and capped-history scale. Final sign augmentation improves both main and earlier cutoffs; the richer synthetic generator does not beat its control. No diagnostic labels enter training. + +## E14 final sign-augmented single model, full validation +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.344508; relative MASE 0.777383; relative WQL 0.552713. +- term skill: long=0.3776, medium=0.3912, short=0.3123. +- domain skill: Econ/Fin=0.0926, Energy=0.1707, Healthcare=0.3648, Nature=0.4053, Sales=0.3446, Transport=0.4514, Web/CloudOps=0.4943. +- frequency skill: A=0.2937, D=0.3275, H=0.3694, M=0.0521, Q=0.1776, S=0.4300, T=0.3859, W=0.2124. +- variates skill: multivariate=0.3784, univariate=0.3162. +- Outcome: Full skill 0.344508, relative MASE 0.777383, relative WQL 0.552713, zero failures. Outperforms the published two-model ensemble (0.340239) and also improves the earlier-cutoff diagnostic. Full inference 57.2 s. Relocated repeated example calls are bitwise deterministic, finite and monotone. Selected for atomic publication. + +## E18 remove symmetric inference after sign-augmented training +- Checkpoint SHA-256: `96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 13.020774841308594 seconds. +- Overall skill 0.345482; relative MASE 0.778014; relative WQL 0.550625. +- term skill: long=0.3817, medium=0.3909, short=0.3125. +- domain skill: Econ/Fin=0.1197, Energy=0.1784, Healthcare=0.3304, Nature=0.4074, Sales=0.3304, Transport=0.4474, Web/CloudOps=0.4960. +- frequency skill: A=0.3782, D=0.3248, H=0.3710, M=0.0198, Q=0.1916, S=0.4321, T=0.3889, W=0.2113. +- variates skill: multivariate=0.3767, univariate=0.3195. +- Outcome: Negative result: removing the x/-x average lowers screening skill from 0.349298 to 0.345482 despite sign-augmented training. We retain symmetric inference; the speed saving is not needed for the contract budget. + +## E17 16-point projection conversion before continuation +- Checkpoint SHA-256: `d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 17.147535800933838 seconds. +- Overall skill 0.341987; relative MASE 0.782323; relative WQL 0.553456. +- term skill: long=0.3765, medium=0.3855, short=0.3105. +- domain skill: Econ/Fin=0.0851, Energy=0.1664, Healthcare=0.3542, Nature=0.4067, Sales=0.3482, Transport=0.4386, Web/CloudOps=0.4996. +- frequency skill: A=0.2894, D=0.3469, H=0.3634, M=-0.0442, Q=0.1930, S=0.4414, T=0.3853, W=0.1987. +- variates skill: multivariate=0.3808, univariate=0.3093. +- Outcome: Conversion of our own E14 EMA6000 checkpoint loses screening skill from 0.349298 to 0.341987 before updates. Input/query projection halves are folded by summation, constant-feature activation preserved, first 16 output rows retained, and physical sine positions remain in 32-point units. No external weights. Continuation is needed. + +## E17 matched patch-resolution continuation +- Hypothesis: finer patches improve short-horizon detail and align common seasonal periods more closely without shortening context. +- Control: 32-point patches, 37,002,816 parameters; treatment: 16-point patches, 36,764,960 parameters, initialized by conversion of the same owned parent E14 EMA6000. Only patch projections and positional spacing change. Physical position units remain 32 points; metadata horizon is floored at 32 to preserve short-horizon conditioning. +- Both use the same window stream: seed47, batch256, 6000steps, AdamW8e-5, same sign-augmented sampler and median/seasonal-error-weighted loss/EMA. Context remains4096, maximum output1024. One H100 shared between runs. +- Conversion code: patch16/convert.py. The converted checkpoint retains its parent hash and conversion description. Training and runtime require the model in patch16/model.py, copied to patch16_inference/model.py. Results pending final matched checkpoints. + +## E17 patch16_trial_ema1000 +- Checkpoint SHA-256: `396a7e827e8ddd068535f96f590e710f1931818c4e0b4cc589648bf68c830ba1`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.109450101852417 seconds. +- Overall skill 0.348957; relative MASE 0.771301; relative WQL 0.549536. +- term skill: long=0.3832, medium=0.3926, short=0.3175. +- domain skill: Econ/Fin=0.0969, Energy=0.1735, Healthcare=0.3953, Nature=0.4077, Sales=0.3495, Transport=0.4526, Web/CloudOps=0.4982. +- frequency skill: A=0.3699, D=0.3389, H=0.3688, M=0.0874, Q=0.1860, S=0.4381, T=0.3905, W=0.1934. +- variates skill: multivariate=0.3799, univariate=0.3232. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch16_trial_ema3000 +- Checkpoint SHA-256: `aad4bb2f079c957b1c2a064fc245e660bd9992bf0a01b57c9a48b0d33a44436e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 13.450159549713135 seconds. +- Overall skill 0.348611; relative MASE 0.772343; relative WQL 0.549378. +- term skill: long=0.3843, medium=0.3974, short=0.3144. +- domain skill: Econ/Fin=0.1014, Energy=0.1753, Healthcare=0.3863, Nature=0.4037, Sales=0.3479, Transport=0.4516, Web/CloudOps=0.4997. +- frequency skill: A=0.3647, D=0.3298, H=0.3718, M=0.0756, Q=0.1866, S=0.4393, T=0.3930, W=0.1879. +- variates skill: multivariate=0.3823, univariate=0.3204. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch16_trial_ema6000 +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.25124716758728 seconds. +- Overall skill 0.351398; relative MASE 0.770359; relative WQL 0.546090. +- term skill: long=0.3847, medium=0.3993, short=0.3185. +- domain skill: Econ/Fin=0.1048, Energy=0.1768, Healthcare=0.3969, Nature=0.4061, Sales=0.3499, Transport=0.4528, Web/CloudOps=0.5033. +- frequency skill: A=0.3673, D=0.3318, H=0.3738, M=0.0802, Q=0.1913, S=0.4391, T=0.3969, W=0.1924. +- variates skill: multivariate=0.3843, univariate=0.3240. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema1000 +- Checkpoint SHA-256: `56edd93dd7e80399be57a359574b2fb89eba843fa1ddf01f1d3f3a2d9c2fd73b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 12.499926567077637 seconds. +- Overall skill 0.347764; relative MASE 0.775926; relative WQL 0.548263. +- term skill: long=0.3840, medium=0.3930, short=0.3148. +- domain skill: Econ/Fin=0.1090, Energy=0.1783, Healthcare=0.3531, Nature=0.4057, Sales=0.3333, Transport=0.4508, Web/CloudOps=0.5005. +- frequency skill: A=0.3826, D=0.3190, H=0.3738, M=0.0404, Q=0.1937, S=0.4305, T=0.3927, W=0.2146. +- variates skill: multivariate=0.3815, univariate=0.3196. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema3000 +- Checkpoint SHA-256: `fe46ac478011854b20eeba3bbde42023f299e2d8544d223f046be0e234ae7c6e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.177376747131348 seconds. +- Overall skill 0.349507; relative MASE 0.774280; relative WQL 0.546496. +- term skill: long=0.3853, medium=0.3964, short=0.3160. +- domain skill: Econ/Fin=0.1062, Energy=0.1803, Healthcare=0.3631, Nature=0.4048, Sales=0.3322, Transport=0.4510, Web/CloudOps=0.5041. +- frequency skill: A=0.3765, D=0.3187, H=0.3755, M=0.0515, Q=0.1928, S=0.4362, T=0.3953, W=0.2095. +- variates skill: multivariate=0.3848, univariate=0.3199. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E17 patch32_control_ema6000 +- Checkpoint SHA-256: `3ee55007ebabdc41a5bbb6553dcd0c4b86e90b717dd1cff758d2318f538c0929`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.685351848602295 seconds. +- Overall skill 0.350171; relative MASE 0.774332; relative WQL 0.545345. +- term skill: long=0.3851, medium=0.3971, short=0.3171. +- domain skill: Econ/Fin=0.1122, Energy=0.1816, Healthcare=0.3633, Nature=0.4023, Sales=0.3323, Transport=0.4516, Web/CloudOps=0.5054. +- frequency skill: A=0.3791, D=0.3172, H=0.3768, M=0.0518, Q=0.1910, S=0.4349, T=0.3964, W=0.2119. +- variates skill: multivariate=0.3854, univariate=0.3207. +- Outcome: Matched seed47/window-stream comparison. Final patch16 skill 0.351398 exceeds patch32 0.350171, mainly through median error. Compute: control447.6s, patch16 563.2s, sharing one H100. Earlier-cutoff and full-package validation are pending before selection. + +## E19 prefix-consistent direct decoder +- Hypothesis: requested total horizon should not change predictions of the same first steps. The context-only probe compared H48 versus H720 after all inference rules; mean absolute median-prefix differences were 0.0059–0.0582 context standard deviations across six sampled configurations (prefix_probe.json). +- Change: future-query self-attention becomes causal and the total-horizon metadata feature is replaced by its constant training-mixture mean. Forecasts remain direct and parallel; no generated output is fed back. Encoder/cross attention and all data/loss settings stay unchanged. +- Seed47, batch256, 6000steps, same original E14 EMA6000 parent and sampled-window stream as E17 patch32_control. Reuse that completed control instead of repeating it. Only the new decoder variant trains. Runtime/model: prefix_consistent/model.py, copied into prefix_inference. +- Results pending. + +## E17 patch16, full validation +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.346729; relative MASE 0.773486; relative WQL 0.551739. +- term skill: long=0.3768, medium=0.3979, short=0.3138. +- domain skill: Econ/Fin=0.0839, Energy=0.1675, Healthcare=0.4022, Nature=0.4059, Sales=0.3593, Transport=0.4530, Web/CloudOps=0.4957. +- frequency skill: A=0.2818, D=0.3356, H=0.3684, M=0.0967, Q=0.1741, S=0.4391, T=0.3887, W=0.1870. +- variates skill: multivariate=0.3799, univariate=0.3190. +- Outcome: Full skill 0.346729, relative MASE 0.773486 and relative WQL 0.551739, zero failures; improves the previous published 0.344508. Inference 57.5 seconds. Earlier-window skill 0.322486 versus control 0.319021. Relocated repeated example outputs are bitwise identical, finite and monotone. Initial assembly failed on a symlinked lineage path, was never published, and was rebuilt after canonicalizing paths; the missing-output score from that failed pipeline is discarded. + +## E19 prefix_consistent_ema1000 +- Checkpoint SHA-256: `aa797f3356c30e1859821bd807202298774b8d44b59b8325cc73956796a83b21`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.920389413833618 seconds. +- Overall skill 0.347132; relative MASE 0.775797; relative WQL 0.549418. +- term skill: long=0.3820, medium=0.3928, short=0.3146. +- domain skill: Econ/Fin=0.1091, Energy=0.1769, Healthcare=0.3709, Nature=0.4082, Sales=0.3333, Transport=0.4492, Web/CloudOps=0.4954. +- frequency skill: A=0.3824, D=0.3200, H=0.3727, M=0.0361, Q=0.1918, S=0.4265, T=0.3902, W=0.2278. +- variates skill: multivariate=0.3798, univariate=0.3199. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E19 prefix_consistent_ema3000 +- Checkpoint SHA-256: `11094f18080cd31f38a7f33d1df852adc957d9f1705653360b21e790e55b6648`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 10.28545594215393 seconds. +- Overall skill 0.348148; relative MASE 0.775101; relative WQL 0.548201. +- term skill: long=0.3814, medium=0.3951, short=0.3158. +- domain skill: Econ/Fin=0.1060, Energy=0.1786, Healthcare=0.3758, Nature=0.4101, Sales=0.3323, Transport=0.4489, Web/CloudOps=0.4963. +- frequency skill: A=0.3799, D=0.3215, H=0.3735, M=0.0487, Q=0.1876, S=0.4294, T=0.3915, W=0.2202. +- variates skill: multivariate=0.3812, univariate=0.3206. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E19 prefix_consistent_ema6000 +- Checkpoint SHA-256: `2572d0401c85966c3936b3feed906dee4206ca403a778c2356406aca57988ef7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 9.322679996490479 seconds. +- Overall skill 0.349313; relative MASE 0.774658; relative WQL 0.546555. +- term skill: long=0.3800, medium=0.3960, short=0.3181. +- domain skill: Econ/Fin=0.1130, Energy=0.1774, Healthcare=0.3765, Nature=0.4114, Sales=0.3328, Transport=0.4502, Web/CloudOps=0.4987. +- frequency skill: A=0.3795, D=0.3224, H=0.3737, M=0.0589, Q=0.1895, S=0.4294, T=0.3930, W=0.2214. +- variates skill: multivariate=0.3825, univariate=0.3216. +- Outcome: Final skill 0.349313 is below the reused matched patch32 control (0.350171). This training recipe does not improve the score; not selected. Training elapsed 288.9 seconds on one H100. + +## E20: learned cross-variable adapter on the frozen E17 backbone +Hypothesis: a jointly trained attention layer can exploit synchronized channels, especially on multivariate energy and weather series. Only a new 1.05M-parameter axial attention adapter is optimized; every backbone weight is frozen. Adapter output starts at zero, and univariate contexts bypass it exactly. Attention is confined to the channels of one instance. Context rows are grouped by whole instance in inference. +Training: seed 53, 6,000 steps, 32 groups per batch, 2/3/4/8 variates, learning rate 2e-4 with 200-step warmup, AdamW, same median/quantile seasonal-scaled objective as E17, EMA. Joint pack has 334,868,547 aligned observations from 26 allow-listed directories. Thirty percent locally generated multivariate series use mixtures of latent seasonal/AR drivers with random channel lags, optional integrated noise, and observation noise. Channel signs/scales and missing observations are augmented. No validation observations are used by training. The new adapter is zero-initialized so step 0 supplies an inference grouping control. + +## E21: longer context at inference, without retraining +Hypothesis: the encoder can benefit from histories longer than its 4,096-point training maximum. Hold E17 weights and all rules fixed and compare 8,192/16,384-point context caps with the current 4,096-point cap on all 97 screen configurations. This is a selection diagnostic, not adaptation; checkpoint tensor values are unchanged. + +## E22: function-preserving depth expansion +Hypothesis: more learned capacity can improve the persistent energy and economic errors. Expand E17 from 6 encoder/4 decoder layers to 12 encoder/8 decoder layers, 72,499,488 parameters. Keep original blocks at even positions and insert random blocks with zero attention and feedforward output projections at odd positions. The initial enlarged model produces bitwise identical quantiles in a synthetic bf16 forward check. Conversion seed 59; both the expanded model and a continued 36.8M control will use seed 59, identical sampled windows, sign augmentation, revised seasonal-scaled median/quantile loss, and 24,000 AdamW steps, batch 256, learning rate 8e-5. Data remains packed_sample from 95 allowed sources plus the original local generator. GPU jobs share the single H100 if overlapping; elapsed training-process seconds will be reported. + +## E21 untrained 8192 context cap +- Checkpoint SHA-256: `4cdcd096105c711926d1be912debeecf2999cc4e70389385ea60e516a211d035`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 11.263309001922607 seconds. +- Overall skill 0.350147; relative MASE 0.769937; relative WQL 0.548498. +- term skill: long=0.3906, medium=0.3940, short=0.3160. +- domain skill: Econ/Fin=0.1042, Energy=0.1740, Healthcare=0.4046, Nature=0.3925, Sales=0.3499, Transport=0.4581, Web/CloudOps=0.5047. +- frequency skill: A=0.3673, D=0.3338, H=0.3751, M=0.0802, Q=0.1913, S=0.4410, T=0.3905, W=0.1924. +- variates skill: multivariate=0.3814, univariate=0.3241. +- Outcome: Screen skill 0.350147 is below the 4096-point parent 0.351398. Not selected. + +## E21 untrained 16384 context cap +- Checkpoint SHA-256: `a7504466f8d21bf752f3d99c32927a57cd63d0af5d5f15618ef4e8e1bdbeeb47`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 14.697236776351929 seconds. +- Overall skill 0.347052; relative MASE 0.771167; relative WQL 0.552852. +- term skill: long=0.3936, medium=0.3900, short=0.3107. +- domain skill: Econ/Fin=0.1042, Energy=0.1694, Healthcare=0.4046, Nature=0.3838, Sales=0.3499, Transport=0.4577, Web/CloudOps=0.5032. +- frequency skill: A=0.3673, D=0.3345, H=0.3752, M=0.0802, Q=0.1913, S=0.4410, T=0.3807, W=0.1924. +- variates skill: multivariate=0.3779, univariate=0.3214. +- Outcome: Below the 4096-point parent; longer context needs training and is not selected. + +## E23: fixed local-level diffusion prior (negative result) +Hypothesis: smooth series might benefit from a decaying blend with their last value and random-walk intervals. Keep E17 forecasts fixed, estimate RMS consecutive differences from the last 512 context points, and blend Gaussian last-value forecasts with weight capped at 0.8, active only where squared-difference/context-variance ratio is below 0.05. Sweep decay 24/96/384 steps; no training, no fitting, no new random seed. All variants substantially regress on the 97-configuration screen, so none is adopted. Probe elapsed 5.3 CPU seconds. Parent checkpoint SHA-256: 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. +- Decay 0: skill 0.3513976241007074; term skills {"short": 0.3185422008330211, "medium": 0.3993234467710519, "long": 0.38466658538687104}; domain skills {"Econ/Fin": 0.1047749678551001, "Energy": 0.17678999618615132, "Healthcare": 0.3968888878939394, "Nature": 0.4060764075001204, "Sales": 0.349917064856452, "Transport": 0.4527521728604965, "Web/CloudOps": 0.50332745421581}. +- Decay 24: skill 0.34165742688714285; term skills {"short": 0.30882663252618237, "medium": 0.38422047231265555, "long": 0.3803807240673608}; domain skills {"Econ/Fin": 0.09820862504146799, "Energy": 0.14638236482304767, "Healthcare": 0.3994101685341417, "Nature": 0.4097541459355638, "Sales": 0.34991701707454004, "Transport": 0.45281938688271317, "Web/CloudOps": 0.49437598362265067}. +- Decay 96: skill 0.3235906270632306; term skills {"short": 0.30736381494165377, "medium": 0.31870169010171356, "long": 0.3688721255257502}; domain skills {"Econ/Fin": 0.09505897302445243, "Energy": 0.1285464282539771, "Healthcare": 0.3977611664977332, "Nature": 0.41574057336372194, "Sales": 0.34991700862256025, "Transport": 0.45284743770041946, "Web/CloudOps": 0.43886394048274135}. +- Decay 384: skill 0.28712372958270105; term skills {"short": 0.30561653681994894, "medium": 0.2119589494208397, "long": 0.3091633781775974}; domain skills {"Econ/Fin": 0.09383616546291695, "Energy": 0.10801096739511007, "Healthcare": 0.3957240300486188, "Nature": 0.4179314810204363, "Sales": 0.3499170061816316, "Transport": 0.4526991548827556, "Web/CloudOps": 0.3016411139705769}. + +## E20 joint adapter full validation +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.348181; relative MASE 0.773070; relative WQL 0.549586. +- term skill: long=0.3789, medium=0.3973, short=0.3159. +- domain skill: Econ/Fin=0.0839, Energy=0.1670, Healthcare=0.4022, Nature=0.4151, Sales=0.3593, Transport=0.4530, Web/CloudOps=0.4958. +- frequency skill: A=0.2818, D=0.3370, H=0.3714, M=0.0967, Q=0.1741, S=0.4354, T=0.3901, W=0.1878. +- variates skill: multivariate=0.3830, univariate=0.3190. +- Outcome: Full validation improves from 0.346729 to 0.348181 with no failures. Main screen improves from 0.351398 to 0.352838, but the earlier-window diagnostic regresses from 0.322486 to 0.321225. Selected on the task full validation metric, with this temporal limitation recorded. Training 157.8 process seconds on the single shared H100; full inference 63.7 seconds excluding startup. Frozen backbone equality, within-instance isolation, and repeated relocated example determinism verified. + +## E20 joint adapter screen +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.721086978912354 seconds. +- Overall skill 0.352838; relative MASE 0.769945; relative WQL 0.543959. +- term skill: long=0.3868, medium=0.3987, short=0.3205. +- domain skill: Econ/Fin=0.1048, Energy=0.1763, Healthcare=0.3969, Nature=0.4152, Sales=0.3499, Transport=0.4528, Web/CloudOps=0.5034. +- frequency skill: A=0.3673, D=0.3332, H=0.3768, M=0.0802, Q=0.1913, S=0.4354, T=0.3982, W=0.1932. +- variates skill: multivariate=0.3874, univariate=0.3240. +- Outcome: The added adapter improves weather forecasts most; some ETT and cloud configurations regress. Original univariate forecasts are unchanged. + +## E20 joint adapter earlier-window diagnostic +- Checkpoint SHA-256: `88beaafe52bd88300ebd46afc3a0d950246c280c738ac52367203d6c776a3053`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 16.06979727745056 seconds. +- Overall skill 0.321225; relative MASE 0.812345; relative WQL 0.567168. +- term skill: long=0.3839, medium=0.3520, short=0.2830. +- domain skill: Econ/Fin=0.1423, Energy=0.2143, Healthcare=0.3841, Nature=0.3485, Sales=0.3968, Transport=0.3596, Web/CloudOps=0.4341. +- frequency skill: A=0.3026, D=0.3536, H=0.3503, M=0.1681, Q=0.2189, S=0.3405, T=0.3157, W=0.2466. +- variates skill: multivariate=0.3338, univariate=0.3110. +- Outcome: Temporal diagnostic regression; this limits confidence in the small primary-validation gain. + +## E24: seasonal-template recency +Hypothesis: averaging the last four cycles induces bias when level or amplitude changes. Compare fixed 4/2/1-cycle means, four-cycle mean shifted to the latest cycle mean, and exponentially weighted four-cycle mean. The rest of the E17 forecaster and all confidence thresholds are fixed. Validation only; no parameter fitting. Centering improves the main screen 0.351398 to 0.353163 but decreases the earlier-window diagnostic 0.322486 to 0.321979. Other variants show larger temporal disagreement. Detailed per-configuration and group results remain in research/seasonal_recency/{screen,backcast}.json. Probe runtime: 15.3 and 15.0 CPU seconds. No variant published yet. + +## E25: learned recency features +Hypothesis: adding level and amplitude change features to future queries lets the model learn when seasonal recency matters, instead of imposing a uniform template rule. Add a zero-initialized 32,768-parameter query projection receiving, for each of the two periods, latest-cycle minus four-cycle mean and the phase template times the latest/four-cycle standard deviation ratio minus one. Ratios are clipped to [0.5,2]; features require three observed cycles. Existing query and median heads stay structurally unchanged. Starting function is preserved; all weights are then trained. Same seed 59, parent E17, 24,000-step learning-rate schedule, batch 256 and identical sampler stream as E22's 36.8M control. Checkpoints every 3,000 steps; an unpromising trial can be stopped early. No validation data is used by training. + +## E26: second earlier-cutoff diagnostic +Create a second nonoverlapping diagnostic window by removing another forecast horizon from E16 inputs. All observations remain within supplied validation histories and are never passed to trainers. 94 configurations and 8,934 instances have usable normalizers; Seasonal Naive and seasonal-error normalizers are recomputed for these prefixes. This diagnostic has its own scale and cannot be compared directly to primary validation or held-out reward. Purpose: assess temporal stability of the adapter and recency changes after the first earlier diagnostic disagreed with primary validation. + +E26 eligibility correction: SZ_TAXI long has exactly one seasonal period (96 points) left, so its prefix seasonal error is undefined. It is excluded from this diagnostic, alongside two configurations with insufficient context. An initial reference attempt detected the undefined metric; no candidate was selected on that invalid draft. + +E26 paired comparison on the 94 common configurations: adapter minus parent mean log geometric error by cutoff = [-0.0023015101916589752, 0.0019472848873323858, 0.0034041402255075566]. Positive means worse; the three-cutoff mean is 0.0010166383070603225. The adapter improves primary full validation but regresses on both earlier cutoffs, so its apparent gain is not temporally robust. + +E24 complete recency-rule ablation; parent checkpoint SHA-256 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. No training, no random seed; model weights unchanged. + +screen diagnostic, 15.3 CPU seconds total: +- (4, 'mean'): skill 0.3513976241007074; group skills {"term": {"short": 0.3185422008330211, "medium": 0.3993234467710519, "long": 0.38466658538687104}, "domain": {"Econ/Fin": 0.1047749678551001, "Energy": 0.17678999618615132, "Healthcare": 0.3968888878939394, "Nature": 0.4060764075001204, "Sales": 0.349917064856452, "Transport": 0.4527521728604965, "Web/CloudOps": 0.50332745421581}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19127390925064935, "M": 0.08024694183722458, "W-SUN": 0.035758619864346475, "D": 0.3318015817783623, "H": 0.37383534533108864, "15T": 0.1940857197364374, "W-FRI": -0.03678057554518466, "10T": 0.4946120106982924, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5069054537063827, "10S": 0.43906058031696027}} +- (2, 'mean'): skill 0.3515869592249251; group skills {"term": {"short": 0.31946055343361235, "medium": 0.395564454113736, "long": 0.3871567716641673}, "domain": {"Econ/Fin": 0.12253197026836216, "Energy": 0.18298948886090993, "Healthcare": 0.39741811166060514, "Nature": 0.40643913101885387, "Sales": 0.34900834734187824, "Transport": 0.45646747263938636, "Web/CloudOps": 0.4921796292797348}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19172301173815798, "M": 0.07891640026491331, "W-SUN": 0.04042355013060539, "D": 0.3321769544067552, "H": 0.38073675441614074, "15T": 0.20117188206554237, "W-FRI": -0.03695866316509533, "10T": 0.49452343668884957, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5070472862431538, "10S": 0.3973951356554515}} +- (1, 'mean'): skill 0.3435908999493934; group skills {"term": {"short": 0.3116909988543801, "medium": 0.38160533975903543, "long": 0.384670295110323}, "domain": {"Econ/Fin": 0.13426770743669836, "Energy": 0.18216526583305703, "Healthcare": 0.40167072012279914, "Nature": 0.4064404130881688, "Sales": 0.3492754711813856, "Transport": 0.4589127441324581, "Web/CloudOps": 0.45693278131755455}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19143020771042418, "M": 0.08285832779020297, "W-SUN": 0.04327272071755062, "D": 0.33288417189993846, "H": 0.38267829909706397, "15T": 0.19937252608994493, "W-FRI": -0.037004579119138015, "10T": 0.4945270610078465, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067187989779461, "10S": 0.25271387987938276}} +- (4, 'centered'): skill 0.3531633226160329; group skills {"term": {"short": 0.3207293873053654, "medium": 0.3969450585806461, "long": 0.38964518179731034}, "domain": {"Econ/Fin": 0.12636396756466373, "Energy": 0.1800705780909143, "Healthcare": 0.3992839589819721, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45585497734478375, "Web/CloudOps": 0.5005422814848317}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19175192579993316, "M": 0.07909511983098594, "W-SUN": 0.042408325150654624, "D": 0.33302767036606196, "H": 0.37896395394765425, "15T": 0.19862358212653608, "W-FRI": -0.03667482636982777, "10T": 0.49458872561779677, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067600572208003, "10S": 0.43120160792893125}} +- (4, 'exponential'): skill 0.3506285650976836; group skills {"term": {"short": 0.31758444696147214, "medium": 0.39583120771209657, "long": 0.38712405721550214}, "domain": {"Econ/Fin": 0.11941316839573946, "Energy": 0.1820733009344513, "Healthcare": 0.39881728965443064, "Nature": 0.4063573767251085, "Sales": 0.3492900874450249, "Transport": 0.45600364485060096, "Web/CloudOps": 0.4900268042948257}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19155754727480623, "M": 0.08126365276376935, "W-SUN": 0.0395554234837493, "D": 0.3321922474298862, "H": 0.3798686284876259, "15T": 0.19972610305133176, "W-FRI": -0.036894372612062964, "10T": 0.49455551047271673, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.507021365412977, "10S": 0.38828731350299905}} + +backcast diagnostic, 15.0 CPU seconds total: +- (4, 'mean'): skill 0.3224855500998881; group skills {"term": {"short": 0.2849500928667269, "medium": 0.35106641415497664, "long": 0.3858074289185036}, "domain": {"Econ/Fin": 0.14231294402320693, "Energy": 0.22033739564654398, "Healthcare": 0.38413791496286065, "Nature": 0.34419561689971845, "Sales": 0.3968014140531252, "Transport": 0.35961999575754544, "Web/CloudOps": 0.43501924471773445}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21891811984740894, "M": 0.16812726492063224, "W-SUN": -0.010729530876487425, "D": 0.35222355718445886, "H": 0.3519096502404674, "15T": 0.2228803711964017, "W-FRI": 0.24958026063282224, "10T": 0.28160966000223076, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41752089397176684, "10S": 0.3420520567149261}} +- (2, 'mean'): skill 0.31641087380554034; group skills {"term": {"short": 0.2768742380592605, "medium": 0.34943272384716806, "long": 0.38006754913357355}, "domain": {"Econ/Fin": 0.1588024863579226, "Energy": 0.21997369353201524, "Healthcare": 0.371350308865825, "Nature": 0.34524192786763674, "Sales": 0.3968014140531252, "Transport": 0.3617399277122316, "Web/CloudOps": 0.4078808317401613}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21832950345882607, "M": 0.1660037727174999, "W-SUN": -0.006617407115359519, "D": 0.3510532765644364, "H": 0.35322947177285846, "15T": 0.2251426669096147, "W-FRI": 0.2495544318494044, "10T": 0.28154255982923526, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.417584870977882, "10S": 0.23197125321775225}} +- (1, 'mean'): skill 0.31723500000228033; group skills {"term": {"short": 0.28111182113787236, "medium": 0.34369676593720844, "long": 0.3794207668157681}, "domain": {"Econ/Fin": 0.16484876593565279, "Energy": 0.2163334841815111, "Healthcare": 0.34937996041769215, "Nature": 0.3461425603980003, "Sales": 0.3968014140531252, "Transport": 0.36432827783243815, "Web/CloudOps": 0.4170717985814322}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21811526606513132, "M": 0.17155750755784438, "W-SUN": -0.004083126467642861, "D": 0.34319459279654896, "H": 0.35193709208671076, "15T": 0.22385514627514524, "W-FRI": 0.249535867076202, "10T": 0.28142605167103807, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41764726501313276, "10S": 0.27470089184112967}} +- (4, 'centered'): skill 0.3219793532222529; group skills {"term": {"short": 0.28513766744425706, "medium": 0.34881946541915476, "long": 0.3853894132385529}, "domain": {"Econ/Fin": 0.15718749322076342, "Energy": 0.220305778786681, "Healthcare": 0.3623301744180454, "Nature": 0.34528108993797224, "Sales": 0.3968014140531252, "Transport": 0.3641900819387449, "Web/CloudOps": 0.4312095523303556}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21945119732749618, "M": 0.17114892410654747, "W-SUN": -0.005425657907346837, "D": 0.3478712397506638, "H": 0.3538545808265424, "15T": 0.22504062323947938, "W-FRI": 0.24955455634324242, "10T": 0.28170410454547445, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176757195719526, "10S": 0.32801909847059685}} +- (4, 'exponential'): skill 0.3212088988374776; group skills {"term": {"short": 0.282531844032045, "medium": 0.3501930275891618, "long": 0.386723067036399}, "domain": {"Econ/Fin": 0.15471014663681715, "Energy": 0.22088089450488246, "Healthcare": 0.3714910427574707, "Nature": 0.3450102784118355, "Sales": 0.3968014140531252, "Transport": 0.3619509561390626, "Web/CloudOps": 0.4275124121699033}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21855293965122158, "M": 0.16975398671452624, "W-SUN": -0.007489648663621784, "D": 0.3494275697398366, "H": 0.3534238823299253, "15T": 0.22624199923728783, "W-FRI": 0.24956090397954467, "10T": 0.28154140034619046, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176567607348064, "10S": 0.31322950674661665}} + +backcast2 diagnostic, 11.3 CPU seconds total: +- (4, 'mean'): skill 0.3455098962011296; group skills {"term": {"short": 0.3290580626564209, "medium": 0.3700339540817553, "long": 0.36380280474970406}, "domain": {"Econ/Fin": 0.08514981056677962, "Energy": 0.22004402556428637, "Healthcare": 0.34077993948093876, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.4089471064366391, "Web/CloudOps": 0.4235634025112891}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14846418792970395, "M": 0.1666731962215917, "W-SUN": 0.04822698344798482, "D": 0.4221052975732391, "H": 0.37954447462865715, "15T": 0.09066258444282005, "W-FRI": 0.10650868616967224, "10T": 0.4524242293365175, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45460956828782484, "10S": 0.2830610169711695}} +- (2, 'mean'): skill 0.34268288377692957; group skills {"term": {"short": 0.3260103214844039, "medium": 0.3650713522346687, "long": 0.36394907927583375}, "domain": {"Econ/Fin": 0.10626345560515471, "Energy": 0.21855508043330296, "Healthcare": 0.33494058443346464, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41262361590216645, "Web/CloudOps": 0.40733619806789245}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14853117890045908, "M": 0.15637649692786237, "W-SUN": 0.05109649829750129, "D": 0.4226979938774772, "H": 0.3810140667041473, "15T": 0.10084524164002151, "W-FRI": 0.10650868616967224, "10T": 0.4522402959584214, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45675628129488266, "10S": 0.20569731261667445}} +- (1, 'mean'): skill 0.3445039461555758; group skills {"term": {"short": 0.332077466515454, "medium": 0.3668808106296455, "long": 0.3542531601492346}, "domain": {"Econ/Fin": 0.10936035558443968, "Energy": 0.21764038800605967, "Healthcare": 0.3307656098951277, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41137296882664487, "Web/CloudOps": 0.4178001938815905}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14899214852623166, "M": 0.14771341656467907, "W-SUN": 0.05292218751297184, "D": 0.42303155789223856, "H": 0.3788342098211268, "15T": 0.10485120143271387, "W-FRI": 0.10650868616967224, "10T": 0.45177551404888616, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4576208051300459, "10S": 0.24855961647506852}} +- (4, 'centered'): skill 0.34598093527842033; group skills {"term": {"short": 0.3300325159298324, "medium": 0.3728154676891604, "long": 0.3603198134443867}, "domain": {"Econ/Fin": 0.10766883532595528, "Energy": 0.21948028584715717, "Healthcare": 0.3411805258187349, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41219265214646406, "Web/CloudOps": 0.4193348965687418}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14770244416717793, "M": 0.16665926477245963, "W-SUN": 0.05081321100071179, "D": 0.4226895384052014, "H": 0.3801908053318377, "15T": 0.10067740700220107, "W-FRI": 0.10650868616967224, "10T": 0.45281662963561176, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4517952090885672, "10S": 0.27767832330559383}} +- (4, 'exponential'): skill 0.3469706591030196; group skills {"term": {"short": 0.330791312305022, "medium": 0.3720978115862891, "long": 0.36385111952680094}, "domain": {"Econ/Fin": 0.1001234277395946, "Energy": 0.2202025077634595, "Healthcare": 0.336380045647639, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41155494383831315, "Web/CloudOps": 0.4258605737282435}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.1486686416475177, "M": 0.15834250660686766, "W-SUN": 0.05058427650785369, "D": 0.42264469285933903, "H": 0.38114337578655855, "15T": 0.10061532381315941, "W-FRI": 0.10650868616967224, "10T": 0.4522176935148189, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45594734272112136, "10S": 0.2839470264038111}} + +Centered four-cycle templates improve primary full validation and the second earlier diagnostic, while slightly reducing the first earlier diagnostic. They replace the joint adapter package: full validation 0.348797 versus adapter 0.348181, with better temporal stability. The joint adapter remains an archived experiment after worsening on both earlier cutoffs. + +## E24 centered seasonal template full validation +- Checkpoint SHA-256: `0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.348797; relative MASE 0.771273; relative WQL 0.549826. +- term skill: long=0.3827, medium=0.3957, short=0.3161. +- domain skill: Econ/Fin=0.1051, Energy=0.1719, Healthcare=0.4042, Nature=0.4059, Sales=0.3592, Transport=0.4561, Web/CloudOps=0.4931. +- frequency skill: A=0.2818, D=0.3368, H=0.3739, M=0.0954, Q=0.1765, S=0.4312, T=0.3905, W=0.1880. +- variates skill: multivariate=0.3783, univariate=0.3243. +- Outcome: Published. Same 36,764,960 learned parameters as E17; fixed seasonal template now preserves four-cycle shape while aligning its mean to the latest cycle. Full validation 0.348797 with zero failures; screen 0.353163; earlier diagnostics 0.321979 and 0.345981. Full inference 79.6 seconds while three training processes shared the one H100. Repeated relocated examples bitwise identical, finite, monotone. + +## E27: quantile width calibration diagnostic +Hypothesis: the changed training objective and sign-averaged forecasts may change interval calibration relative to the early E3 width sweep. Hold current E24 medians fixed and compare global width multipliers 0.75, 1.0 and 1.25, preserving positivity and monotone deciles. No training or new random seed. Evaluate primary full validation and both earlier diagnostics; retain the same multiplier for every instance and horizon if adopted. Record per-configuration decile coverage to distinguish interval calibration from point-forecast errors. + +## E28: stronger seasonal-error scaling in the training loss +Hypothesis: the existing floor 0.25 and maximum weight 4 underweight highly predictable series, whose small seasonal-error denominators make small biases costly in MASE. Change only this loss factor to floor 0.05 and maximum weight 20. The weight is derived from training contexts only; no validation observations enter gradients. Same E17 parent, seed 59, batch 256, sampled windows, 8e-5 learning rate and 24,000-step schedule as E22 control. Assess at 3,000 and 6,000 steps before deciding whether to continue. No architecture or inference changes. All training processes use the same single H100. + +E27 completed: global interval-width calibration is unchanged. The 1.0 multiplier wins on all three cutoffs; 0.75 and 1.25 are rejected. Parent checkpoint SHA-256: 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3. + +full, 21.961196422576904 CPU seconds: +- Width 0.75: skill 0.3452164549545038; group skills {"term": {"short": 0.313465550024141, "medium": 0.3915340298847654, "long": 0.37755696642578507}, "domain": {"Econ/Fin": 0.10580171688867446, "Energy": 0.16637482564763484, "Healthcare": 0.40914268073244664, "Nature": 0.4019524649941506, "Sales": 0.3530144630644825, "Transport": 0.4556672339606386, "Web/CloudOps": 0.4876214368641769}, "freq": {"A-DEC": 0.28725493449470174, "Q-DEC": 0.1801084712445944, "M": 0.11175276948966328, "W-SUN": 0.0323370845377442, "D": 0.3312199981338694, "H": 0.3695069715804825, "15T": 0.18168253390246492, "W-FRI": -0.056487631535321325, "10T": 0.49352637886384465, "W-TUE": 0.5378585205934543, "W-THU": 0.18433827097062172, "W-WED": 0.31349093490925006, "5T": 0.49222999321979144, "10S": 0.42390324244202104}} +- Width 1.0: skill 0.3487966789303172; group skills {"term": {"short": 0.3161336626027256, "medium": 0.3956796502512826, "long": 0.38269594016340247}, "domain": {"Econ/Fin": 0.10510484967413847, "Energy": 0.171919600185363, "Healthcare": 0.4042072222593659, "Nature": 0.40589812140398485, "Sales": 0.3591878025853771, "Transport": 0.4560779320618533, "Web/CloudOps": 0.4931146707071308}, "freq": {"A-DEC": 0.2818339423423022, "Q-DEC": 0.17653014662394806, "M": 0.09542703722254098, "W-SUN": 0.028486795465021086, "D": 0.336759380183841, "H": 0.3739148859162613, "15T": 0.18778774397400844, "W-FRI": -0.055524607369072276, "10T": 0.49458872561912703, "W-TUE": 0.552193186183172, "W-THU": 0.16944597281618878, "W-WED": 0.3192454710115562, "5T": 0.4977061545271937, "10S": 0.431201607928979}} +- Width 1.25: skill 0.34610650213535965; group skills {"term": {"short": 0.31181715347067873, "medium": 0.39425414652966917, "long": 0.3825681229603841}, "domain": {"Econ/Fin": 0.09501414185590251, "Energy": 0.17012785606235192, "Healthcare": 0.3929707629727902, "Nature": 0.4039288459201795, "Sales": 0.3578978997303499, "Transport": 0.4512528387663022, "Web/CloudOps": 0.49362461046923467}, "freq": {"A-DEC": 0.2690929347470029, "Q-DEC": 0.16432266959209074, "M": 0.07072014222773326, "W-SUN": 0.01173769854460438, "D": 0.3347121204957273, "H": 0.37299271990393135, "15T": 0.18526873151735845, "W-FRI": -0.07163417179692866, "10T": 0.49168735086319126, "W-TUE": 0.562370097705067, "W-THU": 0.14458649403408286, "W-WED": 0.32018515385552937, "5T": 0.4992200637780666, "10S": 0.43174911263031324}} + +backcast, 8.311058759689331 CPU seconds: +- Width 0.75: skill 0.31957721298205577; group skills {"term": {"short": 0.2849135227503923, "medium": 0.3430617259135954, "long": 0.3812505435660858}, "domain": {"Econ/Fin": 0.16020201234615272, "Energy": 0.21754177729190793, "Healthcare": 0.3694068614617043, "Nature": 0.3429441402339167, "Sales": 0.39134717268523767, "Transport": 0.36216325202164235, "Web/CloudOps": 0.42635659392097536}, "freq": {"A-DEC": 0.3052930254291859, "Q-DEC": 0.22988988761857532, "M": 0.17459013453754524, "W-SUN": 0.007398260950902569, "D": 0.3450062706602839, "H": 0.3480315684129901, "15T": 0.22233620685464417, "W-FRI": 0.30096387619142784, "10T": 0.27185481492835484, "W-TUE": 0.5329255178801061, "W-THU": 0.18370602390723068, "W-WED": 0.33814381573585706, "5T": 0.40916267988319677, "10S": 0.3313031636056427}} +- Width 1.0: skill 0.3219793532184254; group skills {"term": {"short": 0.28513766744059266, "medium": 0.34881946541549136, "long": 0.3853894132342357}, "domain": {"Econ/Fin": 0.15718749322715975, "Energy": 0.22030577879293345, "Healthcare": 0.3623301744205766, "Nature": 0.34528108990726747, "Sales": 0.39680141405427904, "Transport": 0.36419008193684854, "Web/CloudOps": 0.431209552326686}, "freq": {"A-DEC": 0.30258726544387415, "Q-DEC": 0.2194511972962907, "M": 0.1711489239900802, "W-SUN": -0.005425657920283156, "D": 0.3478712397620801, "H": 0.35385458082566135, "15T": 0.22504062321275653, "W-FRI": 0.24955455634173984, "10T": 0.2817041045341433, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316324492524, "W-WED": 0.3400228795175667, "5T": 0.41767571957575267, "10S": 0.32801909847013033}} +- Width 1.25: skill 0.31790201775956073; group skills {"term": {"short": 0.2784084543186459, "medium": 0.34919365386981416, "long": 0.38309258280714664}, "domain": {"Econ/Fin": 0.14485063305112178, "Energy": 0.2160406174537144, "Healthcare": 0.34843021568184673, "Nature": 0.3414042631923321, "Sales": 0.3949701602051685, "Transport": 0.36064559654919026, "Web/CloudOps": 0.43041506837139865}, "freq": {"A-DEC": 0.289217486212048, "Q-DEC": 0.20086669955100855, "M": 0.15692994437261798, "W-SUN": -0.02840754711998872, "D": 0.34384490006115054, "H": 0.35403896763656184, "15T": 0.21854779190662021, "W-FRI": 0.19508006514698906, "10T": 0.2864956555409153, "W-TUE": 0.4740288982750931, "W-THU": 0.15896541765809558, "W-WED": 0.3390816757566152, "5T": 0.42177642249121394, "10S": 0.3165112734495428}} + +backcast2, 8.009549379348755 CPU seconds: +- Width 0.75: skill 0.34409820450993134; group skills {"term": {"short": 0.3290162458924437, "medium": 0.3688383955368778, "long": 0.3584446274583232}, "domain": {"Econ/Fin": 0.1059670159637679, "Energy": 0.2168683811981844, "Healthcare": 0.3413880194250112, "Nature": 0.45062953387079285, "Sales": 0.5547232267111362, "Transport": 0.4100430663915112, "Web/CloudOps": 0.41729590695067253}, "freq": {"A-DEC": 0.34005157942217423, "Q-DEC": 0.1412869592685284, "M": 0.16881189749680703, "W-SUN": 0.047625092062016594, "D": 0.4231522928214516, "H": 0.37698957063440086, "15T": 0.0904235813541534, "W-FRI": 0.11812283700385673, "10T": 0.44881967454327965, "W-TUE": 0.07442882063540968, "W-THU": 0.2788710322691663, "W-WED": 0.5437864115591705, "5T": 0.444848784038935, "10S": 0.2913075712082248}} +- Width 1.0: skill 0.34598093529199403; group skills {"term": {"short": 0.33003251595401095, "medium": 0.3728154676872124, "long": 0.3603198134466531}, "domain": {"Econ/Fin": 0.10766883533558247, "Energy": 0.2194802858514432, "Healthcare": 0.34118052581938385, "Nature": 0.4518189405691444, "Sales": 0.5552026877071643, "Transport": 0.4121926521487488, "Web/CloudOps": 0.41933489656663536}, "freq": {"A-DEC": 0.33512027884784024, "Q-DEC": 0.14770244414049571, "M": 0.16665926486843274, "W-SUN": 0.05081321100210512, "D": 0.42268953844805357, "H": 0.3801908053296258, "15T": 0.10067740700216166, "W-FRI": 0.10650868616810949, "10T": 0.45281662963431724, "W-TUE": 0.0831470254212826, "W-THU": 0.2681259389949434, "W-WED": 0.5394413576971099, "5T": 0.45179520908580906, "10S": 0.2776783233055614}} +- Width 1.25: skill 0.3413902485820186; group skills {"term": {"short": 0.32419069585401805, "medium": 0.37023913422459476, "long": 0.35685627734091574}, "domain": {"Econ/Fin": 0.09962820431101826, "Energy": 0.21472017584206793, "Healthcare": 0.3337184668053308, "Nature": 0.44788650255350915, "Sales": 0.5519703061689909, "Transport": 0.4091113202517557, "Web/CloudOps": 0.41471225075769447}, "freq": {"A-DEC": 0.3220090566072281, "Q-DEC": 0.14689640454759956, "M": 0.15748943073554222, "W-SUN": 0.043428818988100804, "D": 0.4159786673838306, "H": 0.3773278172245832, "15T": 0.1020767647441726, "W-FRI": 0.08603022609757915, "10T": 0.45227993224331775, "W-TUE": 0.07815927778447074, "W-THU": 0.25035502046342106, "W-WED": 0.53163473233605, "5T": 0.4537783408350755, "10S": 0.2545513618912605}} + +Decile coverage uses <=, so ties at zero contribute excess lower-tail coverage on intermittent nonnegative series. Coverage alone is not evidence for changing intervals; the proper quantile loss favors the existing widths. + +## E22 control 3000-step checkpoint +- Checkpoint SHA-256: `8fcb7dd923c415a0a93261be09f4b29a73674bc6188f33afb50130d615643715`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 16.52501678466797 seconds. +- Overall skill 0.350784; relative MASE 0.771331; relative WQL 0.546434. +- term skill: long=0.3855, medium=0.3992, short=0.3171. +- domain skill: Econ/Fin=0.1025, Energy=0.1770, Healthcare=0.3901, Nature=0.4076, Sales=0.3484, Transport=0.4531, Web/CloudOps=0.5016. +- frequency skill: A=0.3699, D=0.3270, H=0.3752, M=0.0777, Q=0.1894, S=0.4382, T=0.3953, W=0.1970. +- variates skill: multivariate=0.3839, univariate=0.3232. +- Outcome: Matched continuation control; primary screen 0.350784. Continuing training. + +## E22 control 6000-step checkpoint +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 15.943427324295044 seconds. +- Overall skill 0.352399; relative MASE 0.769997; relative WQL 0.544661. +- term skill: long=0.3861, medium=0.4001, short=0.3195. +- domain skill: Econ/Fin=0.1064, Energy=0.1818, Healthcare=0.3888, Nature=0.4095, Sales=0.3482, Transport=0.4533, Web/CloudOps=0.5013. +- frequency skill: A=0.3691, D=0.3297, H=0.3767, M=0.0899, Q=0.1951, S=0.4372, T=0.3967, W=0.1945. +- variates skill: multivariate=0.3861, univariate=0.3242. +- Outcome: Screen 0.352399; 869.5 elapsed training-process seconds through this checkpoint on shared single H100. Continuing training. + +## E22 expanded depth 3000-step checkpoint +- Checkpoint SHA-256: `606808eaa8f41a4d8ffd7a336639c197cdb656b462d7b74cda0425a9c7b7ab88`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.74061632156372 seconds. +- Overall skill 0.349903; relative MASE 0.771470; relative WQL 0.547820. +- term skill: long=0.3846, medium=0.3995, short=0.3157. +- domain skill: Econ/Fin=0.1036, Energy=0.1753, Healthcare=0.3821, Nature=0.4103, Sales=0.3478, Transport=0.4524, Web/CloudOps=0.5003. +- frequency skill: A=0.3697, D=0.3271, H=0.3737, M=0.0851, Q=0.1912, S=0.4378, T=0.3939, W=0.1942. +- variates skill: multivariate=0.3823, univariate=0.3229. +- Outcome: Screen 0.349903 versus matched control 0.350784. 768.0 elapsed training-process seconds. Continuing to assess a longer run. + +## E25 learned recency 3000-step checkpoint +- Checkpoint SHA-256: `ff6465dac03192cfc5f8837d8c6ab9524b0fb81c1a73867ff6e08aaf83a53398`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.54782772064209 seconds. +- Overall skill 0.351702; relative MASE 0.770454; relative WQL 0.545509. +- term skill: long=0.3852, medium=0.3988, short=0.3191. +- domain skill: Econ/Fin=0.1014, Energy=0.1767, Healthcare=0.4078, Nature=0.4093, Sales=0.3476, Transport=0.4541, Web/CloudOps=0.5002. +- frequency skill: A=0.3707, D=0.3341, H=0.3745, M=0.0812, Q=0.1898, S=0.4360, T=0.3954, W=0.1980. +- variates skill: multivariate=0.3834, univariate=0.3253. +- Outcome: Screen 0.351702 versus matched control 0.350784. 510.3 elapsed training-process seconds. This is a modest early improvement; further checkpoints and temporal diagnostics remain. + +## E22 control 6000 with centered seasonal template, full validation +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.349953; relative MASE 0.770650; relative WQL 0.548317. +- term skill: long=0.3842, medium=0.3966, short=0.3172. +- domain skill: Econ/Fin=0.1065, Energy=0.1770, Healthcare=0.3987, Nature=0.4093, Sales=0.3570, Transport=0.4567, Web/CloudOps=0.4912. +- frequency skill: A=0.2855, D=0.3349, H=0.3766, M=0.1068, Q=0.1785, S=0.4296, T=0.3905, W=0.1906. +- variates skill: multivariate=0.3802, univariate=0.3248. +- Outcome: Published: full validation 0.349953 versus previous 0.348797, with zero failures. Earlier diagnostics improve to 0.322147 and 0.348634 from 0.321979 and 0.345981. Full inference took 98.8 seconds while four training processes shared the one H100. Repeated relocated example checks passed. Training continues beyond this milestone. + +## E22 control 6000 centered, earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.958669662475586 seconds. +- Overall skill 0.322147; relative MASE 0.812166; relative WQL 0.565752. +- term skill: long=0.3872, medium=0.3503, short=0.2840. +- domain skill: Econ/Fin=0.1531, Energy=0.2205, Healthcare=0.3579, Nature=0.3475, Sales=0.3966, Transport=0.3647, Web/CloudOps=0.4317. +- frequency skill: A=0.3153, D=0.3426, H=0.3545, M=0.1663, Q=0.2129, S=0.3286, T=0.3204, W=0.2542. +- variates skill: multivariate=0.3358, univariate=0.3111. +- Outcome: Small improvement over the preceding package. + +## E22 control 6000 centered, second earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.61665678024292 seconds. +- Overall skill 0.348634; relative MASE 0.779607; relative WQL 0.544220. +- term skill: long=0.3637, medium=0.3753, short=0.3325. +- domain skill: Econ/Fin=0.1024, Energy=0.2199, Healthcare=0.3508, Nature=0.4590, Sales=0.5576, Transport=0.4153, Web/CloudOps=0.4205. +- frequency skill: A=0.3380, D=0.4233, H=0.3833, M=0.1690, Q=0.1387, S=0.2800, T=0.3398, W=0.2426. +- variates skill: multivariate=0.3512, univariate=0.3465. +- Outcome: Improvement over the preceding package. + +## E29: coarse memory of older context (prepared) +Hypothesis: a separately trained memory can extract useful information from points 4,097–16,384 without changing the frozen backbone’s treatment of its recent 4,096 points. Older observations are normalized using the recent window and averaged in groups of four, then encoded by two extra blocks. A zero-output cross-attention projection adds this memory to recent encoder states. Initial function is preserved; recent seasonal and continuity rules remain unchanged. The added embedding and two encoder blocks start from copies of our own trained weights, and the cross-attention output starts at zero. No external weights. Total 44,401,952 parameters; 7,636,992 trainable. Eight-step batch-16 smoke run on allowed packed_sample with seed 67 produced finite weights and updated only the history module. Full training has not started. + +## E30: seasonal amplitude alignment +Hypothesis: four-cycle shape averaging also lags changes in seasonal amplitude. Starting from E24 centered templates, scale their deviations around the mean to the latest cycle standard deviation, correcting both variance estimates for observation noise inferred from seasonal differences. Scale ratio is clipped to [0.5,2], and amplitude alignment requires at least 75% finite observations in the latest cycle. All thresholds, intervals, learned weights and confidence gates remain fixed. Compare centered versus aligned templates on three diagnostic cutoffs using cached E17 raw forecasts; no training or new random seed. + +E30 initial amplitude-alignment results, parent checkpoint SHA-256 0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3: + +screen, 7.7 CPU seconds total: +- (4, 'centered'): skill 0.3531633226160329; group skills {"term": {"short": 0.3207293873053654, "medium": 0.3969450585806461, "long": 0.38964518179731034}, "domain": {"Econ/Fin": 0.12636396756466373, "Energy": 0.1800705780909143, "Healthcare": 0.3992839589819721, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45585497734478375, "Web/CloudOps": 0.5005422814848317}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.19175192579993316, "M": 0.07909511983098594, "W-SUN": 0.042408325150654624, "D": 0.33302767036606196, "H": 0.37896395394765425, "15T": 0.19862358212653608, "W-FRI": -0.03667482636982777, "10T": 0.49458872561779677, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.5067600572208003, "10S": 0.43120160792893125}} +- (4, 'aligned'): skill 0.35398462796791796; group skills {"term": {"short": 0.3217411363550048, "medium": 0.39832598201137914, "long": 0.3894451118078128}, "domain": {"Econ/Fin": 0.128986533479437, "Energy": 0.1846259909517678, "Healthcare": 0.3989632452392111, "Nature": 0.40602447440489264, "Sales": 0.34961552641405835, "Transport": 0.45834957050423264, "Web/CloudOps": 0.4970505147956361}, "freq": {"A-DEC": 0.3672744916070976, "Q-DEC": 0.1913923357266032, "M": 0.07925704481777684, "W-SUN": 0.04248196090218248, "D": 0.332866037279251, "H": 0.38330094783509405, "15T": 0.20143473054459382, "W-FRI": -0.036466297970424444, "10T": 0.49454418004359824, "W-TUE": 0.552193186183172, "W-THU": 0.16944597286444163, "W-WED": 0.3192454708946336, "5T": 0.506404214769247, "10S": 0.4192979394083295}} + +backcast, 8.3 CPU seconds total: +- (4, 'centered'): skill 0.3219793532222529; group skills {"term": {"short": 0.28513766744425706, "medium": 0.34881946541915476, "long": 0.3853894132385529}, "domain": {"Econ/Fin": 0.15718749322076342, "Energy": 0.220305778786681, "Healthcare": 0.3623301744180454, "Nature": 0.34528108993797224, "Sales": 0.3968014140531252, "Transport": 0.3641900819387449, "Web/CloudOps": 0.4312095523303556}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.21945119732749618, "M": 0.17114892410654747, "W-SUN": -0.005425657907346837, "D": 0.3478712397506638, "H": 0.3538545808265424, "15T": 0.22504062323947938, "W-FRI": 0.24955455634324242, "10T": 0.28170410454547445, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.4176757195719526, "10S": 0.32801909847059685}} +- (4, 'aligned'): skill 0.32199923078598136; group skills {"term": {"short": 0.2839405542344856, "medium": 0.34882959423473925, "long": 0.38815021409803896}, "domain": {"Econ/Fin": 0.15740802100053652, "Energy": 0.21807242823144724, "Healthcare": 0.36213507616373974, "Nature": 0.3461350653810715, "Sales": 0.3968014140531252, "Transport": 0.3649195243648111, "Web/CloudOps": 0.4328434979914423}, "freq": {"A-DEC": 0.30258726538887626, "Q-DEC": 0.2183391142623865, "M": 0.1754893176389558, "W-SUN": -0.004377726385369485, "D": 0.3466775300728464, "H": 0.3524837610290207, "15T": 0.2254592175464284, "W-FRI": 0.24954835437149747, "10T": 0.2817431568124176, "W-TUE": 0.5071080326855618, "W-THU": 0.17681316314370377, "W-WED": 0.3400228795320346, "5T": 0.41754999889925704, "10S": 0.3353593007357636}} + +backcast2, 9.4 CPU seconds total: +- (4, 'centered'): skill 0.34598093527842033; group skills {"term": {"short": 0.3300325159298324, "medium": 0.3728154676891604, "long": 0.3603198134443867}, "domain": {"Econ/Fin": 0.10766883532595528, "Energy": 0.21948028584715717, "Healthcare": 0.3411805258187349, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.41219265214646406, "Web/CloudOps": 0.4193348965687418}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14770244416717793, "M": 0.16665926477245963, "W-SUN": 0.05081321100071179, "D": 0.4226895384052014, "H": 0.3801908053318377, "15T": 0.10067740700220107, "W-FRI": 0.10650868616967224, "10T": 0.45281662963561176, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.4517952090885672, "10S": 0.27767832330559383}} +- (4, 'aligned'): skill 0.3467340001955017; group skills {"term": {"short": 0.3300823793890595, "medium": 0.3753689052243039, "long": 0.36094597324048516}, "domain": {"Econ/Fin": 0.10766542601267182, "Energy": 0.22063331078456605, "Healthcare": 0.33410091914860696, "Nature": 0.45181894051147786, "Sales": 0.5552026876860963, "Transport": 0.4141243473009397, "Web/CloudOps": 0.42142071217676347}, "freq": {"A-DEC": 0.33512027886093443, "Q-DEC": 0.14888883016351762, "M": 0.15492673811864788, "W-SUN": 0.05041601533475526, "D": 0.4227650502464607, "H": 0.38160118363487416, "15T": 0.10559542335780892, "W-FRI": 0.10650868616967224, "10T": 0.4528840561650268, "W-TUE": 0.0831470254212826, "W-THU": 0.26812593887733527, "W-WED": 0.5394413576371667, "5T": 0.45189525302575095, "10S": 0.2812440461970862}} + +The new rule improves all three aggregate diagnostics on the E17 weights. A complete package evaluation with the newer E22 control weights is in progress before adoption. + +E29 zero-initialization verification: all 97 screen configurations exactly reproduce the E17 centered runtime skill 0.3531633226160329. Evaluation 21.35 seconds on the shared H100. The eight-step smoke changed the history output projection by 1.4182e-5 maximum while all frozen backbone weights remained bitwise equal and all weights finite. + +## E25 learned recency 6000-step checkpoint +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.591322422027588 seconds. +- Overall skill 0.352851; relative MASE 0.769426; relative WQL 0.544305. +- term skill: long=0.3876, medium=0.3997, short=0.3198. +- domain skill: Econ/Fin=0.1086, Energy=0.1828, Healthcare=0.3943, Nature=0.4120, Sales=0.3475, Transport=0.4545, Web/CloudOps=0.4982. +- frequency skill: A=0.3715, D=0.3323, H=0.3775, M=0.0905, Q=0.1942, S=0.4343, T=0.3965, W=0.1950. +- variates skill: multivariate=0.3855, univariate=0.3256. +- Outcome: Screen 0.352851 versus matched control 0.352399; modest improvement persists. Temporal diagnostics and later checkpoints remain. + +## E30 amplitude aligned template, full validation +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.350837; relative MASE 0.770162; relative WQL 0.547174. +- term skill: long=0.3846, medium=0.3975, short=0.3183. +- domain skill: Econ/Fin=0.1090, Energy=0.1818, Healthcare=0.3984, Nature=0.4093, Sales=0.3570, Transport=0.4592, Web/CloudOps=0.4877. +- frequency skill: A=0.2855, D=0.3348, H=0.3812, M=0.1070, Q=0.1786, S=0.4173, T=0.3911, W=0.1906. +- variates skill: multivariate=0.3791, univariate=0.3274. +- Outcome: Published. With the E22 control 6000-step weights, full validation improves 0.349953 to 0.350837, first earlier diagnostic 0.322147 to 0.322219, and second earlier diagnostic 0.348634 to 0.349310. No failures; deterministic relocated example checks passed. Full inference 96.8 seconds while sharing the one H100 with four training processes. All template changes are fixed formulas; learned parameters remain unchanged. + +## E30 aligned template first earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 20.561070680618286 seconds. +- Overall skill 0.322219; relative MASE 0.811128; relative WQL 0.566355. +- term skill: long=0.3898, medium=0.3504, short=0.2830. +- domain skill: Econ/Fin=0.1533, Energy=0.2182, Healthcare=0.3588, Nature=0.3483, Sales=0.3966, Transport=0.3655, Web/CloudOps=0.4333. +- frequency skill: A=0.3153, D=0.3418, H=0.3532, M=0.1706, Q=0.2117, S=0.3358, T=0.3205, W=0.2543. +- variates skill: multivariate=0.3369, univariate=0.3103. +- Outcome: Small improvement over centered templates. + +## E30 aligned template second earlier diagnostic +- Checkpoint SHA-256: `ae199bb31299e77f3035e227d61bf9b41fa84ae4eb9825f4d5d2bc7aef813934`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.08868408203125 seconds. +- Overall skill 0.349310; relative MASE 0.778190; relative WQL 0.544080. +- term skill: long=0.3643, medium=0.3777, short=0.3325. +- domain skill: Econ/Fin=0.1024, Energy=0.2210, Healthcare=0.3434, Nature=0.4590, Sales=0.5576, Transport=0.4172, Web/CloudOps=0.4224. +- frequency skill: A=0.3380, D=0.4234, H=0.3847, M=0.1568, Q=0.1399, S=0.2828, T=0.3413, W=0.2426. +- variates skill: multivariate=0.3522, univariate=0.3470. +- Outcome: Improvement over centered templates. + +## E28 stronger seasonal loss 3000-step checkpoint +- Checkpoint SHA-256: `a514371332282d8ff1cf42e0c2127683e6bb95bfb98c1a6df6332c604d72c865`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.41924524307251 seconds. +- Overall skill 0.350569; relative MASE 0.771378; relative WQL 0.546763. +- term skill: long=0.3829, medium=0.3988, short=0.3180. +- domain skill: Econ/Fin=0.1028, Energy=0.1748, Healthcare=0.4041, Nature=0.4086, Sales=0.3488, Transport=0.4526, Web/CloudOps=0.4996. +- frequency skill: A=0.3725, D=0.3288, H=0.3734, M=0.0932, Q=0.1901, S=0.4387, T=0.3933, W=0.1988. +- variates skill: multivariate=0.3818, univariate=0.3246. +- Outcome: Screen 0.350569 versus matched control 0.350784. No gain at this checkpoint; continue to 6000 steps before deciding. + +E29 full trial started from the E22 control 6000-step backbone, seed 67, batch 64, 6,000 steps, learning rate 2e-4 with 200-step warmup and cosine decay. Only the 7.64M history-memory parameters train. Batch size is reduced to fit concurrent experiments on the one H100. Context lengths 8,192/16,384 with probabilities 0.4/0.6; horizon mixture remains 32/128/512/1024. Inference uses the current amplitude-aligned seasonal rule on the recent 4,096 points, so the additional history affects only the learned memory. The parent differs from the newly published E25 branch; zero-step evaluation supplies the exact matched control. + +## E25 learned recency 6000 with aligned templates, full validation +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.351407; relative MASE 0.769733; relative WQL 0.546517. +- term skill: long=0.3860, medium=0.3973, short=0.3189. +- domain skill: Econ/Fin=0.1113, Energy=0.1828, Healthcare=0.4050, Nature=0.4118, Sales=0.3571, Transport=0.4604, Web/CloudOps=0.4845. +- frequency skill: A=0.2870, D=0.3384, H=0.3819, M=0.1083, Q=0.1800, S=0.4144, T=0.3909, W=0.1904. +- variates skill: multivariate=0.3786, univariate=0.3289. +- Outcome: Published. Full validation 0.351407 versus preceding 0.350837; earlier diagnostics 0.323269 and 0.350071 versus 0.322219 and 0.349310. No failures; repeated relocated examples are bitwise identical, finite and monotone. Total 36,797,728 parameters. Full inference 96.7 seconds while the one H100 was shared with training. Training continues. + +## E25 recency 6000 aligned first earlier diagnostic +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 20.321524143218994 seconds. +- Overall skill 0.323269; relative MASE 0.809492; relative WQL 0.565744. +- term skill: long=0.3896, medium=0.3509, short=0.2848. +- domain skill: Econ/Fin=0.1588, Energy=0.2200, Healthcare=0.3660, Nature=0.3488, Sales=0.3987, Transport=0.3659, Web/CloudOps=0.4318. +- frequency skill: A=0.3196, D=0.3433, H=0.3536, M=0.1780, Q=0.2165, S=0.3305, T=0.3218, W=0.2570. +- variates skill: multivariate=0.3369, univariate=0.3122. +- Outcome: Improves the matched continued model with the same aligned-template runtime. + +## E25 recency 6000 aligned second earlier diagnostic +- Checkpoint SHA-256: `dbbc4ff247028db1f339846b58c16c74d41a4a7b87e6a834988d95ee04c16734`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.002116203308105 seconds. +- Overall skill 0.350071; relative MASE 0.777410; relative WQL 0.543353. +- term skill: long=0.3631, medium=0.3788, short=0.3338. +- domain skill: Econ/Fin=0.1067, Energy=0.2234, Healthcare=0.3529, Nature=0.4590, Sales=0.5596, Transport=0.4165, Web/CloudOps=0.4198. +- frequency skill: A=0.3409, D=0.4269, H=0.3856, M=0.1584, Q=0.1427, S=0.2730, T=0.3428, W=0.2398. +- variates skill: multivariate=0.3525, univariate=0.3481. +- Outcome: Improves the matched continued model with the same aligned-template runtime. + +E22 depth trial pruned after two matched comparisons: 3000-step skill 0.349903 versus control 0.350784, and 6000-step skill 0.351873 versus control 0.352399. The 6000-step checkpoint cost 1961.8 elapsed training-process seconds, versus 869.5 for the control under different shared-GPU contention. The planned 24,000 steps were not completed. This establishes no benefit at the tested budgets, not that greater depth can never help. Saved checkpoints remain available. Stop receipt: [{"pid": 4519, "kind": "training", "elapsed_seconds": 2108}, {"pid": 4914, "kind": "watcher", "elapsed_seconds": 1723}]. + +## E22 expanded depth 6000-step checkpoint +- Checkpoint SHA-256: `a1efd06cff13f7f47559d83d37ea63f6bc65692df49fd2bfe039502d33978632`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.713934898376465 seconds. +- Overall skill 0.351873; relative MASE 0.770476; relative WQL 0.545206. +- term skill: long=0.3864, medium=0.4005, short=0.3182. +- domain skill: Econ/Fin=0.1070, Energy=0.1815, Healthcare=0.3779, Nature=0.4133, Sales=0.3487, Transport=0.4524, Web/CloudOps=0.4999. +- frequency skill: A=0.3690, D=0.3292, H=0.3764, M=0.0873, Q=0.1951, S=0.4370, T=0.3963, W=0.1928. +- variates skill: multivariate=0.3859, univariate=0.3234. +- Outcome: Below the matched 36.8M control for the second comparison. Stop this trial and retain its checkpoints; prioritize the smaller learned-feature and history-memory experiments on one H100. + +## E31: stochastic seasonal amplitude in synthetic pretraining (prepared) +Hypothesis: the original generator has constant Fourier amplitudes, whereas the added recency features describe changing amplitudes. Modulate the seasonal component in half of synthetic draws by a positive AR log-amplitude with time constant 100–10,000, stationary log standard deviation 0.05–0.4 and log-value clipping [-2,2]. The modulation is applied before trends, observation noise, missing values and intermittence. A separate RNG seed = main seed + 100003 preserves all source selection, corpus windows, horizon/context choices and original generator random draws relative to E25. Planned seed 59 and E17 initialization allow comparison with existing E25 checkpoints without retraining a control. No training started yet. + +## E29 history memory 1000-step checkpoint +- Checkpoint SHA-256: `a3bdc3a7525ed869d48fc1ce2b54785bb82aa64573e3b3d8a0de98df10680af3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.969539165496826 seconds. +- Overall skill 0.355846; relative MASE 0.766420; relative WQL 0.541393. +- term skill: long=0.3920, medium=0.3994, short=0.3237. +- domain skill: Econ/Fin=0.1304, Energy=0.1908, Healthcare=0.3939, Nature=0.4095, Sales=0.3479, Transport=0.4592, Web/CloudOps=0.4963. +- frequency skill: A=0.3691, D=0.3317, H=0.3867, M=0.0892, Q=0.1952, S=0.4178, T=0.4001, W=0.1953. +- variates skill: multivariate=0.3846, univariate=0.3320. +- Outcome: Improves the matched zero-step screen score 0.354979. Elapsed training-process time 104.3 seconds on the shared single H100. Temporal diagnostics determine whether the gain transfers across cutoffs. + +## E29 history memory 3000-step checkpoint +- Checkpoint SHA-256: `81b1e8dfae60e87a20a2f0ff6d3464a608c8b86624cfc3383ca29441e9f1fd92`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.785941123962402 seconds. +- Overall skill 0.356376; relative MASE 0.765914; relative WQL 0.540860. +- term skill: long=0.3932, medium=0.3995, short=0.3240. +- domain skill: Econ/Fin=0.1306, Energy=0.1923, Healthcare=0.3934, Nature=0.4102, Sales=0.3479, Transport=0.4591, Web/CloudOps=0.4965. +- frequency skill: A=0.3691, D=0.3318, H=0.3878, M=0.0892, Q=0.1952, S=0.4179, T=0.4005, W=0.1953. +- variates skill: multivariate=0.3854, univariate=0.3323. +- Outcome: Improves the matched zero-step screen score 0.354979. Elapsed training-process time 283.3 seconds on the shared single H100. Temporal diagnostics determine whether the gain transfers across cutoffs. + +E31 training started: seed 59, batch 256, 24,000-step schedule, learning rate 8e-5, E17 initialization, same query-feature architecture as E25. Tests verified that all corpus-only rows are identical to E25 and that the main RNG states remain identical after both corpus-only and synthetic-only batches; 11 of 32 synthetic test rows changed. The independent modulation stream is seed 100062. Evaluate at 3000/6000 steps before extending this trial. + +## E22 control 12000 with aligned templates, full validation +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.355096; relative MASE 0.766848; relative WQL 0.542351. +- term skill: long=0.3891, medium=0.3999, short=0.3233. +- domain skill: Econ/Fin=0.1147, Energy=0.1853, Healthcare=0.3958, Nature=0.4163, Sales=0.3582, Transport=0.4612, Web/CloudOps=0.4938. +- frequency skill: A=0.2887, D=0.3392, H=0.3848, M=0.1131, Q=0.1870, S=0.4202, T=0.3967, W=0.1906. +- variates skill: multivariate=0.3845, univariate=0.3307. +- Outcome: Published. Full validation 0.355096 versus preceding E25-6000 package 0.351407, first earlier diagnostic 0.325963 versus 0.323269, and second earlier diagnostic 0.352462 versus 0.350071. No failures; repeated relocated examples are bitwise identical, finite and monotone. Full inference 98.8 seconds under shared H100 contention. The matched E25-12000 checkpoint is still training. + +## E22 control12000 aligned first earlier diagnostic +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.49058723449707 seconds. +- Overall skill 0.325963; relative MASE 0.809373; relative WQL 0.561330. +- term skill: long=0.3895, medium=0.3521, short=0.2893. +- domain skill: Econ/Fin=0.1619, Energy=0.2209, Healthcare=0.3713, Nature=0.3541, Sales=0.3962, Transport=0.3666, Web/CloudOps=0.4365. +- frequency skill: A=0.3123, D=0.3490, H=0.3551, M=0.1691, Q=0.2293, S=0.3380, T=0.3258, W=0.2557. +- variates skill: multivariate=0.3406, univariate=0.3141. +- Outcome: Improves the preceding package. + +## E22 control12000 aligned second earlier diagnostic +- Checkpoint SHA-256: `69e01d3fbc013287a1e63346e7cefbbe82acfb98f7d446459d52c931515bd8a8`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.788399934768677 seconds. +- Overall skill 0.352462; relative MASE 0.775936; relative WQL 0.540386. +- term skill: long=0.3649, medium=0.3793, short=0.3372. +- domain skill: Econ/Fin=0.1068, Energy=0.2227, Healthcare=0.3661, Nature=0.4623, Sales=0.5608, Transport=0.4167, Web/CloudOps=0.4248. +- frequency skill: A=0.3383, D=0.4276, H=0.3860, M=0.1616, Q=0.1520, S=0.2793, T=0.3458, W=0.2493. +- variates skill: multivariate=0.3545, univariate=0.3508. +- Outcome: Improves the preceding package. + +## E32: transfer the learned history memory to the improved backbone +Hypothesis: the frozen history memory learns useful features that remain compatible with a later continuation of the same backbone architecture. Combine E29 history-memory tensors at 6000 steps with every backbone tensor from E22 control at 12000 steps. This is a deterministic combination of our own trained assets, with no new training and no external weights. Both parent checkpoint hashes and full training lineages are retained. The publication utility now traverses both parent branches and declares all their sources and generator seeds. Compare to the E22-12000 aligned-template runtime across three cutoffs before adoption. + +## E29 history memory 6000-step screen +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 43.3264684677124 seconds. +- Overall skill 0.357127; relative MASE 0.765099; relative WQL 0.540174. +- term skill: long=0.3941, medium=0.3993, short=0.3251. +- domain skill: Econ/Fin=0.1303, Energy=0.1925, Healthcare=0.3999, Nature=0.4104, Sales=0.3479, Transport=0.4597, Web/CloudOps=0.4973. +- frequency skill: A=0.3691, D=0.3342, H=0.3893, M=0.0892, Q=0.1952, S=0.4179, T=0.4002, W=0.1953. +- variates skill: multivariate=0.3861, univariate=0.3331. +- Outcome: Screen 0.357127 versus zero-step 0.354979. Training completed in 531.4 process seconds on the shared single H100. First earlier diagnostic regresses while the second improves; do not publish standalone without broader evidence. + +## E29 history memory first earlier diagnostic +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.55209970474243 seconds. +- Overall skill 0.321189; relative MASE 0.812469; relative WQL 0.567141. +- term skill: long=0.3883, medium=0.3470, short=0.2831. +- domain skill: Econ/Fin=0.1541, Energy=0.2165, Healthcare=0.3555, Nature=0.3461, Sales=0.3966, Transport=0.3649, Web/CloudOps=0.4336. +- frequency skill: A=0.3153, D=0.3408, H=0.3550, M=0.1706, Q=0.2117, S=0.3336, T=0.3162, W=0.2543. +- variates skill: multivariate=0.3353, univariate=0.3098. +- Outcome: Regresses from the matched parent 0.322219 to 0.321189. + +## E29 history memory second earlier diagnostic +- Checkpoint SHA-256: `5c3b98e648e31f0d2aa61a150700be8147ba2638c975510fc15bdb311531cf43`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.82407259941101 seconds. +- Overall skill 0.350315; relative MASE 0.776760; relative WQL 0.543398. +- term skill: long=0.3664, medium=0.3780, short=0.3334. +- domain skill: Econ/Fin=0.1037, Energy=0.2222, Healthcare=0.3446, Nature=0.4601, Sales=0.5576, Transport=0.4171, Web/CloudOps=0.4239. +- frequency skill: A=0.3380, D=0.4241, H=0.3857, M=0.1568, Q=0.1399, S=0.2820, T=0.3431, W=0.2426. +- variates skill: multivariate=0.3544, univariate=0.3470. +- Outcome: Improves from the matched parent 0.349310 to 0.350315. + +## E28 stronger seasonal loss 6000-step checkpoint +- Checkpoint SHA-256: `6208c74c3a6902d0410708741fd3ee609649e28732e5d5ee2696169685768e9b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 19.053489208221436 seconds. +- Overall skill 0.352533; relative MASE 0.769384; relative WQL 0.544869. +- term skill: long=0.3857, medium=0.3986, short=0.3205. +- domain skill: Econ/Fin=0.1093, Energy=0.1807, Healthcare=0.4083, Nature=0.4098, Sales=0.3497, Transport=0.4525, Web/CloudOps=0.4985. +- frequency skill: A=0.3742, D=0.3386, H=0.3743, M=0.0874, Q=0.1946, S=0.4388, T=0.3951, W=0.1953. +- variates skill: multivariate=0.3844, univariate=0.3260. +- Outcome: Screen 0.352533 versus matched control 0.352399; first earlier diagnostic 0.322419 versus control 0.322598. Differences are small and inconsistent; continue to the 12000-step comparison. Training time through 6000: 1375.1 process seconds. + +## E22 pruned depth model earlier diagnostic +- Checkpoint SHA-256: `a1efd06cff13f7f47559d83d37ea63f6bc65692df49fd2bfe039502d33978632`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 29.58867907524109 seconds. +- Overall skill 0.322537; relative MASE 0.811436; relative WQL 0.565609. +- term skill: long=0.3876, medium=0.3519, short=0.2839. +- domain skill: Econ/Fin=0.1430, Energy=0.2205, Healthcare=0.3835, Nature=0.3473, Sales=0.3985, Transport=0.3592, Web/CloudOps=0.4331. +- frequency skill: A=0.3156, D=0.3515, H=0.3521, M=0.1655, Q=0.2142, S=0.3417, T=0.3184, W=0.2490. +- variates skill: multivariate=0.3364, univariate=0.3113. +- Outcome: Score 0.322537 versus matched control 0.322598, confirming no useful advantage in the tested budgets. + +## E33: global quantile ensemble of the newer backbone and transferred memory +Hypothesis: averaging the unmodified E22-12000 forecasts with E32 reduces the history memory’s temporal instability. Compare fixed backbone weights 0.25/0.5/0.75, with the complementary weight on the memory model, across all three diagnostics. Both members must forecast every instance in any deployed package. This is a cached-output diagnostic first, with no training or per-dataset choice. Actual package inference and full validation remain required before publication. + +## E32 transferred history memory screen +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.279379844665527 seconds. +- Overall skill 0.361285; relative MASE 0.762270; relative WQL 0.535186. +- term skill: long=0.3979, medium=0.4009, short=0.3306. +- domain skill: Econ/Fin=0.1354, Energy=0.1960, Healthcare=0.4004, Nature=0.4175, Sales=0.3496, Transport=0.4614, Web/CloudOps=0.5026. +- frequency skill: A=0.3746, D=0.3390, H=0.3931, M=0.0951, Q=0.1983, S=0.4210, T=0.4049, W=0.1967. +- variates skill: multivariate=0.3911, univariate=0.3365. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +## E32 transferred history memory first earlier +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.01271629333496 seconds. +- Overall skill 0.324581; relative MASE 0.811091; relative WQL 0.562442. +- term skill: long=0.3866, medium=0.3491, short=0.2893. +- domain skill: Econ/Fin=0.1617, Energy=0.2185, Healthcare=0.3678, Nature=0.3513, Sales=0.3962, Transport=0.3659, Web/CloudOps=0.4368. +- frequency skill: A=0.3123, D=0.3475, H=0.3561, M=0.1691, Q=0.2293, S=0.3357, T=0.3214, W=0.2557. +- variates skill: multivariate=0.3385, univariate=0.3133. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +## E32 transferred history memory second earlier +- Checkpoint SHA-256: `c5a6d1fa7f637f2fa36f9176d66f39a71f8f3c8c84fef8098ec03a88a59f68e7`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.5328631401062 seconds. +- Overall skill 0.352606; relative MASE 0.775583; relative WQL 0.540391. +- term skill: long=0.3677, medium=0.3779, short=0.3370. +- domain skill: Econ/Fin=0.1079, Energy=0.2224, Healthcare=0.3668, Nature=0.4615, Sales=0.5608, Transport=0.4165, Web/CloudOps=0.4263. +- frequency skill: A=0.3383, D=0.4283, H=0.3855, M=0.1616, Q=0.1520, S=0.2804, T=0.3462, W=0.2493. +- variates skill: multivariate=0.3553, univariate=0.3504. +- Outcome: Main-screen gain persists on the newer backbone, but the first earlier diagnostic remains below its matched control. Not published standalone. + +E33 cached ensemble results. Neither member required new training. Backbone weights 0.25/0.5/0.75 apply globally to every instance; complementary weight is on E32. All tested mixtures retain a small first-earlier-cutoff regression. No ensemble is published yet; the simpler backbone continuations are still improving. +- screen, base weight 0.25: skill 0.3609597107729168; elapsed 31.589441299438477 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7485062013261629, "rel_wql_gmean": 0.48497053192140965}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7187220659985801, "rel_wql_gmean": 0.49872959388387217}, "short": {"n_configs": 55, "rel_mase_gmean": 0.7854775479522941, "rel_wql_gmean": 0.5715754588019885}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8766794111084217, "rel_wql_gmean": 0.8521904674160014}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9458381742339477, "rel_wql_gmean": 0.6841214470602749}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6357518097122528, "rel_wql_gmean": 0.5708050606184818}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8296139742081163, "rel_wql_gmean": 0.40898901267743815}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.8283216000359614, "rel_wql_gmean": 0.510813353500822}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6491485866452709, "rel_wql_gmean": 0.4469444592152844}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.564775788716386, "rel_wql_gmean": 0.4386209893190716}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6092189862308618, "rel_wql_gmean": 0.6444119562488515}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7923969772018941, "rel_wql_gmean": 0.5529928138595462}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7344815207835862, "rel_wql_gmean": 0.502366984331498}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9818087731317099, "rel_wql_gmean": 0.8332936324629011}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7734447483921444, "rel_wql_gmean": 0.8291183442517216}, "S": {"n_configs": 6, "rel_mase_gmean": 0.662205210700223, "rel_wql_gmean": 0.5065947056042907}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7321702800096546, "rel_wql_gmean": 0.4836230433794967}, "W": {"n_configs": 8, "rel_mase_gmean": 0.9308497588724332, "rel_wql_gmean": 0.6931956959471695}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.7176036435313308, "rel_wql_gmean": 0.5172069567399432}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.800284652420953, "rel_wql_gmean": 0.5506355529979893}}} +- screen, base weight 0.5: skill 0.36051700538130327; elapsed 1.6923091411590576 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7491443694259866, "rel_wql_gmean": 0.48552116951145263}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.717943946501363, "rel_wql_gmean": 0.49885742655549165}, "short": {"n_configs": 55, "rel_mase_gmean": 0.7862261945539069, "rel_wql_gmean": 0.572174296426093}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8767314570553127, "rel_wql_gmean": 0.8518426772129285}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9464868100785462, "rel_wql_gmean": 0.6847020626617584}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6391927294627128, "rel_wql_gmean": 0.5728774819722747}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8288486290328975, "rel_wql_gmean": 0.4095777628918776}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.828359895013336, "rel_wql_gmean": 0.5108331535102516}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6492097960109925, "rel_wql_gmean": 0.44703510569395916}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.5650725913141991, "rel_wql_gmean": 0.43904253902223594}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6107048585981317, "rel_wql_gmean": 0.6453081988530746}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7937577174837149, "rel_wql_gmean": 0.5536527716998109}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7349129886012886, "rel_wql_gmean": 0.5033244078192418}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9816729369571708, "rel_wql_gmean": 0.83284954955612}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7729642350253297, "rel_wql_gmean": 0.8282079386900584}, "S": {"n_configs": 6, "rel_mase_gmean": 0.6624714487276662, "rel_wql_gmean": 0.5067064419332115}, "T": {"n_configs": 30, "rel_mase_gmean": 0.732172046143732, "rel_wql_gmean": 0.4837994768895142}, "W": {"n_configs": 8, "rel_mase_gmean": 0.930849298960232, "rel_wql_gmean": 0.6931955559830537}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.717793296521423, "rel_wql_gmean": 0.5179713349770367}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8008210552601016, "rel_wql_gmean": 0.5508732181941426}}} +- screen, base weight 0.75: skill 0.3599500839851063; elapsed 1.4231245517730713 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.750042489425022, "rel_wql_gmean": 0.48623104748726004}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7173897864210821, "rel_wql_gmean": 0.4991516788000004}, "short": {"n_configs": 55, "rel_mase_gmean": 0.78703598003334, "rel_wql_gmean": 0.5728330044823371}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8768876674480677, "rel_wql_gmean": 0.8515997053654789}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9473562016160542, "rel_wql_gmean": 0.6855548779843715}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.642561102977203, "rel_wql_gmean": 0.5749859696863521}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.8285232450849535, "rel_wql_gmean": 0.4102456883415478}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.8284086809446388, "rel_wql_gmean": 0.5108547074028001}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.6493066620546145, "rel_wql_gmean": 0.44715612803391697}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.5654188677782281, "rel_wql_gmean": 0.4395078746093791}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.6122299433463864, "rel_wql_gmean": 0.6462324836335608}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7950974689907988, "rel_wql_gmean": 0.5543319910897211}, "H": {"n_configs": 31, "rel_mase_gmean": 0.735615332675693, "rel_wql_gmean": 0.5044620646385107}, "M": {"n_configs": 5, "rel_mase_gmean": 0.9815783490405571, "rel_wql_gmean": 0.832453381029195}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7726561980040161, "rel_wql_gmean": 0.8274692503440843}, "S": {"n_configs": 6, "rel_mase_gmean": 0.6627478709382408, "rel_wql_gmean": 0.5068543440740843}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7323316854508894, "rel_wql_gmean": 0.4840907541003884}, "W": {"n_configs": 8, "rel_mase_gmean": 0.9308491431521891, "rel_wql_gmean": 0.6931954208513348}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.7182293746317306, "rel_wql_gmean": 0.5189159515589695}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8014062938450294, "rel_wql_gmean": 0.5511589238591919}}} +- backcast, base weight 0.25: skill 0.32516390659459127; elapsed 25.728330373764038 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7877573688004119, "rel_wql_gmean": 0.4757505244331779}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7777646324659491, "rel_wql_gmean": 0.5427449141803178}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8320626409877416, "rel_wql_gmean": 0.6069233027764227}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731645869233648, "rel_wql_gmean": 0.8046317212772931}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9000885899955989, "rel_wql_gmean": 0.6764463826118567}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6763673902063786, "rel_wql_gmean": 0.5893498915999001}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9498042213778831, "rel_wql_gmean": 0.44171639005646535}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.7449699119735571, "rel_wql_gmean": 0.5393127533664154}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755793289890412, "rel_wql_gmean": 0.4696226318380198}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8480816283629858, "rel_wql_gmean": 0.5013822816935581}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7872906478235149, "rel_wql_gmean": 0.5262643957494131}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8611665698543136, "rel_wql_gmean": 0.5114505986034271}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7774300159704559, "rel_wql_gmean": 0.5898942963102115}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8054278932888852, "rel_wql_gmean": 0.5417010935787644}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8142697614393413, "rel_wql_gmean": 0.5786920991268066}}} +- backcast, base weight 0.5: skill 0.3255906425540577; elapsed 7.025062561035156 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7868531100085023, "rel_wql_gmean": 0.47494194797983313}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7767176724724971, "rel_wql_gmean": 0.5419949281040547}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8318845792654018, "rel_wql_gmean": 0.606991975463184}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731690390439605, "rel_wql_gmean": 0.8045484945388448}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.8993476870381677, "rel_wql_gmean": 0.6755669234996251}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6753662260274707, "rel_wql_gmean": 0.5885861458424224}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9483032085189914, "rel_wql_gmean": 0.441350380267718}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.7446948865024733, "rel_wql_gmean": 0.5392154113246899}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755391890283506, "rel_wql_gmean": 0.469748030722515}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8475410369158077, "rel_wql_gmean": 0.5011421156521402}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7875436876281503, "rel_wql_gmean": 0.5262880067026078}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8607773505813321, "rel_wql_gmean": 0.5107840537486803}, "T": {"n_configs": 30, "rel_mase_gmean": 0.7758285204666452, "rel_wql_gmean": 0.5890117516972101}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8047280897548712, "rel_wql_gmean": 0.5410867356076619}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8138657265706295, "rel_wql_gmean": 0.5785877053648649}}} +- backcast, base weight 0.75: skill 0.32585558132181525; elapsed 1.4801208972930908 CPU seconds; groups {"term": {"long": {"n_configs": 21, "rel_mase_gmean": 0.7864118030472989, "rel_wql_gmean": 0.47433966987370835}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7760856247602924, "rel_wql_gmean": 0.541419709057465}, "short": {"n_configs": 55, "rel_mase_gmean": 0.8317549187410698, "rel_wql_gmean": 0.6071042148592315}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8731809073153128, "rel_wql_gmean": 0.8044818649657144}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.8991776752660365, "rel_wql_gmean": 0.6750015559883032}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6743591342425898, "rel_wql_gmean": 0.5878184243392145}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.9471433052106504, "rel_wql_gmean": 0.4410648488568812}, "Sales": {"n_configs": 4, "rel_mase_gmean": 0.7353166304138659, "rel_wql_gmean": 0.495785420303292}, "Transport": {"n_configs": 15, "rel_mase_gmean": 0.744443044974495, "rel_wql_gmean": 0.5391442286013897}, "Web/CloudOps": {"n_configs": 20, "rel_mase_gmean": 0.6755193180086204, "rel_wql_gmean": 0.46990600477296696}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.651838123897038, "rel_wql_gmean": 0.7256129506047462}, "D": {"n_configs": 15, "rel_mase_gmean": 0.8470002930114933, "rel_wql_gmean": 0.5009052086170435}, "H": {"n_configs": 31, "rel_mase_gmean": 0.7882647172004155, "rel_wql_gmean": 0.5264910423859007}, "M": {"n_configs": 5, "rel_mase_gmean": 0.867272967035772, "rel_wql_gmean": 0.7959646950903766}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.7634980658181472, "rel_wql_gmean": 0.7778879435047819}, "S": {"n_configs": 6, "rel_mase_gmean": 0.8604064218762162, "rel_wql_gmean": 0.5101551146076984}, "T": {"n_configs": 30, "rel_mase_gmean": 0.774442079728573, "rel_wql_gmean": 0.5883004763096262}, "W": {"n_configs": 8, "rel_mase_gmean": 0.921455165311994, "rel_wql_gmean": 0.6011456983078217}}, "variates": {"multivariate": {"n_configs": 43, "rel_mase_gmean": 0.8044577867215783, "rel_wql_gmean": 0.5406785466562373}, "univariate": {"n_configs": 54, "rel_mase_gmean": 0.8135190933822734, "rel_wql_gmean": 0.5785199260327762}}} +- backcast2, base weight 0.25: skill 0.35287154434047796; elapsed 32.718568563461304 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.7953937401265897, "rel_wql_gmean": 0.5030106493089533}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7678643593783896, "rel_wql_gmean": 0.5028055430553253}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7711270557942318, "rel_wql_gmean": 0.5695813024863108}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8805482364783594, "rel_wql_gmean": 0.9042209924611244}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9117289903338895, "rel_wql_gmean": 0.6620020860753241}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6839866145665877, "rel_wql_gmean": 0.5864976160474622}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7748252117778318, "rel_wql_gmean": 0.3733068662798137}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.6725766506204502, "rel_wql_gmean": 0.5061420572217049}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6870083960785978, "rel_wql_gmean": 0.4794994231705838}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7299533930809837, "rel_wql_gmean": 0.4479740157977664}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7604275957811419, "rel_wql_gmean": 0.4953118153144008}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9122753788008492, "rel_wql_gmean": 0.5679295721865012}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7657639848982667, "rel_wql_gmean": 0.5579672183603664}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7902445203946336, "rel_wql_gmean": 0.5253027568920817}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7633236727962595, "rel_wql_gmean": 0.5525218103974238}}} +- backcast2, base weight 0.5: skill 0.35293362223391267; elapsed 1.2891087532043457 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.795490811324907, "rel_wql_gmean": 0.5038189345476245}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7674326315874551, "rel_wql_gmean": 0.5023119643797436}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7711829671563578, "rel_wql_gmean": 0.5693457082014003}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.8808378054392396, "rel_wql_gmean": 0.9044589957290904}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9113735276107076, "rel_wql_gmean": 0.6617472008949459}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6842243004747667, "rel_wql_gmean": 0.5865985548061023}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7748130011917327, "rel_wql_gmean": 0.37282859138217267}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.6724189210776539, "rel_wql_gmean": 0.5061490326925873}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6872511298933153, "rel_wql_gmean": 0.47991505019019964}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.7301681468376378, "rel_wql_gmean": 0.4481185117970856}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7599867700948899, "rel_wql_gmean": 0.49504239452481336}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9125454167444352, "rel_wql_gmean": 0.5681445429462755}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7659127026855528, "rel_wql_gmean": 0.5579048015053354}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7903908108689007, "rel_wql_gmean": 0.5252368408110905}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7631277150357363, "rel_wql_gmean": 0.5524454383766455}}} +- backcast2, base weight 0.75: skill 0.35279424558075034; elapsed 1.3640234470367432 CPU seconds; groups {"term": {"long": {"n_configs": 19, "rel_mase_gmean": 0.7960013691972241, "rel_wql_gmean": 0.5048538794748333}, "medium": {"n_configs": 21, "rel_mase_gmean": 0.7673586435302413, "rel_wql_gmean": 0.5020153819167671}, "short": {"n_configs": 54, "rel_mase_gmean": 0.7714553413789935, "rel_wql_gmean": 0.5691840862467166}}, "domain": {"Econ/Fin": {"n_configs": 6, "rel_mase_gmean": 0.881145657719554, "rel_wql_gmean": 0.9047199305925011}, "Energy": {"n_configs": 32, "rel_mase_gmean": 0.9115950570456508, "rel_wql_gmean": 0.6618010993808187}, "Healthcare": {"n_configs": 5, "rel_mase_gmean": 0.6844817312954508, "rel_wql_gmean": 0.5867080808867043}, "Nature": {"n_configs": 15, "rel_mase_gmean": 0.7754005359113609, "rel_wql_gmean": 0.3724980616976047}, "Sales": {"n_configs": 3, "rel_mase_gmean": 0.5489740065972382, "rel_wql_gmean": 0.3513233844778427}, "Transport": {"n_configs": 14, "rel_mase_gmean": 0.672286131185056, "rel_wql_gmean": 0.506183419259456}, "Web/CloudOps": {"n_configs": 19, "rel_mase_gmean": 0.6875722190026725, "rel_wql_gmean": 0.48037847185063465}}, "frequency": {"A": {"n_configs": 1, "rel_mase_gmean": 0.5819327138083403, "rel_wql_gmean": 0.7523849571908706}, "D": {"n_configs": 15, "rel_mase_gmean": 0.730395963063022, "rel_wql_gmean": 0.4482700955304752}, "H": {"n_configs": 30, "rel_mase_gmean": 0.7602248518219639, "rel_wql_gmean": 0.4950255629831832}, "M": {"n_configs": 4, "rel_mase_gmean": 0.8158365215321529, "rel_wql_gmean": 0.8615342594759124}, "Q": {"n_configs": 1, "rel_mase_gmean": 0.8252565936089924, "rel_wql_gmean": 0.8713357271735944}, "S": {"n_configs": 6, "rel_mase_gmean": 0.9128726300303336, "rel_wql_gmean": 0.5684332751933325}, "T": {"n_configs": 29, "rel_mase_gmean": 0.7662563237934747, "rel_wql_gmean": 0.5579847239947101}, "W": {"n_configs": 8, "rel_mase_gmean": 0.8655383325021186, "rel_wql_gmean": 0.6510826830966135}}, "variates": {"multivariate": {"n_configs": 42, "rel_mase_gmean": 0.7911061856256687, "rel_wql_gmean": 0.5254140703891469}, "univariate": {"n_configs": 52, "rel_mase_gmean": 0.7629991415479856, "rel_wql_gmean": 0.5524144817860636}}} + +## E34: multivariate attention with end-to-end pretraining and univariate rehearsal +Hypothesis: E20’s frozen backbone could not fully learn how to interpret cross-channel signals. Start from E22 control at 12000, add the same zero-output cross-variable attention layer, and train all 37,816,096 parameters. Three quarters of batches use the original 95-source univariate sampler, batch 128; one quarter use synchronized multivariate records, 32 groups with 2/3/4/8 channels. Six thousand steps, learning rate 4e-5 with 200-step warmup and cosine decay; main seed 73, independent joint-sampler seed 10073. Use only packed_sample and packed_joint and their local generators. This changes the training mixture and trainable parameter set together; it is a candidate method comparison, not a claim that either factor alone causes any gain. Zero-step output is the matched inference control. No validation observations enter gradients. + +## E25 learned recency 12000 with aligned templates, full validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.355628; relative MASE 0.765858; relative WQL 0.542156. +- term skill: long=0.3899, medium=0.4001, short=0.3239. +- domain skill: Econ/Fin=0.1162, Energy=0.1854, Healthcare=0.4030, Nature=0.4169, Sales=0.3571, Transport=0.4622, Web/CloudOps=0.4930. +- frequency skill: A=0.2912, D=0.3393, H=0.3859, M=0.1107, Q=0.1840, S=0.4221, T=0.3964, W=0.1942. +- variates skill: multivariate=0.3851, univariate=0.3311. +- Outcome: Published. Full validation 0.355628 versus matched E22-12000 package 0.355096; earlier diagnostics 0.327844 and 0.354561 versus 0.325963 and 0.352462. No failures. Repeated relocated examples are bitwise identical, finite and monotone. This extends the recency-feature benefit to a third matched training checkpoint. + +## E25 recency12000 first earlier diagnostic +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.109707355499268 seconds. +- Overall skill 0.327844; relative MASE 0.806911; relative WQL 0.559904. +- term skill: long=0.3932, medium=0.3529, short=0.2909. +- domain skill: Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- frequency skill: A=0.3134, D=0.3502, H=0.3567, M=0.1636, Q=0.2250, S=0.3402, T=0.3276, W=0.2656. +- variates skill: multivariate=0.3437, univariate=0.3150. +- Outcome: Improves the matched control. + +## E25 recency12000 second earlier diagnostic +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.91800332069397 seconds. +- Overall skill 0.354561; relative MASE 0.773267; relative WQL 0.538742. +- term skill: long=0.3642, medium=0.3828, short=0.3397. +- domain skill: Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- frequency skill: A=0.3385, D=0.4319, H=0.3875, M=0.1660, Q=0.1478, S=0.2841, T=0.3480, W=0.2461. +- variates skill: multivariate=0.3588, univariate=0.3511. +- Outcome: Improves the matched control. + +Measured continuation compute (elapsed training-process seconds, shared single H100; these are not additive dedicated GPU-seconds): +- depth36_control, step 1000: 124.8 seconds. +- depth36_control, step 3000: 365.5 seconds. +- depth36_control, step 6000: 869.5 seconds. +- depth36_control, step 12000: 2211.3 seconds. +- recency_features, step 1000: 168.9 seconds. +- recency_features, step 3000: 510.3 seconds. +- recency_features, step 6000: 1158.7 seconds. +- recency_features, step 12000: 2481.6 seconds. +- strong_loss, step 1000: 224.1 seconds. +- strong_loss, step 3000: 672.8 seconds. +- strong_loss, step 6000: 1375.1 seconds. +- amplitude_synth, step 1000: 227.1 seconds. +- amplitude_synth, step 3000: 678.7 seconds. +- joint_rehearsal, step 1000: 172.6 seconds. + +## E35: explicit local trend increments in future queries (prepared) +Hypothesis: the original damped trend feature clips normalized slopes at 0.03 per step, suppressing trends in short annual and quarterly contexts. Add two zero-initialized query features from differences of adjacent 4-point and 16-point means, extrapolated to each future step and softly capped at 3 context standard deviations. Each mean needs at least half its observations and at least two finite values. This is a fixed context calculation, not a fitted per-instance model. A separate 16,384-parameter query projection preserves the existing recency projection and all pretrained-in-this-workspace tensors. Planned E17 initialization, seed 59, batch 256 and 24,000-step schedule match E25 exactly; no new synthetic generator. Training not yet started. + +E28 stopped after the 12000-step comparison. Screen 0.355930 is below matched control 0.356664; earlier checkpoints gave small inconsistent differences. Training through 12000 took 2731.8 process seconds on the shared H100. Checkpoints are retained, but the stronger seasonal-error weighting is not adopted. + +## E28 stronger seasonal loss 12000-step checkpoint +- Checkpoint SHA-256: `9f67f75960a568c9bc42fdb2ec99c8852bb5136ae869b7f63ac3fd6aeb359aab`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.34673237800598 seconds. +- Overall skill 0.355930; relative MASE 0.766619; relative WQL 0.541111. +- term skill: long=0.3886, medium=0.4019, short=0.3241. +- domain skill: Econ/Fin=0.1123, Energy=0.1843, Healthcare=0.4078, Nature=0.4143, Sales=0.3492, Transport=0.4532, Web/CloudOps=0.5040. +- frequency skill: A=0.3801, D=0.3350, H=0.3784, M=0.1213, Q=0.1929, S=0.4399, T=0.3989, W=0.1948. +- variates skill: multivariate=0.3880, univariate=0.3292. +- Outcome: Below matched control; stop this branch after three comparisons without a consistent advantage. + +E35 training started with the planned matched seed 59, batch 256, learning rate 8e-5 and 24000-step schedule, replacing E28 GPU work. A synthetic forward check verified bitwise equality at zero projection, and backward propagation produced finite nonzero gradients for the new trend projection. No additional training source or generator is introduced. + +## E31 synthetic amplitude 3000-step screen +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.430498361587524 seconds. +- Overall skill 0.352625; relative MASE 0.768870; relative WQL 0.545079. +- term skill: long=0.3854, medium=0.3995, short=0.3204. +- domain skill: Econ/Fin=0.1023, Energy=0.1772, Healthcare=0.4136, Nature=0.4097, Sales=0.3467, Transport=0.4530, Web/CloudOps=0.5025. +- frequency skill: A=0.3691, D=0.3356, H=0.3748, M=0.0875, Q=0.1887, S=0.4366, T=0.3965, W=0.1978. +- variates skill: multivariate=0.3840, univariate=0.3265. +- Outcome: Improves matched E25-3000 screen from 0.351702 to 0.352625. First earlier diagnostic improves 0.321665 to 0.322014. Keep training to assess persistence. + +## E34 joint rehearsal 1000-step screen +- Checkpoint SHA-256: `394f2003a6c00cdcb0f2b944d1e9cc8ae4f7aca9e513bf46dbb1f8a2489c8670`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.026655912399292 seconds. +- Overall skill 0.360583; relative MASE 0.762757; relative WQL 0.536022. +- term skill: long=0.3975, medium=0.4014, short=0.3292. +- domain skill: Econ/Fin=0.1394, Energy=0.1926, Healthcare=0.3956, Nature=0.4177, Sales=0.3466, Transport=0.4620, Web/CloudOps=0.5034. +- frequency skill: A=0.3785, D=0.3382, H=0.3903, M=0.0963, Q=0.1994, S=0.4210, T=0.4059, W=0.1960. +- variates skill: multivariate=0.3895, univariate=0.3366. +- Outcome: Improves matched zero-step control on main screen and both earlier diagnostics. Later checkpoints are needed before selecting a package. + +## E34 joint rehearsal 3000-step screen +- Checkpoint SHA-256: `6dd1560fb4d63eae0fa8d414252b55329371e397cee44dcff4c656ff3e2f3416`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.9136745929718 seconds. +- Overall skill 0.358556; relative MASE 0.764675; relative WQL 0.538072. +- term skill: long=0.3976, medium=0.4016, short=0.3253. +- domain skill: Econ/Fin=0.1364, Energy=0.1912, Healthcare=0.3737, Nature=0.4189, Sales=0.3465, Transport=0.4616, Web/CloudOps=0.5016. +- frequency skill: A=0.3793, D=0.3315, H=0.3904, M=0.0787, Q=0.2012, S=0.4202, T=0.4046, W=0.1966. +- variates skill: multivariate=0.3887, univariate=0.3335. +- Outcome: Screen falls below the zero-step control after the earlier gain; do not publish this checkpoint. Continue to the planned 6000-step endpoint to assess the lower learning rate. + +## E36: equal-weight control and recency ensemble +Hypothesis: averaging two strong continuations reduces differences across validation cutoffs. Compare a fixed 50/50 quantile average of E25 recency12000 and E22 control18000, each forecasting every instance with the aligned seasonal rule. No training or new data; no dataset-specific selection. Screen and both earlier diagnostics are computed from cached forecasts before constructing a runtime package. + +## E37: fixed zero-mass projection +Hypothesis: small positive forecasts on histories with an observed mass at exactly zero cause disproportionate median error. Diagnostic candidates snap nonnegative quantiles below 0, 0.001, 0.005 or 0.02 context standard deviations to zero, only when the recent4096 history is nonnegative and contains at least4 zeros comprising at least10% of observed points. All thresholds are fixed globally; no per-instance fitting. Test the same four candidates at all three validation cutoffs using E25 recency12000 aligned outputs. No training and no extra data. + +E37 initial sweep: threshold0.02 improved screen 0.359868→0.360509, first earlier0.327844→0.328180 and second earlier0.354561→0.354943. Smaller nonzero thresholds gave smaller gains. Build and fully evaluate the0.02 runtime. A separate follow-up will compare0.05 and0.1 to assess whether the original upper endpoint truncated the useful range; no additional fitted parameters. + +## E38: broader packed corpus for the 36.8M recency model (prepared) +Hypothesis: the earlier negative corpus-expansion result at6.7M parameters may not hold for the larger, more-trained model. Compare packed_sample (0.959B points) with packed_expanded (5.653B points), initializing both from E25 recency12000. Keep source mixture weights calculated from packed_sample in both arms, isolating broader series and crop coverage from source-reweighting. Seed79, batch256, learning rate5e-5, 12000-step schedule, saves every3000, same architecture/loss/window mixture/synthetic generator. Each arm uses two Torch CPU threads. Training will start after current jobs release GPU capacity. No new corpus directories or generators. + +E37 wider sweep: thresholds0.02/0.05/0.1 gave screen0.360509/0.362121/0.364736, earlier1 0.328180/0.328643/0.329276, earlier2 0.354943/0.355475/0.356263. All three improve with the larger threshold. A final bracket at0.1/0.2/0.4/0.8 will locate an interior useful range before full runtime selection. + +## E39: bounded quantiles during pretraining (prepared) +Hypothesis: the current continuous output head incurs small positive errors on genuinely zero-valued futures. Extend the existing nonnegativity heuristic symmetrically inside the training forward pass: histories entirely nonnegative clamp normalized output quantiles at standardized zero; entirely nonpositive histories clamp above at zero. This lets pinball loss learn exact boundary probability mass through negative latent quantiles, rather than requiring exact equality of a continuous prediction. No additional model parameters. Match E38 packed_sample control: own E25 recency12000 initialization, seed79, batch256, LR5e-5, 12000 steps, original source mixture and generator. Training not yet started; this is separate from the fixed E37 inference projection. + +E37 final bracket selected threshold0.4: screen/earlier1/earlier2 =0.370559/0.330696/0.357884, versus parent0.359868/0.327844/0.354561. Threshold0.8 regresses to0.364344/0.327637/0.350745, providing an interior optimum common to all three cutoffs. No finer sweep is planned. Assemble and fully evaluate threshold0.4 before publication. + +E36 equal-weight blend gives screen0.361191, earlier1 0.328179, earlier2 0.354067. The main screen remains below control18000 alone (0.361735), and second earlier remains below recency12000 (0.354561). Not selected; no ensemble runtime is published. + +E38 packed_sample control started with the planned seed79 and schedule after E34 completed. A sampler check confirmed bitwise equality with the original sampler and identical source probabilities for both packed corpora. The expanded arm remains prepared, awaiting GPU capacity. + +## E22 control18000 full validation with aligned seasonal rule +- Checkpoint SHA-256: `b7bbb7473a317145235c133492a0d743a90a01ff252577a4c8a4651db008a138`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.357537; relative MASE 0.764724; relative WQL 0.539749. +- term skill: long=0.3898, medium=0.4009, short=0.3270. +- domain skill: Econ/Fin=0.1117, Energy=0.1855, Healthcare=0.4146, Nature=0.4204, Sales=0.3566, Transport=0.4642, Web/CloudOps=0.4949. +- frequency skill: A=0.2833, D=0.3419, H=0.3872, M=0.1236, Q=0.1877, S=0.4206, T=0.3976, W=0.1997. +- variates skill: multivariate=0.3862, univariate=0.3338. +- Outcome: Improves full validation to0.357537; first and second earlier0.327746/0.352885 remain slightly below published recency12000. Candidate retained while matched recency18000 is evaluated. + +## E31 amplitude synthetic 6000-step screen +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.376917362213135 seconds. +- Overall skill 0.355543; relative MASE 0.766576; relative WQL 0.541792. +- term skill: long=0.3869, medium=0.3997, short=0.3251. +- domain skill: Econ/Fin=0.1054, Energy=0.1826, Healthcare=0.4173, Nature=0.4166, Sales=0.3471, Transport=0.4535, Web/CloudOps=0.5020. +- frequency skill: A=0.3700, D=0.3444, H=0.3777, M=0.0986, Q=0.1941, S=0.4367, T=0.3980, W=0.1929. +- variates skill: multivariate=0.3869, univariate=0.3294. +- Outcome: Screen0.355543 improves matched E25-6000 0.352851. First earlier0.324002 is effectively tied with matched0.324008; second earlier0.349572 improves matched0.349098. Continue to12000. + +## E34 joint rehearsal 6000-step screen +- Checkpoint SHA-256: `44aa5f702a58845a427ad76818631e808362b7dc236a3648232db47d621db219`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.278470993041992 seconds. +- Overall skill 0.360025; relative MASE 0.763498; relative WQL 0.536437. +- term skill: long=0.3986, medium=0.4027, short=0.3272. +- domain skill: Econ/Fin=0.1375, Energy=0.1934, Healthcare=0.3748, Nature=0.4209, Sales=0.3465, Transport=0.4619, Web/CloudOps=0.5031. +- frequency skill: A=0.3720, D=0.3320, H=0.3916, M=0.0873, Q=0.1998, S=0.4184, T=0.4071, W=0.1973. +- variates skill: multivariate=0.3917, univariate=0.3337. +- Outcome: Final screen0.360025 improves parent0.359242 but is below the1000-step peak0.360583. Evaluate both earlier cutoffs; do not publish solely from the small screen gain. + +E34 completed6000 steps in1049.5 training-process seconds. Earlier1/earlier2 =0.326344/0.350746: first improves parent0.325963, second regresses from0.352462. The1000-step checkpoint remains the better joint candidate, but neither is selected over the stronger recency model. All weights are archived. + +## E37 threshold0.02 full package validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.356254; relative MASE 0.764978; relative WQL 0.541726. +- term skill: long=0.3904, medium=0.4005, short=0.3246. +- domain skill: Econ/Fin=0.1162, Energy=0.1871, Healthcare=0.4030, Nature=0.4175, Sales=0.3571, Transport=0.4622, Web/CloudOps=0.4933. +- frequency skill: A=0.2912, D=0.3393, H=0.3863, M=0.1108, Q=0.1840, S=0.4221, T=0.3979, W=0.1942. +- variates skill: multivariate=0.3855, univariate=0.3320. +- Outcome: Full skill0.356254 improves parent0.355628 with zero failed configurations. Repeated relocated examples are bitwise identical, finite and monotone. Temporarily published while the larger, consistently better threshold0.4 completes full validation. + +## E40: zero-mass projection with empirical phase probability +E37 helps solar and several zero-heavy channels but slightly hurts some sales and cloud series. Hypothesis: a quantile should be snapped only when the observed zero probability supports its level. Keep threshold0.4 fixed; compare unrestricted E37, global observed zero fraction, and phase-specific zero frequencies from the last4 or8 primary seasonal cycles. For phase estimates with at least3 observations use (zero_count+0.5)/(count+1), otherwise the global fraction. Only levels at or below that zero probability are eligible. All rules are fixed context formulas, applied independently per variate. Compare cached E25 recency12000 forecasts on all three cutoffs; no training. + +E37 final selection: use the18,000-step recency checkpoint with threshold0.4. Full validation0.370171 exceeds12,000-step+0.4 at0.366390; earlier1 improves0.330696→0.332400, while earlier2 decreases0.357884→0.356697. The three-cutoff mean improves, and all three exceed the previously published12,000-step+0.02 package. Prefer the newer checkpoint for its full-validation and first-earlier gains; retain the second-earlier regression as a limitation. Both candidate packages passed repeated relocated example inference, with exact equality, finite outputs and monotone quantiles. +- Measured depth36_control step18000: 3529.7 elapsed training-process seconds on the shared single H100. +- Measured recency_features step18000: 4008.8 elapsed training-process seconds on the shared single H100. +- Measured amplitude_synth step6000: 1498.1 elapsed training-process seconds on the shared single H100. +- Measured joint_rehearsal step6000: 1049.5 elapsed training-process seconds on the shared single H100. + +## E37 threshold0.4 on recency12000 full validation +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.366390; relative MASE 0.754640; relative WQL 0.531990. +- term skill: long=0.3917, medium=0.4037, short=0.3414. +- domain skill: Econ/Fin=0.1162, Energy=0.2258, Healthcare=0.4030, Nature=0.4203, Sales=0.3559, Transport=0.4622, Web/CloudOps=0.4911. +- frequency skill: A=0.2912, D=0.3374, H=0.3884, M=0.1159, Q=0.1840, S=0.4221, T=0.4262, W=0.1943. +- variates skill: multivariate=0.3853, univariate=0.3509. +- Outcome: Full0.366390, earlier1 0.330696, earlier2 0.357884. Clear improvement over the same checkpoint without zero projection. Superseded by the18000-step candidate on full validation and average across cutoffs. + +## E25 plus E37 recency18000 threshold0.4 full validation +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.370171; relative MASE 0.750532; relative WQL 0.528537. +- term skill: long=0.3932, medium=0.4057, short=0.3469. +- domain skill: Econ/Fin=0.1099, Energy=0.2275, Healthcare=0.4340, Nature=0.4253, Sales=0.3541, Transport=0.4653, Web/CloudOps=0.4932. +- frequency skill: A=0.2819, D=0.3468, H=0.3906, M=0.1220, Q=0.1866, S=0.4218, T=0.4285, W=0.2054. +- variates skill: multivariate=0.3878, univariate=0.3558. +- Outcome: Published atomically. Full skill0.370171; earlier1 0.332400 and earlier2 0.356697. All97 configurations and151170 instances scored, zero failures. Actual package repeated examples are bitwise deterministic, finite and monotone; full inference118.1 seconds under concurrent training. + +## Published recency18000 zero0.4 first earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.86830711364746 seconds. +- Overall skill 0.332400; relative MASE 0.801955; relative WQL 0.555755. +- term skill: long=0.3980, medium=0.3574, short=0.2953. +- domain skill: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472. +- frequency skill: A=0.2996, D=0.3516, H=0.3643, M=0.1721, Q=0.2330, S=0.3397, T=0.3325, W=0.2660. +- variates skill: multivariate=0.3492, univariate=0.3187. +- Outcome: Improves the previous published package and the12000-step zero0.4 candidate. + +## Published recency18000 zero0.4 second earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.40335988998413 seconds. +- Overall skill 0.356697; relative MASE 0.773731; relative WQL 0.534862. +- term skill: long=0.3657, medium=0.3874, short=0.3411. +- domain skill: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303. +- frequency skill: A=0.3474, D=0.4275, H=0.3891, M=0.1599, Q=0.1548, S=0.2798, T=0.3574, W=0.2434. +- variates skill: multivariate=0.3611, univariate=0.3531. +- Outcome: Improves the previous published package; slightly below the12000-step zero0.4 candidate. + +## E37 complete diagnostic sweep receipts +All use the own recency12000 checkpoint SHA-256 `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`; no training, fixed inference seed0. Compute below is CPU diagnostic elapsed time, not GPU training time. + +zero_mass, screen: 4.03 seconds. +- Setting 0.0: skill 0.359868; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.001: skill 0.359874; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.005: skill 0.359953; term short=0.3285, medium=0.4017, long=0.3961; domain Econ/Fin=0.1374, Energy=0.1933, Healthcare=0.3970, Nature=0.4171, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5006. +- Setting 0.02: skill 0.360509; term short=0.3292, medium=0.4020, long=0.3966; domain Econ/Fin=0.1374, Energy=0.1948, Healthcare=0.3970, Nature=0.4176, Sales=0.3480, Transport=0.4621, Web/CloudOps=0.5008. + +zero_mass, backcast: 3.65 seconds. +- Setting 0.0: skill 0.327844; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.001: skill 0.327849; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.005: skill 0.327890; term short=0.2909, medium=0.3529, long=0.3933; domain Econ/Fin=0.1636, Energy=0.2225, Healthcare=0.3816, Nature=0.3534, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.02: skill 0.328180; term short=0.2912, medium=0.3532, long=0.3937; domain Econ/Fin=0.1636, Energy=0.2229, Healthcare=0.3816, Nature=0.3537, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4409. + +zero_mass, backcast2: 3.62 seconds. +- Setting 0.0: skill 0.354561; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- Setting 0.001: skill 0.354567; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4282. +- Setting 0.005: skill 0.354631; term short=0.3398, medium=0.3829, long=0.3643; domain Econ/Fin=0.1095, Energy=0.2260, Healthcare=0.3738, Nature=0.4622, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4282. +- Setting 0.02: skill 0.354943; term short=0.3400, medium=0.3834, long=0.3646; domain Econ/Fin=0.1095, Energy=0.2266, Healthcare=0.3738, Nature=0.4627, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4283. + +zero_mass_wide, screen: 3.91 seconds. +- Setting 0.0: skill 0.359868; term short=0.3284, medium=0.4016, long=0.3960; domain Econ/Fin=0.1374, Energy=0.1931, Healthcare=0.3970, Nature=0.4170, Sales=0.3479, Transport=0.4621, Web/CloudOps=0.5005. +- Setting 0.02: skill 0.360509; term short=0.3292, medium=0.4020, long=0.3966; domain Econ/Fin=0.1374, Energy=0.1948, Healthcare=0.3970, Nature=0.4176, Sales=0.3480, Transport=0.4621, Web/CloudOps=0.5008. +- Setting 0.05: skill 0.362121; term short=0.3316, medium=0.4026, long=0.3972; domain Econ/Fin=0.1374, Energy=0.1998, Healthcare=0.3970, Nature=0.4186, Sales=0.3483, Transport=0.4621, Web/CloudOps=0.5012. +- Setting 0.1: skill 0.364736; term short=0.3357, medium=0.4036, long=0.3981; domain Econ/Fin=0.1374, Energy=0.2086, Healthcare=0.3970, Nature=0.4195, Sales=0.3487, Transport=0.4621, Web/CloudOps=0.5017. + +zero_mass_wide, backcast: 3.55 seconds. +- Setting 0.0: skill 0.327844; term short=0.2909, medium=0.3529, long=0.3932; domain Econ/Fin=0.1636, Energy=0.2224, Healthcare=0.3816, Nature=0.3533, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4404. +- Setting 0.02: skill 0.328180; term short=0.2912, medium=0.3532, long=0.3937; domain Econ/Fin=0.1636, Energy=0.2229, Healthcare=0.3816, Nature=0.3537, Sales=0.3955, Transport=0.3666, Web/CloudOps=0.4409. +- Setting 0.05: skill 0.328643; term short=0.2914, medium=0.3540, long=0.3942; domain Econ/Fin=0.1636, Energy=0.2235, Healthcare=0.3816, Nature=0.3546, Sales=0.3957, Transport=0.3666, Web/CloudOps=0.4415. +- Setting 0.1: skill 0.329276; term short=0.2917, medium=0.3550, long=0.3953; domain Econ/Fin=0.1636, Energy=0.2243, Healthcare=0.3816, Nature=0.3553, Sales=0.3959, Transport=0.3666, Web/CloudOps=0.4426. + +zero_mass_wide, backcast2: 3.53 seconds. +- Setting 0.0: skill 0.354561; term short=0.3397, medium=0.3828, long=0.3642; domain Econ/Fin=0.1095, Energy=0.2259, Healthcare=0.3738, Nature=0.4621, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4281. +- Setting 0.02: skill 0.354943; term short=0.3400, medium=0.3834, long=0.3646; domain Econ/Fin=0.1095, Energy=0.2266, Healthcare=0.3738, Nature=0.4627, Sales=0.5594, Transport=0.4168, Web/CloudOps=0.4283. +- Setting 0.05: skill 0.355475; term short=0.3406, medium=0.3840, long=0.3651; domain Econ/Fin=0.1095, Energy=0.2278, Healthcare=0.3738, Nature=0.4637, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4284. +- Setting 0.1: skill 0.356263; term short=0.3413, medium=0.3849, long=0.3660; domain Econ/Fin=0.1095, Energy=0.2295, Healthcare=0.3738, Nature=0.4650, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4287. + +zero_mass_range, screen: 3.63 seconds. +- Setting 0.1: skill 0.364736; term short=0.3357, medium=0.4036, long=0.3981; domain Econ/Fin=0.1374, Energy=0.2086, Healthcare=0.3970, Nature=0.4195, Sales=0.3487, Transport=0.4621, Web/CloudOps=0.5017. +- Setting 0.2: skill 0.368575; term short=0.3420, medium=0.4046, long=0.3988; domain Econ/Fin=0.1374, Energy=0.2225, Healthcare=0.3970, Nature=0.4210, Sales=0.3475, Transport=0.4621, Web/CloudOps=0.5015. +- Setting 0.4: skill 0.370559; term short=0.3458, medium=0.4052, long=0.3979; domain Econ/Fin=0.1374, Energy=0.2332, Healthcare=0.3970, Nature=0.4205, Sales=0.3463, Transport=0.4621, Web/CloudOps=0.4986. +- Setting 0.8: skill 0.364344; term short=0.3385, medium=0.4008, long=0.3925; domain Econ/Fin=0.1374, Energy=0.2220, Healthcare=0.3970, Nature=0.4198, Sales=0.3444, Transport=0.4621, Web/CloudOps=0.4869. + +zero_mass_range, backcast: 3.50 seconds. +- Setting 0.1: skill 0.329276; term short=0.2917, medium=0.3550, long=0.3953; domain Econ/Fin=0.1636, Energy=0.2243, Healthcare=0.3816, Nature=0.3553, Sales=0.3959, Transport=0.3666, Web/CloudOps=0.4426. +- Setting 0.2: skill 0.330173; term short=0.2923, medium=0.3563, long=0.3966; domain Econ/Fin=0.1636, Energy=0.2253, Healthcare=0.3816, Nature=0.3560, Sales=0.3970, Transport=0.3666, Web/CloudOps=0.4444. +- Setting 0.4: skill 0.330696; term short=0.2928, medium=0.3550, long=0.3988; domain Econ/Fin=0.1636, Energy=0.2247, Healthcare=0.3816, Nature=0.3559, Sales=0.3972, Transport=0.3666, Web/CloudOps=0.4472. +- Setting 0.8: skill 0.327637; term short=0.2916, medium=0.3471, long=0.3961; domain Econ/Fin=0.1636, Energy=0.2180, Healthcare=0.3815, Nature=0.3525, Sales=0.3939, Transport=0.3666, Web/CloudOps=0.4454. + +zero_mass_range, backcast2: 3.39 seconds. +- Setting 0.1: skill 0.356263; term short=0.3413, medium=0.3849, long=0.3660; domain Econ/Fin=0.1095, Energy=0.2295, Healthcare=0.3738, Nature=0.4650, Sales=0.5595, Transport=0.4168, Web/CloudOps=0.4287. +- Setting 0.2: skill 0.357389; term short=0.3423, medium=0.3862, long=0.3671; domain Econ/Fin=0.1095, Energy=0.2319, Healthcare=0.3738, Nature=0.4665, Sales=0.5592, Transport=0.4168, Web/CloudOps=0.4293. +- Setting 0.4: skill 0.357884; term short=0.3425, medium=0.3883, long=0.3665; domain Econ/Fin=0.1095, Energy=0.2327, Healthcare=0.3738, Nature=0.4661, Sales=0.5573, Transport=0.4168, Web/CloudOps=0.4312. +- Setting 0.8: skill 0.350745; term short=0.3358, medium=0.3808, long=0.3588; domain Econ/Fin=0.1095, Energy=0.2213, Healthcare=0.3737, Nature=0.4523, Sales=0.5499, Transport=0.4168, Web/CloudOps=0.4272. + +zero_phase, screen: 4.24 seconds. +- Setting None: skill 0.370559; term short=0.3458, medium=0.4052, long=0.3979; domain Econ/Fin=0.1374, Energy=0.2332, Healthcare=0.3970, Nature=0.4205, Sales=0.3463, Transport=0.4621, Web/CloudOps=0.4986. +- Setting 0: skill 0.367375; term short=0.3412, medium=0.4029, long=0.3972; domain Econ/Fin=0.1374, Energy=0.2196, Healthcare=0.3970, Nature=0.4183, Sales=0.3529, Transport=0.4621, Web/CloudOps=0.5008. +- Setting 4: skill 0.369637; term short=0.3443, medium=0.4040, long=0.3986; domain Econ/Fin=0.1374, Energy=0.2277, Healthcare=0.3970, Nature=0.4202, Sales=0.3515, Transport=0.4621, Web/CloudOps=0.5001. +- Setting 8: skill 0.369822; term short=0.3448, medium=0.4037, long=0.3986; domain Econ/Fin=0.1374, Energy=0.2278, Healthcare=0.3970, Nature=0.4202, Sales=0.3518, Transport=0.4621, Web/CloudOps=0.5007. + +zero_phase, backcast: 4.22 seconds. +- Setting None: skill 0.330696; term short=0.2928, medium=0.3550, long=0.3988; domain Econ/Fin=0.1636, Energy=0.2247, Healthcare=0.3816, Nature=0.3559, Sales=0.3972, Transport=0.3666, Web/CloudOps=0.4472. +- Setting 0: skill 0.328679; term short=0.2917, medium=0.3538, long=0.3940; domain Econ/Fin=0.1636, Energy=0.2231, Healthcare=0.3816, Nature=0.3547, Sales=0.4001, Transport=0.3666, Web/CloudOps=0.4412. +- Setting 4: skill 0.329503; term short=0.2920, medium=0.3549, long=0.3957; domain Econ/Fin=0.1636, Energy=0.2254, Healthcare=0.3816, Nature=0.3555, Sales=0.3995, Transport=0.3666, Web/CloudOps=0.4415. +- Setting 8: skill 0.329633; term short=0.2921, medium=0.3549, long=0.3960; domain Econ/Fin=0.1636, Energy=0.2252, Healthcare=0.3816, Nature=0.3555, Sales=0.4003, Transport=0.3666, Web/CloudOps=0.4420. + +zero_phase, backcast2: 3.98 seconds. +- Setting None: skill 0.357884; term short=0.3425, medium=0.3883, long=0.3665; domain Econ/Fin=0.1095, Energy=0.2327, Healthcare=0.3738, Nature=0.4661, Sales=0.5573, Transport=0.4168, Web/CloudOps=0.4312. +- Setting 0: skill 0.355941; term short=0.3416, medium=0.3833, long=0.3653; domain Econ/Fin=0.1095, Energy=0.2288, Healthcare=0.3738, Nature=0.4641, Sales=0.5605, Transport=0.4168, Web/CloudOps=0.4286. +- Setting 4: skill 0.357313; term short=0.3424, medium=0.3856, long=0.3670; domain Econ/Fin=0.1095, Energy=0.2321, Healthcare=0.3738, Nature=0.4661, Sales=0.5605, Transport=0.4168, Web/CloudOps=0.4289. +- Setting 8: skill 0.357230; term short=0.3422, medium=0.3858, long=0.3672; domain Econ/Fin=0.1095, Energy=0.2314, Healthcare=0.3738, Nature=0.4664, Sales=0.5608, Transport=0.4168, Web/CloudOps=0.4291. + +E40 outcome: unrestricted E37 threshold0.4 beats all global/phase-probability guards on every cutoff. Phase4 gives0.369637/0.329503/0.357313; phase8 gives0.369822/0.329633/0.357230; unrestricted gives0.370559/0.330696/0.357884. Do not add the probability guard. + +E36 component checkpoint hashes: recency12000 `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`; control18000 `b7bbb7473a317145235c133492a0d743a90a01ff252577a4c8a4651db008a138`. These were cached diagnostic blends only, without additional training. + +## E41: learned zero-probability classifier with a frozen backbone +Hypothesis: a classifier trained on allowed windows can make the zero projection conditional on future zero probability more accurately than the empirical guards rejected in E40. Freeze E25 recency18000 and train only a small MLP on decoder representations, global zero fraction, two four-cycle phase zero frequencies and absolute normalized median forecast. The classifier receives BCE loss for exact-zero futures only on sign-homogeneous contexts containing at least4 zeros and10% zeros. At inference, average probabilities from both sign orientations and allow the existing threshold0.4 projection only for quantile levels at or below that probability. Every instance passes through the same backbone and classifier. Bias5 initialization makes probability0.993 and preserves E37 forecasts. Own packed_sample and unchanged synthetic generator; seed83, batch128, LR2e-4, 6000-step schedule, one Torch CPU thread. This adds no external data and trains no backbone parameters. + +## E35 explicit trend inputs 3000-step screen +- Checkpoint SHA-256: `17d346dde232341672545210839ea10fc6e147d6e1d65d2457497d790fc652f6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.317448616027832 seconds. +- Overall skill 0.351994; relative MASE 0.770114; relative WQL 0.545259. +- term skill: long=0.3848, medium=0.3991, short=0.3197. +- domain skill: Econ/Fin=0.1029, Energy=0.1770, Healthcare=0.4091, Nature=0.4082, Sales=0.3492, Transport=0.4538, Web/CloudOps=0.5011. +- frequency skill: A=0.3685, D=0.3335, H=0.3745, M=0.0901, Q=0.1894, S=0.4379, T=0.3955, W=0.1971. +- variates skill: multivariate=0.3833, univariate=0.3260. +- Outcome: Small improvement over matched E25: screen0.351994 versus0.351702, first earlier0.321829 versus0.321665. Continue to6000 to determine whether this persists. + +E35 training through3000 took850.6 elapsed process seconds on the shared H100. + +## E42: match training decoder horizons to available labels (prepared) +Hypothesis: short pretraining series supply fewer finite future labels than the requested32/128/512/1024 horizon, yet the current decoder sees every requested future token and receives that larger horizon in its metadata. During training only, infer each row's available horizon as its last finite target position, rounded up to the patch boundary; use that length for horizon metadata and mask unused future tokens as self-attention keys in every decoder layer. The label mask and loss remain unchanged. At inference the full requested horizon is used exactly as before, with no new inputs or fitting. Match E38 packed_sample control: own recency12000 initialization, seed79, batch256, LR5e-5, 12000 steps, unchanged sampler. No new model parameters or data. Planned to begin after the small frozen classifier releases memory; GPU evaluations are serialized to bound peak memory. + +E38 expanded corpus arm training started at 2026-10-22T04:02:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E41 initialization check: all original backbone tensors match the parent bitwise. With identical screen batches, every quantile in all97 configurations is bitwise equal to the parent; maximum difference0. The parent direct-screen score is0.374499664. The cached subset of full-validation predictions scores0.374469795 because batch composition and padding differ slightly; matched direct evaluations are used for E41 comparisons. The classifier has75,920 trainable parameters; total36,873,648. At1000/3000 steps, screen0.373402/0.374243 remains below the unchanged parent. Continue to the planned6000-step endpoint. + +E42 data diagnostic (only packed pretraining data, seed79, 640 windows per requested horizon): H32: 6.4% partial futures, mean available31.0; H128: 14.5% partial futures, mean available117.9; H512: 16.7% partial futures, mean available456.8; H1024: 19.2% partial futures, mean available886.4. CPU elapsed 0.93 seconds. A forward check verified bitwise unchanged ordinary inference and agreement within5.4e-7 between a padded masked short target and an actual short-horizon call. + +E35 first three cutoff comparisons at3000 steps: screen0.351994 versus matched0.351702; earlier1 0.321829 versus0.321665; earlier2 0.346465 versus0.346396. All gains are small; keep the6000-step comparison before drawing an architectural conclusion. + +## E22 depth36 control final24000-step screen +- Checkpoint SHA-256: `d60cdc55e693df0caf601ded61031be859ee027b0da46585586a3c6a3b5276ba`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.044859170913696 seconds. +- Overall skill 0.359867; relative MASE 0.762956; relative WQL 0.537082. +- term skill: long=0.3922, medium=0.4034, short=0.3293. +- domain skill: Econ/Fin=0.1126, Energy=0.1866, Healthcare=0.4038, Nature=0.4208, Sales=0.3464, Transport=0.4583, Web/CloudOps=0.5101. +- frequency skill: A=0.3718, D=0.3396, H=0.3822, M=0.0911, Q=0.1974, S=0.4422, T=0.4054, W=0.2072. +- variates skill: multivariate=0.3956, univariate=0.3299. +- Outcome: Final mean-template screen0.359867 improves its18000-step0.359224 but remains below E25 recency18000 at0.361265. Finished5206.4 elapsed training-process seconds; no new package selected. GPU capacity transferred to E38 expanded corpus arm. + +E42 partial target horizons training started at 2026-10-22T04:06:37Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E43: recheck fixed prior strengths on the stronger backbone +Hypothesis: the seasonal and continuity corrections selected on earlier models may be too strong after continued pretraining. Cache uncorrected symmetric neural forecasts from E25 recency18000, then compare all nine combinations of seasonal blend strength0/0.5/1 and continuity blend strength0/0.5/1. The candidate seasonal forecast is the existing aligned rule; partial strength interpolates it with the neural forecast. Continuity strength similarly interpolates the existing tau24 correction with its input. Keep the selected zero-mass threshold0.4 fixed and apply it last. Use the same global settings on all three cutoffs. No training or new data; inference seed0. + +## E41 frozen zero classifier3000-step screen +- Checkpoint SHA-256: `08b5cc376746c87331cee4628ec56126adf48076aa08ffd2f2bd3f74427d4d96`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.868639707565308 seconds. +- Overall skill 0.374243; relative MASE 0.746287; relative WQL 0.524694. +- term skill: long=0.3998, medium=0.4060, short=0.3515. +- domain skill: Econ/Fin=0.1332, Energy=0.2307, Healthcare=0.4319, Nature=0.4244, Sales=0.3502, Transport=0.4650, Web/CloudOps=0.5035. +- frequency skill: A=0.3692, D=0.3463, H=0.3950, M=0.1023, Q=0.2006, S=0.4218, T=0.4344, W=0.2127. +- variates skill: multivariate=0.3931, univariate=0.3588. +- Outcome: Screen0.374243 is below unchanged parent0.374500. Earlier1 0.331330 versus0.332400; earlier2 0.356106 versus0.356697. The classifier repairs some sales and cloud errors but gives back more solar improvement; no package change. + +## E44: training-consistent trend summary on short contexts +Code review found that the original trend basis chooses its averaging width from padded tensor width: min(128,max(4,c//4)). Training always pads to at least512, making this width128, whereas short inference batches often select smaller widths. This also makes the fixed trend summary sensitive to batch padding. Test a globally fixed128-point width at inference, preserving the exact formula used throughout training. It uses only each row's observed values; other features and all selected corrections remain unchanged. No new parameters, training or data. Compare the recency18000 checkpoint on the screen and both earlier windows before selecting a package. + +E44 first diagnostic launch failed before producing a forecast: a source-edit comment accidentally hid the adjacent recent-mean assignment. Corrected the assignment and restarted all three diagnostics; no failed output was scored or published. + +## E41 frozen zero classifier final6000-step screen +- Checkpoint SHA-256: `9dcf4fa821ca636b648447e0516258a3da7056b5e98ec944d0251c73e5ae3006`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.14689803123474 seconds. +- Overall skill 0.374576; relative MASE 0.746312; relative WQL 0.524117. +- term skill: long=0.3999, medium=0.4061, short=0.3520. +- domain skill: Econ/Fin=0.1332, Energy=0.2315, Healthcare=0.4319, Nature=0.4249, Sales=0.3502, Transport=0.4650, Web/CloudOps=0.5037. +- frequency skill: A=0.3692, D=0.3465, H=0.3951, M=0.1017, Q=0.2006, S=0.4218, T=0.4353, W=0.2127. +- variates skill: multivariate=0.3934, univariate=0.3592. +- Outcome: Final screen0.374576 versus unchanged parent0.374500 is nearly tied. Both earlier cutoffs regress:0.331200 versus0.332400 and0.356162 versus0.356697. Do not select this classifier; retain fixed zero projection. Training took559.8 process seconds; backbone stayed frozen. + +## E43 complete prior-strength comparison +Checkpoint SHA-256 `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`; fixed inference seed0; no training. + +screen: 10.68 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.352854; term short=0.3372, medium=0.3820, long=0.3635; domain Econ/Fin=0.0649, Energy=0.2249, Healthcare=0.3918, Nature=0.4305, Sales=0.3458, Transport=0.4676, Web/CloudOps=0.4394. +- Seasonal0.0, continuity0.5: skill0.358015; term short=0.3463, medium=0.3820, long=0.3639; domain Econ/Fin=0.1059, Energy=0.2325, Healthcare=0.4145, Nature=0.4284, Sales=0.3457, Transport=0.4662, Web/CloudOps=0.4421. +- Seasonal0.0, continuity1.0: skill0.358419; term short=0.3472, medium=0.3814, long=0.3642; domain Econ/Fin=0.1280, Energy=0.2289, Healthcare=0.4280, Nature=0.4258, Sales=0.3457, Transport=0.4637, Web/CloudOps=0.4444. +- Seasonal0.5, continuity0.0: skill0.361594; term short=0.3390, medium=0.3982, long=0.3816; domain Econ/Fin=0.0723, Energy=0.2304, Healthcare=0.3951, Nature=0.4304, Sales=0.3450, Transport=0.4683, Web/CloudOps=0.4668. +- Seasonal0.5, continuity0.5: skill0.367185; term short=0.3491, medium=0.3978, long=0.3823; domain Econ/Fin=0.1132, Energy=0.2381, Healthcare=0.4171, Nature=0.4282, Sales=0.3449, Transport=0.4670, Web/CloudOps=0.4713. +- Seasonal0.5, continuity1.0: skill0.367831; term short=0.3505, medium=0.3970, long=0.3826; domain Econ/Fin=0.1347, Energy=0.2340, Healthcare=0.4301, Nature=0.4256, Sales=0.3449, Transport=0.4647, Web/CloudOps=0.4751. +- Seasonal1.0, continuity0.0: skill0.366912; term short=0.3385, medium=0.4065, long=0.3980; domain Econ/Fin=0.0640, Energy=0.2315, Healthcare=0.3974, Nature=0.4301, Sales=0.3440, Transport=0.4682, Web/CloudOps=0.4881. +- Seasonal1.0, continuity0.5: skill0.373401; term short=0.3497, medium=0.4072, long=0.3989; domain Econ/Fin=0.1094, Energy=0.2393, Healthcare=0.4192, Nature=0.4280, Sales=0.3439, Transport=0.4672, Web/CloudOps=0.4952. +- Seasonal1.0, continuity1.0: skill0.374500; term short=0.3517, medium=0.4069, long=0.3994; domain Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007. + +backcast: 11.26 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.307142; term short=0.2826, medium=0.3351, long=0.3410; domain Econ/Fin=0.1076, Energy=0.2255, Healthcare=0.3430, Nature=0.3552, Sales=0.3986, Transport=0.3768, Web/CloudOps=0.3599. +- Seasonal0.0, continuity0.5: skill0.312170; term short=0.2916, medium=0.3354, long=0.3411; domain Econ/Fin=0.1400, Energy=0.2277, Healthcare=0.3844, Nature=0.3556, Sales=0.3986, Transport=0.3764, Web/CloudOps=0.3620. +- Seasonal0.0, continuity1.0: skill0.314938; term short=0.2967, medium=0.3353, long=0.3409; domain Econ/Fin=0.1539, Energy=0.2269, Healthcare=0.4209, Nature=0.3555, Sales=0.3986, Transport=0.3753, Web/CloudOps=0.3636. +- Seasonal0.5, continuity0.0: skill0.318715; term short=0.2868, medium=0.3483, long=0.3683; domain Econ/Fin=0.1210, Energy=0.2277, Healthcare=0.3359, Nature=0.3556, Sales=0.3986, Transport=0.3747, Web/CloudOps=0.4076. +- Seasonal0.5, continuity0.5: skill0.323130; term short=0.2948, medium=0.3486, long=0.3682; domain Econ/Fin=0.1519, Energy=0.2300, Healthcare=0.3781, Nature=0.3560, Sales=0.3986, Transport=0.3744, Web/CloudOps=0.4072. +- Seasonal0.5, continuity1.0: skill0.325194; term short=0.2988, medium=0.3485, long=0.3679; domain Econ/Fin=0.1645, Energy=0.2291, Healthcare=0.4163, Nature=0.3559, Sales=0.3986, Transport=0.3733, Web/CloudOps=0.4059. +- Seasonal1.0, continuity0.0: skill0.326613; term short=0.2844, medium=0.3570, long=0.3986; domain Econ/Fin=0.1011, Energy=0.2252, Healthcare=0.3156, Nature=0.3558, Sales=0.3986, Transport=0.3713, Web/CloudOps=0.4530. +- Seasonal1.0, continuity0.5: skill0.330837; term short=0.2922, medium=0.3575, long=0.3984; domain Econ/Fin=0.1366, Energy=0.2277, Healthcare=0.3596, Nature=0.3563, Sales=0.3986, Transport=0.3710, Web/CloudOps=0.4510. +- Seasonal1.0, continuity1.0: skill0.332400; term short=0.2953, medium=0.3574, long=0.3980; domain Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472. + +backcast2: 10.77 CPU diagnostic seconds. +- Seasonal0.0, continuity0.0: skill0.342833; term short=0.3444, medium=0.3372, long=0.3447; domain Econ/Fin=0.0850, Energy=0.2421, Healthcare=0.3909, Nature=0.4651, Sales=0.5517, Transport=0.4200, Web/CloudOps=0.3492. +- Seasonal0.0, continuity0.5: skill0.343238; term short=0.3448, medium=0.3374, long=0.3451; domain Econ/Fin=0.1046, Energy=0.2395, Healthcare=0.3778, Nature=0.4655, Sales=0.5516, Transport=0.4195, Web/CloudOps=0.3541. +- Seasonal0.0, continuity1.0: skill0.341670; term short=0.3421, medium=0.3372, long=0.3453; domain Econ/Fin=0.1096, Energy=0.2345, Healthcare=0.3641, Nature=0.4656, Sales=0.5516, Transport=0.4183, Web/CloudOps=0.3571. +- Seasonal0.5, continuity0.0: skill0.353176; term short=0.3476, medium=0.3630, long=0.3580; domain Econ/Fin=0.0889, Energy=0.2454, Healthcare=0.3896, Nature=0.4651, Sales=0.5517, Transport=0.4202, Web/CloudOps=0.3933. +- Seasonal0.5, continuity0.5: skill0.353075; term short=0.3473, medium=0.3630, long=0.3584; domain Econ/Fin=0.1076, Energy=0.2421, Healthcare=0.3764, Nature=0.4655, Sales=0.5516, Transport=0.4198, Web/CloudOps=0.3966. +- Seasonal0.5, continuity1.0: skill0.350860; term short=0.3435, medium=0.3626, long=0.3584; domain Econ/Fin=0.1107, Energy=0.2362, Healthcare=0.3627, Nature=0.4656, Sales=0.5516, Transport=0.4185, Web/CloudOps=0.3980. +- Seasonal1.0, continuity0.0: skill0.359824; term short=0.3464, medium=0.3881, long=0.3655; domain Econ/Fin=0.0796, Energy=0.2431, Healthcare=0.3878, Nature=0.4651, Sales=0.5517, Transport=0.4196, Web/CloudOps=0.4291. +- Seasonal1.0, continuity0.5: skill0.359396; term short=0.3456, medium=0.3880, long=0.3658; domain Econ/Fin=0.1008, Energy=0.2396, Healthcare=0.3747, Nature=0.4655, Sales=0.5516, Transport=0.4192, Web/CloudOps=0.4307. +- Seasonal1.0, continuity1.0: skill0.356697; term short=0.3411, medium=0.3874, long=0.3657; domain Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303. + +E43 outcome: retain both corrections at full strength. Seasonal full strength wins at every cutoff. Full continuity wins the main screen and first earlier cutoff; removing or weakening it helps the second earlier cutoff. Half continuity has essentially the same three-cutoff average but lowers the main screen, so the current rule is retained. This confirms that the fixed corrections still contribute after additional pretraining. + +E39 pre-launch correction: require at least one strictly positive or negative observed value before imposing the corresponding training bound. All-zero contexts otherwise satisfy both signs and would force every quantile to zero. Such contexts retain the original unconstrained training forward pass; the existing final nonnegative inference projection remains unchanged. This correction was made before E39 training started. + +E44 selected: full validation0.371267 versus previous0.370171; matched direct screen0.375386 versus0.374500; earlier1 0.333401 versus0.332400; earlier2 0.357015 versus0.356697. All improve. Full package inference took116.2 seconds under concurrent training, with97 configurations and151170 instances, zero failures and no quantile crossings. Repeated relocated examples are bitwise identical. With the actual trained model, adding left padding to histories of lengths8/16/40 changes raw forecasts by at most3.82e-6 in float32, consistent with numerical reduction differences. The averaging width is now independent of batch padding and matches all pretraining context lengths. No training or parameter changes were needed. + +## E44 fixed128 trend summary full package validation +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371267; relative MASE 0.749824; relative WQL 0.527198. +- term skill: long=0.3932, medium=0.4057, short=0.3489. +- domain skill: Econ/Fin=0.1097, Energy=0.2283, Healthcare=0.4445, Nature=0.4270, Sales=0.3536, Transport=0.4653, Web/CloudOps=0.4932. +- frequency skill: A=0.2900, D=0.3545, H=0.3906, M=0.1144, Q=0.1842, S=0.4218, T=0.4285, W=0.2081. +- variates skill: multivariate=0.3889, univariate=0.3569. +- Outcome: Published atomically. Full0.371267, screen0.375386, first earlier0.333401, second earlier0.357015. All improve over the previous package; repeated relocated inference is bitwise deterministic and all151170 instances score successfully. + +## E44 first earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.190837860107422 seconds. +- Overall skill 0.333401; relative MASE 0.800857; relative WQL 0.554849. +- term skill: long=0.3980, medium=0.3574, short=0.2971. +- domain skill: Econ/Fin=0.1546, Energy=0.2269, Healthcare=0.4152, Nature=0.3561, Sales=0.3982, Transport=0.3697, Web/CloudOps=0.4472. +- frequency skill: A=0.3057, D=0.3535, H=0.3642, M=0.1858, Q=0.2322, S=0.3397, T=0.3325, W=0.2671. +- variates skill: multivariate=0.3493, univariate=0.3205. +- Outcome: Improves the preceding published package. + +## E44 second earlier diagnostic +- Checkpoint SHA-256: `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.125259160995483 seconds. +- Overall skill 0.357015; relative MASE 0.773709; relative WQL 0.534347. +- term skill: long=0.3657, medium=0.3874, short=0.3417. +- domain skill: Econ/Fin=0.1037, Energy=0.2341, Healthcare=0.3586, Nature=0.4669, Sales=0.5519, Transport=0.4175, Web/CloudOps=0.4304. +- frequency skill: A=0.3474, D=0.4297, H=0.3890, M=0.1482, Q=0.1491, S=0.2798, T=0.3574, W=0.2484. +- variates skill: multivariate=0.3619, univariate=0.3530. +- Outcome: Improves the preceding published package. + +E35 follow-up: compare both6000-step models again with the now-selected E44 fixed128 basis and E37 zero0.4 rule. The old adaptive-width basis may interact with the new learned short-trend features, so this paired diagnostic will check whether their small gain changes once training/inference formulas agree. No retraining or new thresholds. + +## E31 amplitude synthetic12000-step screen +- Checkpoint SHA-256: `88d6ebecc5342e428b803fcb60af38cafa8f94383976621f3f200abee9b2eb0e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.205806970596313 seconds. +- Overall skill 0.358165; relative MASE 0.764973; relative WQL 0.538519. +- term skill: long=0.3902, medium=0.4022, short=0.3275. +- domain skill: Econ/Fin=0.1122, Energy=0.1848, Healthcare=0.3959, Nature=0.4185, Sales=0.3479, Transport=0.4568, Web/CloudOps=0.5094. +- frequency skill: A=0.3775, D=0.3345, H=0.3814, M=0.0974, Q=0.1993, S=0.4416, T=0.4040, W=0.1998. +- variates skill: multivariate=0.3933, univariate=0.3287. +- Outcome: Mean-template screen0.358165 remains above matched E25-12000 0.357241, after gains at3000 and6000. The advantage is smaller than at6000; continue to18000 and24000 before selecting a new package. + +## E35 explicit trend6000-step screen +- Checkpoint SHA-256: `2ad3f9148954d7b3a16365ec529767cc3a0803b4488c7a475838725497c13565`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.423240423202515 seconds. +- Overall skill 0.353152; relative MASE 0.769279; relative WQL 0.543902. +- term skill: long=0.3873, medium=0.3990, short=0.3208. +- domain skill: Econ/Fin=0.1103, Energy=0.1816, Healthcare=0.3998, Nature=0.4115, Sales=0.3496, Transport=0.4548, Web/CloudOps=0.4989. +- frequency skill: A=0.3705, D=0.3396, H=0.3769, M=0.0764, Q=0.1986, S=0.4369, T=0.3960, W=0.1933. +- variates skill: multivariate=0.3851, univariate=0.3265. +- Outcome: Mean-template screen0.353152 versus matched E25 0.352851; earlier1 0.323894 versus0.324008; earlier2 0.349429 versus0.349098. With all selected fixed rules, screen0.366300 versus matched0.366032. The effect remains small; retain checkpoints and compare at12000. + +amplitude_synth through12000: 3311.5 elapsed training-process seconds on the shared H100. + +trend_features through6000: 1795.6 elapsed training-process seconds on the shared H100. + +E39 bounded quantiles training started at 2026-10-22T04:19:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E25 recency final24000-step matched mean-template screen +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.549001216888428 seconds. +- Overall skill 0.361808; relative MASE 0.760201; relative WQL 0.535765. +- term skill: long=0.3930, medium=0.4043, short=0.3321. +- domain skill: Econ/Fin=0.1144, Energy=0.1875, Healthcare=0.4304, Nature=0.4242, Sales=0.3432, Transport=0.4595, Web/CloudOps=0.5080. +- frequency skill: A=0.3731, D=0.3487, H=0.3832, M=0.0957, Q=0.1965, S=0.4423, T=0.4054, W=0.2079. +- variates skill: multivariate=0.3953, univariate=0.3338. +- Outcome: Final screen0.361808 versus matched E22-24000 0.359867. The learned recency features improve the matched comparison at every evaluated checkpoint. Completed5879.4 elapsed training-process seconds; full validation with selected fixed rules is pending. + +## E38 expanded corpus3000-step screen +- Checkpoint SHA-256: `13cb3d2a222cd09f622eff3fe1657c4aebe2b1f2ca22a226462ecd0bb2c94026`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.664713144302368 seconds. +- Overall skill 0.358667; relative MASE 0.763557; relative WQL 0.538674. +- term skill: long=0.3925, medium=0.4038, short=0.3268. +- domain skill: Econ/Fin=0.1145, Energy=0.1852, Healthcare=0.4021, Nature=0.4196, Sales=0.3470, Transport=0.4576, Web/CloudOps=0.5080. +- frequency skill: A=0.3749, D=0.3373, H=0.3835, M=0.0979, Q=0.1983, S=0.4405, T=0.4029, W=0.1974. +- variates skill: multivariate=0.3933, univariate=0.3297. +- Outcome: Screen0.358667 versus matched packed_sample control0.358802: nearly tied. Broader corpus coverage has not yet provided a clear advantage. Continue to6000 and12000; source probabilities remain fixed to the original mixture. + +## E38 packed_sample control6000-step screen +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.290119647979736 seconds. +- Overall skill 0.358628; relative MASE 0.763471; relative WQL 0.538799. +- term skill: long=0.3894, medium=0.4025, short=0.3286. +- domain skill: Econ/Fin=0.1093, Energy=0.1839, Healthcare=0.4157, Nature=0.4245, Sales=0.3451, Transport=0.4579, Web/CloudOps=0.5041. +- frequency skill: A=0.3762, D=0.3427, H=0.3805, M=0.1014, Q=0.1966, S=0.4404, T=0.4018, W=0.2035. +- variates skill: multivariate=0.3910, univariate=0.3316. +- Outcome: Screen0.358628 versus this restart at3000 0.358802. This restart has not surpassed uninterrupted E25 continuation. Retain as the matched control for corpus coverage, bounded quantiles and partial target horizons; assess after learning-rate decay. + +## E45: average late recency checkpoints +Hypothesis: uniform parameter averaging of the same training trajectory can reduce checkpoint variation without adding inference cost. Average own E25 EMA checkpoints at18000/21000/24000 in FP32, retaining their shared configuration. This is one model with fixed averaged weights; every parent was trained here from the same random-initialization lineage, seed59. No additional data or gradient updates. Use the selected aligned seasonal rule, continuity, zero0.4 and fixed128 trend basis. Evaluate all three cutoffs before building a full candidate. The averaging script and every parent hash are preserved. + +E25 final24000-step package selected: full0.371479 versus18000-step0.371267; direct screen0.375502 versus0.375386; first earlier0.334180 versus0.333401; second earlier0.358275 versus0.357015. All improve. Full inference126.1 seconds under concurrent training;97 configurations,151170 instances, zero failures and no quantile crossings. Repeated relocated examples are bitwise identical, finite and monotone. Fixed rules are unchanged from E44. + +E45 outcome: the uniform18000/21000/24000 EMA average scores0.375408/0.333912/0.358081 on the three cutoffs, below the final24000 checkpoint at0.375502/0.334180/0.358275 on every cutoff. Not selected; no full package evaluation. No training compute; parameter averaging was not separately timed, and individual diagnostic evaluation times are recorded below. + +## E25 final24000-step package with selected fixed rules +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371479; relative MASE 0.748783; relative WQL 0.527575. +- term skill: long=0.3935, medium=0.4057, short=0.3491. +- domain skill: Econ/Fin=0.1165, Energy=0.2279, Healthcare=0.4442, Nature=0.4287, Sales=0.3521, Transport=0.4652, Web/CloudOps=0.4925. +- frequency skill: A=0.2919, D=0.3570, H=0.3902, M=0.1164, Q=0.1836, S=0.4232, T=0.4289, W=0.2028. +- variates skill: multivariate=0.3893, univariate=0.3569. +- Outcome: Published atomically. Full0.371479, screen0.375502, earlier1 0.334180, earlier2 0.358275. All improve over the preceding18000-step package. All151170 instances score; repeated relocated examples are bitwise deterministic, finite and monotone. + +## Published recency24000 first earlier diagnostic +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.669825792312622 seconds. +- Overall skill 0.334180; relative MASE 0.799611; relative WQL 0.554415. +- term skill: long=0.3968, medium=0.3571, short=0.2993. +- domain skill: Econ/Fin=0.1593, Energy=0.2277, Healthcare=0.4063, Nature=0.3608, Sales=0.3980, Transport=0.3712, Web/CloudOps=0.4466. +- frequency skill: A=0.3097, D=0.3512, H=0.3634, M=0.1820, Q=0.2352, S=0.3426, T=0.3343, W=0.2771. +- variates skill: multivariate=0.3511, univariate=0.3204. +- Outcome: Improves the preceding package. + +## Published recency24000 second earlier diagnostic +- Checkpoint SHA-256: `1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.378834009170532 seconds. +- Overall skill 0.358275; relative MASE 0.771140; relative WQL 0.534029. +- term skill: long=0.3653, medium=0.3854, short=0.3449. +- domain skill: Econ/Fin=0.1098, Energy=0.2362, Healthcare=0.3503, Nature=0.4701, Sales=0.5516, Transport=0.4194, Web/CloudOps=0.4299. +- frequency skill: A=0.3501, D=0.4315, H=0.3891, M=0.1569, Q=0.1519, S=0.2833, T=0.3571, W=0.2551. +- variates skill: multivariate=0.3625, univariate=0.3548. +- Outcome: Improves the preceding package. + +## E45 averaged late EMA screen +- Checkpoint SHA-256: `9b3541cfc195324574d22e27a8e3ac38edf7408712372933c645c892f39fa746`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.790673971176147 seconds. +- Overall skill 0.375408; relative MASE 0.746595; relative WQL 0.522527. +- term skill: long=0.3999, medium=0.4064, short=0.3534. +- domain skill: Econ/Fin=0.1379, Energy=0.2352, Healthcare=0.4383, Nature=0.4274, Sales=0.3404, Transport=0.4653, Web/CloudOps=0.5004. +- frequency skill: A=0.3761, D=0.3516, H=0.3953, M=0.0934, Q=0.2004, S=0.4222, T=0.4355, W=0.2141. +- variates skill: multivariate=0.3931, univariate=0.3610. +- Outcome: Below the final24000 checkpoint on all three cutoffs; not selected. + +## E42 partial target horizons3000-step screen +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.083299160003662 seconds. +- Overall skill 0.358812; relative MASE 0.763592; relative WQL 0.538405. +- term skill: long=0.3907, medium=0.4016, short=0.3287. +- domain skill: Econ/Fin=0.1123, Energy=0.1842, Healthcare=0.4163, Nature=0.4220, Sales=0.3469, Transport=0.4589, Web/CloudOps=0.5047. +- frequency skill: A=0.3754, D=0.3440, H=0.3817, M=0.1026, Q=0.1980, S=0.4409, T=0.3995, W=0.2076. +- variates skill: multivariate=0.3908, univariate=0.3321. +- Outcome: Screen0.358812 versus matched control0.358802 is effectively tied. Gains in annual, quarterly, monthly and weekly groups are offset by minute-frequency losses. Continue to6000 and12000 to assess persistence. + +## E46: use forecast slopes for the fixed continuity correction +A per-channel diagnostic found that several ETT2 short-horizon forecasts underreact to a rebound after the latest trough: truth rises about1.1–1.9 context standard deviations in multiple channels, while the model rises only0.6–0.9. The current continuity anchor extrapolates the previous eight differences and may continue the old direction across a turn. Keep the smoothness gate, tau24, seasonal rule and zero0.4 fixed; compare past8 (current), zero slope, first forecast difference, and median of the first eight forecast differences. These are fixed transformations, with no fitting. Reuse the E25-18000 raw forecast caches for a paired diagnostic on all three cutoffs; their old short-context trend basis is unchanged within this comparison. Any selected variant must transfer to the latest fixed128 package before publication. + +## E47: frozen-backbone confidence-query projection (prepared) +Hypothesis: fixed lag-difference statistics provide information about local noise and seasonal repeatability that the decoder may otherwise infer inefficiently from raw patches. Add a zero-initialized linear projection of six log-scaled normalized statistics: MAE and RMS difference at lag1 over512 points, and at each of the two frequency-derived periods over at most8 cycles. Fewer than8 valid pairs use neutral defaults1 and sqrt(2). The3072 new parameters affect decoder queries; freeze the complete E25 recency24000 backbone. Train with the original weighted quantile/median loss after averaging both sign orientations, matching inference. Own packed_sample and unchanged local generator, seed89, planned6000 steps atLR2e-4. Choose batch64 or32 after measuring maximum-shape memory, keeping the six existing trainers and serialized evaluations within the one H100. No new training data. + +E47 memory check at batch64 (paired batch128), context4096 and horizon1024 used1134.4 MiB peak allocated and1160.0 MiB peak reserved Torch memory. Gradients were finite; no optimizer update or checkpoint was made from the random fixture. Start the planned6000-step run at batch64 with only3072 trainable parameters. + +## E46 complete slope comparison +No training; checkpoint SHA-256 `f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd`; fixed inference seed0. + +screen: 9.50 CPU diagnostic seconds. +- past8: skill0.374500; term short=0.3517, medium=0.4069, long=0.3994; domain Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- none: skill0.370718; term short=0.3457, medium=0.4054, long=0.3986; domain Econ/Fin=0.1111, Energy=0.2246, Healthcare=0.4321, Nature=0.4266, Sales=0.3438, Transport=0.4648, Web/CloudOps=0.4996; freq A-DEC=0.3202, Q-DEC=0.1821, M=0.1025, W-SUN=0.0486, D=0.3438, H=0.3946, 15T=0.2087, W-FRI=0.0306, 10T=0.5876, W-TUE=0.5831, W-THU=0.1779, W-WED=0.3133, 5T=0.5117, 10S=0.4176. +- future1: skill0.374205; term short=0.3511, medium=0.4072, long=0.3991; domain Econ/Fin=0.1137, Energy=0.2347, Healthcare=0.4268, Nature=0.4274, Sales=0.3439, Transport=0.4665, Web/CloudOps=0.5017; freq A-DEC=0.3598, Q-DEC=0.1662, M=0.1001, W-SUN=0.0181, D=0.3420, H=0.3984, 15T=0.2072, W-FRI=0.0122, 10T=0.6164, W-TUE=0.5675, W-THU=0.1755, W-WED=0.3133, 5T=0.5109, 10S=0.4256. +- future8: skill0.373161; term short=0.3495, medium=0.4067, long=0.3990; domain Econ/Fin=0.1251, Energy=0.2298, Healthcare=0.4305, Nature=0.4272, Sales=0.3439, Transport=0.4643, Web/CloudOps=0.5016; freq A-DEC=0.3602, Q-DEC=0.1852, M=0.1008, W-SUN=0.0383, D=0.3439, H=0.3960, 15T=0.2096, W-FRI=-0.0017, 10T=0.6059, W-TUE=0.5789, W-THU=0.1738, W-WED=0.3133, 5T=0.5112, 10S=0.4252. + +backcast: 9.40 CPU diagnostic seconds. +- past8: skill0.332400; term short=0.2953, medium=0.3574, long=0.3980; domain Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- none: skill0.329297; term short=0.2895, medium=0.3574, long=0.3980; domain Econ/Fin=0.1286, Energy=0.2253, Healthcare=0.3653, Nature=0.3586, Sales=0.3986, Transport=0.3702, Web/CloudOps=0.4470; freq A-DEC=0.2562, Q-DEC=0.2285, M=0.1591, W-SUN=-0.0090, D=0.3530, H=0.3630, 15T=0.2276, W-FRI=0.2653, 10T=0.3102, W-TUE=0.4340, W-THU=0.1790, W-WED=0.3474, 5T=0.4328, 10S=0.3392. +- future1: skill0.331443; term short=0.2936, medium=0.3572, long=0.3981; domain Econ/Fin=0.1560, Energy=0.2259, Healthcare=0.3803, Nature=0.3573, Sales=0.3986, Transport=0.3708, Web/CloudOps=0.4467; freq A-DEC=0.2946, Q-DEC=0.2075, M=0.1779, W-SUN=-0.0420, D=0.3531, H=0.3699, 15T=0.2218, W-FRI=0.2626, 10T=0.3062, W-TUE=0.4321, W-THU=0.1844, W-WED=0.3474, 5T=0.4320, 10S=0.3387. +- future8: skill0.330724; term short=0.2923, medium=0.3572, long=0.3980; domain Econ/Fin=0.1495, Energy=0.2260, Healthcare=0.3767, Nature=0.3568, Sales=0.3986, Transport=0.3706, Web/CloudOps=0.4462; freq A-DEC=0.2971, Q-DEC=0.2312, M=0.1706, W-SUN=-0.0239, D=0.3528, H=0.3662, 15T=0.2272, W-FRI=0.2646, 10T=0.3066, W-TUE=0.4419, W-THU=0.1812, W-WED=0.3474, 5T=0.4320, 10S=0.3363. + +backcast2: 9.16 CPU diagnostic seconds. +- past8: skill0.356697; term short=0.3411, medium=0.3874, long=0.3657; domain Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- none: skill0.356132; term short=0.3406, medium=0.3873, long=0.3643; domain Econ/Fin=0.0852, Energy=0.2311, Healthcare=0.3675, Nature=0.4661, Sales=0.5516, Transport=0.4189, Web/CloudOps=0.4316; freq A-DEC=0.3237, Q-DEC=0.1547, M=0.1618, W-SUN=0.0515, D=0.4258, H=0.3870, 15T=0.1053, W-FRI=0.1317, 10T=0.4935, W-TUE=0.1348, W-THU=0.2945, W-WED=0.5352, 5T=0.4648, 10S=0.2854. +- future1: skill0.355261; term short=0.3386, medium=0.3872, long=0.3657; domain Econ/Fin=0.1174, Energy=0.2356, Healthcare=0.3303, Nature=0.4652, Sales=0.5516, Transport=0.4184, Web/CloudOps=0.4253; freq A-DEC=0.3497, Q-DEC=0.1386, M=0.1530, W-SUN=0.0379, D=0.4238, H=0.3954, 15T=0.1038, W-FRI=0.1264, 10T=0.4929, W-TUE=-0.1191, W-THU=0.2956, W-WED=0.5352, 5T=0.4644, 10S=0.2668. +- future8: skill0.355137; term short=0.3386, medium=0.3873, long=0.3650; domain Econ/Fin=0.1032, Energy=0.2310, Healthcare=0.3342, Nature=0.4659, Sales=0.5516, Transport=0.4189, Web/CloudOps=0.4316; freq A-DEC=0.3492, Q-DEC=0.1479, M=0.1571, W-SUN=0.0462, D=0.4251, H=0.3890, 15T=0.1053, W-FRI=0.1264, 10T=0.4931, W-TUE=-0.1021, W-THU=0.2982, W-WED=0.5352, 5T=0.4643, 10S=0.2886. + +E46 outcome: retain the existing past-eight-difference slope. It beats zero slope and both forecast-derived slopes on every cutoff. The local turning-point explanation does not justify changing the global correction. + +## E48: phase diffusion in synthetic seasonal series (queued) +Hypothesis: varying seasonal phase teaches the model when distant cycles should lose confidence, complementing E31's amplitude variation. Keep E31 unchanged except that half of synthetic calls add a Brownian phase to each Fourier period, shared across its harmonics. Draw one-cycle fundamental correlation log-uniformly from 0.90 to 0.999, with increment standard deviation sqrt(-2 log(correlation) / period). Phase RNG seed is 200062, independent of sampler seed 59 and amplitude seed 100062. Real corpus windows, frequency choices, all original generator draws, and amplitude draws remain matched to E31. A data-only check of 256 rows at each synthetic fraction 0, 0.2 and 1 verified equal original and amplitude RNG states; all corpus-only arrays were bitwise equal, and every finite output stayed finite (8.30 CPU seconds). No validation labels are used in this generator or training. + +Initialize from our E17 patch16 EMA6000; same E25 architecture, batch 256, LR 8e-5, 24000-step cosine schedule, seed 59, save every 3000. Compare to cached E31 at matched checkpoints and three cutoffs before publication. Queue after E38 control completes 12000, retaining at most six heavy trainers on the one H100. Directory phase_synth contains code and sampler_check.json; generator must be declared separately in sources_used if selected. + +## E49: uncertainty shape in the fixed seasonal correction +Hypothesis: rare seasonal jumps inflate Gaussian RMS intervals in otherwise regular series. Keep the selected seasonal median, confidence gate, continuity correction and zero projection fixed; compare Gaussian RMS intervals with centered empirical seasonal-difference quantiles and Gaussian MAD intervals. All widths use the same sqrt((1+1/cycles)/2) averaging correction. Empirical residual median is subtracted so the median forecast is unchanged. These are fixed context formulas, with no optimization. Reuse E25-18000 raw caches for an inexpensive paired test across three cutoffs; transfer any consistent improvement to the current E25-24000 fixed128 runtime before publication. No training and no new sources. + +## E38 expanded-corpus 6000-step screen +- Checkpoint SHA-256: `6f0068b79fbc501fb1ec9a76c88d91ceb9ffca46096900c18f5157a19784678f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.27088236808777 seconds. +- Overall skill 0.358532; relative MASE 0.764393; relative WQL 0.538311. +- term skill: long=0.3918, medium=0.4028, short=0.3272. +- domain skill: Econ/Fin=0.1142, Energy=0.1855, Healthcare=0.3972, Nature=0.4197, Sales=0.3475, Transport=0.4581, Web/CloudOps=0.5080. +- frequency skill: A=0.3713, D=0.3310, H=0.3829, M=0.1077, Q=0.2043, S=0.4384, T=0.4038, W=0.2044. +- variates skill: multivariate=0.3933, univariate=0.3295. +- Outcome: Skill 0.358532 versus matched control 0.358628: near tie, with no demonstrated benefit from the larger packed corpus. Continue to 12000. + +## E39 bounded quantiles 3000-step screen +- Checkpoint SHA-256: `3932f19e396a2ec597a047116ad2e4b680a0e7c9638472434388843bd358b4c7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.178418159484863 seconds. +- Overall skill 0.358466; relative MASE 0.764176; relative WQL 0.538575. +- term skill: long=0.3917, medium=0.4021, short=0.3274. +- domain skill: Econ/Fin=0.1098, Energy=0.1842, Healthcare=0.4143, Nature=0.4191, Sales=0.3505, Transport=0.4583, Web/CloudOps=0.5059. +- frequency skill: A=0.3753, D=0.3428, H=0.3828, M=0.0891, Q=0.1957, S=0.4411, T=0.4011, W=0.1992. +- variates skill: multivariate=0.3924, univariate=0.3301. +- Outcome: Skill 0.358466 versus control 0.358802: a small regression. Continue to 6000 before selection. + +## E35 trend-query features 12000-step screen +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.890631914138794 seconds. +- Overall skill 0.357547; relative MASE 0.765787; relative WQL 0.538983. +- term skill: long=0.3905, medium=0.4007, short=0.3268. +- domain skill: Econ/Fin=0.1107, Energy=0.1852, Healthcare=0.4068, Nature=0.4159, Sales=0.3502, Transport=0.4572, Web/CloudOps=0.5058. +- frequency skill: A=0.3786, D=0.3384, H=0.3803, M=0.0973, Q=0.2012, S=0.4413, T=0.4010, W=0.2023. +- variates skill: multivariate=0.3916, univariate=0.3291. +- Outcome: Skill 0.357547 versus recency control 0.357241: another small gain. Matched earlier-cutoff checks are running. + +## E31 amplitude variation 18000-step screen +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.11006808280945 seconds. +- Overall skill 0.361640; relative MASE 0.761418; relative WQL 0.535190. +- term skill: long=0.3939, medium=0.4045, short=0.3314. +- domain skill: Econ/Fin=0.1093, Energy=0.1877, Healthcare=0.4199, Nature=0.4206, Sales=0.3451, Transport=0.4594, Web/CloudOps=0.5124. +- frequency skill: A=0.3693, D=0.3400, H=0.3834, M=0.0980, Q=0.2014, S=0.4419, T=0.4075, W=0.2126. +- variates skill: multivariate=0.3966, univariate=0.3324. +- Outcome: Skill 0.361640 versus recency control 0.361265: a small gain persists. Transfer to the current fixed inference rules on three cutoffs before selection. + +## E42 paired comparison: large_corpus_control 6000, screen +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.290119647979736 seconds. +- Overall skill 0.358628; relative MASE 0.763471; relative WQL 0.538799. +- term skill: long=0.3894, medium=0.4025, short=0.3286. +- domain skill: Econ/Fin=0.1093, Energy=0.1839, Healthcare=0.4157, Nature=0.4245, Sales=0.3451, Transport=0.4579, Web/CloudOps=0.5041. +- frequency skill: A=0.3762, D=0.3427, H=0.3805, M=0.1014, Q=0.1966, S=0.4404, T=0.4018, W=0.2035. +- variates skill: multivariate=0.3910, univariate=0.3316. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, screen +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.865007400512695 seconds. +- Overall skill 0.359222; relative MASE 0.762879; relative WQL 0.538220. +- term skill: long=0.3896, medium=0.4026, short=0.3295. +- domain skill: Econ/Fin=0.1138, Energy=0.1865, Healthcare=0.4140, Nature=0.4258, Sales=0.3420, Transport=0.4581, Web/CloudOps=0.5030. +- frequency skill: A=0.3767, D=0.3422, H=0.3805, M=0.1063, Q=0.1975, S=0.4407, T=0.4017, W=0.2108. +- variates skill: multivariate=0.3906, univariate=0.3331. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: large_corpus_control 6000, backcast +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.584256172180176 seconds. +- Overall skill 0.329632; relative MASE 0.806661; relative WQL 0.557102. +- term skill: long=0.3889, medium=0.3561, short=0.2948. +- domain skill: Econ/Fin=0.1442, Energy=0.2289, Healthcare=0.4117, Nature=0.3487, Sales=0.3954, Transport=0.3632, Web/CloudOps=0.4421. +- frequency skill: A=0.3117, D=0.3564, H=0.3572, M=0.1570, Q=0.2265, S=0.3417, T=0.3299, W=0.2668. +- variates skill: multivariate=0.3466, univariate=0.3158. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, backcast +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.306365728378296 seconds. +- Overall skill 0.330300; relative MASE 0.806062; relative WQL 0.556406. +- term skill: long=0.3903, medium=0.3564, short=0.2953. +- domain skill: Econ/Fin=0.1490, Energy=0.2297, Healthcare=0.4089, Nature=0.3480, Sales=0.3970, Transport=0.3635, Web/CloudOps=0.4436. +- frequency skill: A=0.3192, D=0.3533, H=0.3582, M=0.1614, Q=0.2265, S=0.3433, T=0.3300, W=0.2726. +- variates skill: multivariate=0.3477, univariate=0.3161. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: large_corpus_control 6000, backcast2 +- Checkpoint SHA-256: `3b6a1f25cef4ecafcb7bde8ee9faf1cbe4c68a0c2fbb9594ce26eb3c222f3720`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.882598161697388 seconds. +- Overall skill 0.352570; relative MASE 0.776245; relative WQL 0.539992. +- term skill: long=0.3679, medium=0.3749, short=0.3381. +- domain skill: Econ/Fin=0.0867, Energy=0.2280, Healthcare=0.3674, Nature=0.4604, Sales=0.5586, Transport=0.4130, Web/CloudOps=0.4272. +- frequency skill: A=0.3401, D=0.4293, H=0.3864, M=0.1768, Q=0.1515, S=0.2810, T=0.3448, W=0.2406. +- variates skill: multivariate=0.3588, univariate=0.3475. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E42 paired comparison: partial_targets 6000, backcast2 +- Checkpoint SHA-256: `67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.302276849746704 seconds. +- Overall skill 0.352901; relative MASE 0.775671; relative WQL 0.539838. +- term skill: long=0.3689, medium=0.3760, short=0.3379. +- domain skill: Econ/Fin=0.0894, Energy=0.2294, Healthcare=0.3710, Nature=0.4595, Sales=0.5574, Transport=0.4132, Web/CloudOps=0.4264. +- frequency skill: A=0.3430, D=0.4260, H=0.3868, M=0.1778, Q=0.1500, S=0.2820, T=0.3450, W=0.2490. +- variates skill: multivariate=0.3587, univariate=0.3482. +- Outcome: Matched seed 79, same parent and data stream. This isolates training with per-row available target horizons; assess the three cutoffs jointly. + +## E49 complete seasonal interval comparison +No training; inference seed 0. Own E25-18000 checkpoint SHA-256 f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd. + +screen: 12.53 CPU diagnostic seconds. +- gaussian: skill 0.374500; term: short=0.3517, medium=0.4069, long=0.3994; domain: Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- empirical: skill 0.374034; term: short=0.3515, medium=0.4062, long=0.3984; domain: Econ/Fin=0.1322, Energy=0.2332, Healthcare=0.4326, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5005; freq: A-DEC=0.3692, Q-DEC=0.2007, M=0.1029, W-SUN=0.0515, D=0.3443, H=0.3941, 15T=0.2120, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4208. +- mad: skill 0.373768; term: short=0.3513, medium=0.4061, long=0.3979; domain: Econ/Fin=0.1328, Energy=0.2325, Healthcare=0.4325, Nature=0.4254, Sales=0.3438, Transport=0.4649, Web/CloudOps=0.5001; freq: A-DEC=0.3692, Q-DEC=0.2007, M=0.1027, W-SUN=0.0515, D=0.3444, H=0.3938, 15T=0.2115, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4194. + +backcast: 12.04 CPU diagnostic seconds. +- gaussian: skill 0.332400; term: short=0.2953, medium=0.3574, long=0.3980; domain: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- empirical: skill 0.332227; term: short=0.2954, medium=0.3563, long=0.3981; domain: Econ/Fin=0.1521, Energy=0.2257, Healthcare=0.3995, Nature=0.3558, Sales=0.3986, Transport=0.3697, Web/CloudOps=0.4482; freq: A-DEC=0.2996, Q-DEC=0.2331, M=0.1717, W-SUN=-0.0053, D=0.3516, H=0.3630, 15T=0.2257, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4330, 10S=0.3436. +- mad: skill 0.331760; term: short=0.2949, medium=0.3559, long=0.3977; domain: Econ/Fin=0.1517, Energy=0.2248, Healthcare=0.3984, Nature=0.3554, Sales=0.3986, Transport=0.3696, Web/CloudOps=0.4480; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1720, W-SUN=-0.0052, D=0.3511, H=0.3620, 15T=0.2253, W-FRI=0.2597, 10T=0.3129, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4330, 10S=0.3430. + +backcast2: 10.81 CPU diagnostic seconds. +- gaussian: skill 0.356697; term: short=0.3411, medium=0.3874, long=0.3657; domain: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq: A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- empirical: skill 0.356537; term: short=0.3408, medium=0.3876, long=0.3655; domain: Econ/Fin=0.1035, Energy=0.2316, Healthcare=0.3619, Nature=0.4656, Sales=0.5516, Transport=0.4178, Web/CloudOps=0.4315; freq: A-DEC=0.3474, Q-DEC=0.1549, M=0.1602, W-SUN=0.0311, D=0.4277, H=0.3876, 15T=0.1075, W-FRI=0.1243, 10T=0.4929, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2846. +- mad: skill 0.356717; term: short=0.3409, medium=0.3871, long=0.3665; domain: Econ/Fin=0.1039, Energy=0.2307, Healthcare=0.3619, Nature=0.4656, Sales=0.5516, Transport=0.4176, Web/CloudOps=0.4335; freq: A-DEC=0.3474, Q-DEC=0.1549, M=0.1602, W-SUN=0.0312, D=0.4278, H=0.3869, 15T=0.1072, W-FRI=0.1243, 10T=0.4929, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2923. + +Outcome: retain Gaussian RMS intervals. Centered empirical intervals lose at all three cutoffs. MAD loses on the main and first earlier cutoff, with only a negligible second-earlier gain. Median MASE is exactly unchanged for every setting as intended. No transfer or package change. + +## E35 matched 12000 comparison: recency_features, screen +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.589985609054565 seconds. +- Overall skill 0.357241; relative MASE 0.765658; relative WQL 0.539588. +- term skill: long=0.3912, medium=0.4026, short=0.3252. +- domain skill: Econ/Fin=0.1133, Energy=0.1855, Healthcare=0.3939, Nature=0.4171, Sales=0.3483, Transport=0.4566, Web/CloudOps=0.5065. +- frequency skill: A=0.3781, D=0.3343, H=0.3817, M=0.0906, Q=0.1961, S=0.4411, T=0.4020, W=0.1998. +- variates skill: multivariate=0.3920, univariate=0.3281. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, screen +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.890631914138794 seconds. +- Overall skill 0.357547; relative MASE 0.765787; relative WQL 0.538983. +- term skill: long=0.3905, medium=0.4007, short=0.3268. +- domain skill: Econ/Fin=0.1107, Energy=0.1852, Healthcare=0.4068, Nature=0.4159, Sales=0.3502, Transport=0.4572, Web/CloudOps=0.5058. +- frequency skill: A=0.3786, D=0.3384, H=0.3803, M=0.0973, Q=0.2012, S=0.4413, T=0.4010, W=0.2023. +- variates skill: multivariate=0.3916, univariate=0.3291. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: recency_features, backcast +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.742298364639282 seconds. +- Overall skill 0.328112; relative MASE 0.807765; relative WQL 0.558868. +- term skill: long=0.3899, medium=0.3548, short=0.2920. +- domain skill: Econ/Fin=0.1488, Energy=0.2248, Healthcare=0.4036, Nature=0.3514, Sales=0.3955, Transport=0.3613, Web/CloudOps=0.4413. +- frequency skill: A=0.3134, D=0.3558, H=0.3562, M=0.1567, Q=0.2256, S=0.3420, T=0.3267, W=0.2651. +- variates skill: multivariate=0.3435, univariate=0.3156. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, backcast +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.06494641304016 seconds. +- Overall skill 0.327724; relative MASE 0.808759; relative WQL 0.558826. +- term skill: long=0.3886, medium=0.3555, short=0.2916. +- domain skill: Econ/Fin=0.1436, Energy=0.2247, Healthcare=0.3984, Nature=0.3522, Sales=0.3952, Transport=0.3621, Web/CloudOps=0.4411. +- frequency skill: A=0.3149, D=0.3546, H=0.3559, M=0.1602, Q=0.2281, S=0.3419, T=0.3284, W=0.2545. +- variates skill: multivariate=0.3441, univariate=0.3144. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: recency_features, backcast2 +- Checkpoint SHA-256: `8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.009191036224365 seconds. +- Overall skill 0.353202; relative MASE 0.774939; relative WQL 0.539846. +- term skill: long=0.3671, medium=0.3766, short=0.3388. +- domain skill: Econ/Fin=0.0874, Energy=0.2254, Healthcare=0.3808, Nature=0.4621, Sales=0.5594, Transport=0.4116, Web/CloudOps=0.4293. +- frequency skill: A=0.3385, D=0.4312, H=0.3856, M=0.1786, Q=0.1474, S=0.2819, T=0.3451, W=0.2459. +- variates skill: multivariate=0.3594, univariate=0.3481. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E35 matched 12000 comparison: trend_features, backcast2 +- Checkpoint SHA-256: `269be0627257c53343aac6d0609231865bd112be7e01944d966624160150d4a8`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.192188262939453 seconds. +- Overall skill 0.353075; relative MASE 0.775525; relative WQL 0.539650. +- term skill: long=0.3664, medium=0.3761, short=0.3391. +- domain skill: Econ/Fin=0.0837, Energy=0.2262, Healthcare=0.3801, Nature=0.4640, Sales=0.5598, Transport=0.4112, Web/CloudOps=0.4272. +- frequency skill: A=0.3402, D=0.4277, H=0.3854, M=0.1847, Q=0.1490, S=0.2774, T=0.3477, W=0.2433. +- variates skill: multivariate=0.3593, univariate=0.3480. +- Outcome: Trend features gain slightly on the main screen but lose on both earlier cutoffs. Stop this branch; its extra features are not selected. + +## E50: paired-sign loss for a frozen-backbone output head +Hypothesis: training against the averaged positive/negative forecasts used at inference can improve calibration over separately scoring the two orientations. Both arms initialize from our selected E25-24000 checkpoint with fixed128 trend features and freeze every parameter except the existing 147744-parameter output head. Both forward the same context and its sign reflection, consuming identical seed97 data windows. Control scores each orientation independently; candidate averages the two normalized forecasts before the original weighted quantile/median loss. This isolates the loss rather than data augmentation or forward compute. Same packed_sample, original local generator and independent sign augmentation, batch64, LR5e-5, 6000-step cosine schedule, save1000. No new data, no validation training, no parameter additions. + +A maximum-shape random fixture (paired batch128, context4096, horizon1024) verified finite gradients and measured peak Torch allocation697 MiB for the individual-loss control and729 MiB for the paired-loss candidate, with822 MiB reserved in each. No optimizer update or checkpoint was made from the fixture. Start the control after the rejected E35 trainer exits; start the paired arm after E47 finishes, keeping to one H100. The same fixed runtime evaluates both. + +E50 head_control training started at 2026-10-22T04:52:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E50 head_paired training started at 2026-10-22T04:53:18Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E35 stopped cleanly at step 13309, with 4327.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `be7cce34037750ef56be8a183b68af46dc2deec184ad228cd4c60ab91b51eb48`. The last validation was the paired 12000-step comparison above; the stop checkpoint was saved for provenance, not selected. + +## E31 amplitude 18000 with selected fixed rules, screen +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.18380904197693 seconds. +- Overall skill 0.375271; relative MASE 0.747344; relative WQL 0.522231. +- term skill: long=0.4000, medium=0.4069, short=0.3529. +- domain skill: Econ/Fin=0.1337, Energy=0.2361, Healthcare=0.4224, Nature=0.4258, Sales=0.3419, Transport=0.4649, Web/CloudOps=0.5043. +- frequency skill: A=0.3721, D=0.3448, H=0.3951, M=0.0876, Q=0.2019, S=0.4223, T=0.4386, W=0.2158. +- variates skill: multivariate=0.3950, univariate=0.3591. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E31 amplitude 18000 with selected fixed rules, backcast +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.348726511001587 seconds. +- Overall skill 0.333200; relative MASE 0.800924; relative WQL 0.555137. +- term skill: long=0.3941, medium=0.3576, short=0.2985. +- domain skill: Econ/Fin=0.1568, Energy=0.2260, Healthcare=0.4100, Nature=0.3583, Sales=0.3987, Transport=0.3697, Web/CloudOps=0.4467. +- frequency skill: A=0.3095, D=0.3534, H=0.3637, M=0.1993, Q=0.2273, S=0.3378, T=0.3326, W=0.2601. +- variates skill: multivariate=0.3488, univariate=0.3205. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E31 amplitude 18000 with selected fixed rules, backcast2 +- Checkpoint SHA-256: `f0d8484d5f1bee554939ffbe769b95e42ba94e0739db7c680fac1c9a132f8f43`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.135295629501343 seconds. +- Overall skill 0.356896; relative MASE 0.774845; relative WQL 0.533762. +- term skill: long=0.3678, medium=0.3811, short=0.3433. +- domain skill: Econ/Fin=0.1063, Energy=0.2350, Healthcare=0.3543, Nature=0.4630, Sales=0.5538, Transport=0.4181, Web/CloudOps=0.4317. +- frequency skill: A=0.3487, D=0.4308, H=0.3887, M=0.1298, Q=0.1454, S=0.2825, T=0.3581, W=0.2487. +- variates skill: multivariate=0.3617, univariate=0.3530. +- Outcome: The earlier mean-template screening gain does not transfer to the selected aligned/zero0.4/fixed128 runtime: below recency18000 at every cutoff. Do not publish; finish the planned 24000 for a matched late comparison. + +## E51: last optimizer weights versus EMA weights +The late E25 EMA checkpoints continue to improve, and averaging older EMA checkpoints regressed in E45. Check whether the final optimizer iterate is ahead of its lagging EMA or instead suffers from update noise. No training or inference-rule change: evaluate step024000 against the selected ema024000 with the identical fixed128/aligned/zero0.4 runtime. Only transfer to earlier cutoffs and full validation if the main screen improves. Both candidates have the same seed59 training lineage. + +## E47 confidence projection 1000-step screen +- Checkpoint SHA-256: `b2df8695413e53c7d62ec8f265affc31a43ca26e7b99b50e0a75f47782b95bfe`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.31796908378601 seconds. +- Overall skill 0.375491; relative MASE 0.746025; relative WQL 0.522786. +- term skill: long=0.3994, medium=0.4067, short=0.3536. +- domain skill: Econ/Fin=0.1396, Energy=0.2349, Healthcare=0.4370, Nature=0.4288, Sales=0.3397, Transport=0.4653, Web/CloudOps=0.5002. +- frequency skill: A=0.3765, D=0.3531, H=0.3948, M=0.0934, Q=0.1985, S=0.4235, T=0.4361, W=0.2100. +- variates skill: multivariate=0.3936, univariate=0.3607. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +## E47 confidence projection 3000-step screen +- Checkpoint SHA-256: `653081261875b023a5d8dea02c999762fa8a2a4601ce7b6ad3b55559172290ab`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.364450693130493 seconds. +- Overall skill 0.375482; relative MASE 0.745987; relative WQL 0.522828. +- term skill: long=0.3995, medium=0.4066, short=0.3536. +- domain skill: Econ/Fin=0.1394, Energy=0.2348, Healthcare=0.4379, Nature=0.4283, Sales=0.3403, Transport=0.4653, Web/CloudOps=0.5004. +- frequency skill: A=0.3762, D=0.3534, H=0.3949, M=0.0912, Q=0.1983, S=0.4238, T=0.4362, W=0.2092. +- variates skill: multivariate=0.3937, univariate=0.3606. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +## E47 confidence projection 6000-step screen +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.593000650405884 seconds. +- Overall skill 0.375793; relative MASE 0.745649; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4406, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0954, Q=0.1982, S=0.4239, T=0.4362, W=0.2090. +- variates skill: multivariate=0.3937, univariate=0.3611. +- Outcome: Backbone unchanged. Earlier checkpoints essentially tied; the 6000-step checkpoint gains 0.000291 over the parent. Earlier-cutoff checks are pending before any selection. + +E47 completed 6000 steps in 818.8 elapsed training-loop seconds on the shared H100. Every original model tensor is bitwise equal to the frozen E25-24000 parent; only the 3072 confidence-projection parameters changed. + +E48 phase_synth training started at 2026-10-22T04:54:48Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E51 final optimizer iterate, screen +- Checkpoint SHA-256: `32b70d0e88532fb98746ea032c10be587383d80ed7b0951b41f778a39c9dc68b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.315549850463867 seconds. +- Overall skill 0.374536; relative MASE 0.746570; relative WQL 0.524003. +- term skill: long=0.3980, medium=0.4073, short=0.3522. +- domain skill: Econ/Fin=0.1389, Energy=0.2328, Healthcare=0.4348, Nature=0.4279, Sales=0.3409, Transport=0.4652, Web/CloudOps=0.4998. +- frequency skill: A=0.3701, D=0.3497, H=0.3936, M=0.0914, Q=0.1977, S=0.4222, T=0.4369, W=0.2087. +- variates skill: multivariate=0.3931, univariate=0.3594. +- Outcome: Skill 0.374536 is below the selected EMA24000 skill 0.375502. Retain EMA weights; no earlier-window or full evaluation is needed. + +## E39 bounded quantiles 6000-step screen +- Checkpoint SHA-256: `4af38aa561df4d38c1f6df090f8a5dc364c38786eb2ab38933646d827cbe7669`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.320833683013916 seconds. +- Overall skill 0.357854; relative MASE 0.764623; relative WQL 0.539287. +- term skill: long=0.3907, medium=0.4019, short=0.3268. +- domain skill: Econ/Fin=0.1103, Energy=0.1849, Healthcare=0.4072, Nature=0.4203, Sales=0.3470, Transport=0.4571, Web/CloudOps=0.5050. +- frequency skill: A=0.3756, D=0.3402, H=0.3810, M=0.0920, Q=0.1957, S=0.4423, T=0.4023, W=0.1961. +- variates skill: multivariate=0.3917, univariate=0.3295. +- Outcome: Skill 0.357854 is below matched control 0.358628, following a smaller 3000-step regression. Stop this branch; retain the current inference-only positivity projection. + +## E52: varied requested horizons during partial-target training +E42's correct per-row horizon conditioning improves all three cutoffs at 6000 steps. Hypothesis: exposing the decoder to intermediate requested horizons will also reduce mismatch between four fixed training horizon lengths and arbitrary inference lengths. Match E42's parent E25-12000, seed79, packed_sample, source probabilities, batch256, LR5e-5 and 12000-step schedule. Keep half the sampled target windows unchanged; for the other half, independently choose a prefix length uniformly from one-quarter to the full batch horizon, rounded upward to a 16-step patch boundary. Mask only later training labels. The existing E42 loss masks unused future tokens and sets each row's horizon metadata. Corpus contexts and periods, original generator and sampler random draws remain unchanged. Independent horizon RNG seed300082. + +A data-only check at all four horizon sizes verified identical context/period arrays and exact preservation of every retained target value (0.66 CPU seconds). No validation labels enter training. No new model parameters or inference behavior; this is a training-window augmentation. Start after rejected E39 exits and compare against cached E42 at 3000/6000/12000. + +E52 horizon_jitter training started at 2026-10-22T04:56:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E47 confidence projection 6000, backcast +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.725136041641235 seconds. +- Overall skill 0.334126; relative MASE 0.799732; relative WQL 0.554420. +- term skill: long=0.3968, medium=0.3571, short=0.2992. +- domain skill: Econ/Fin=0.1592, Energy=0.2275, Healthcare=0.4065, Nature=0.3605, Sales=0.3971, Transport=0.3716, Web/CloudOps=0.4467. +- frequency skill: A=0.3079, D=0.3510, H=0.3635, M=0.1810, Q=0.2346, S=0.3430, T=0.3344, W=0.2764. +- variates skill: multivariate=0.3510, univariate=0.3204. +- Outcome: Main screen gains 0.000291; first earlier cutoff loses only 0.000054; second earlier cutoff gains 0.000224. Proceed to full validation before deciding whether to replace the package. + +## E47 confidence projection 6000, backcast2 +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.6521155834198 seconds. +- Overall skill 0.358499; relative MASE 0.770987; relative WQL 0.533762. +- term skill: long=0.3652, medium=0.3856, short=0.3452. +- domain skill: Econ/Fin=0.1095, Energy=0.2361, Healthcare=0.3507, Nature=0.4706, Sales=0.5514, Transport=0.4202, Web/CloudOps=0.4300. +- frequency skill: A=0.3495, D=0.4316, H=0.3891, M=0.1571, Q=0.1507, S=0.2825, T=0.3576, W=0.2564. +- variates skill: multivariate=0.3624, univariate=0.3553. +- Outcome: Main screen gains 0.000291; first earlier cutoff loses only 0.000054; second earlier cutoff gains 0.000224. Proceed to full validation before deciding whether to replace the package. + +E39 stopped cleanly at step 6298, with 2199.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `d1018a12abdb14c369ba55a561c3091bbc7dc4b25337345a0af68aa15e9afec2`. This stop checkpoint was retained for provenance and was not selected. + +## E53: within-cycle variance for seasonal confidence +Hypothesis: total variance over up to eight cycles can be dominated by a long trend, artificially lowering the seasonal-difference/variance ratio and assigning high seasonal confidence even to a nonseasonal ramp. Change only the gate denominator to pooled within-cycle variance, subtracting each cycle's finite-observation mean before pooling squared deviations. Compare the existing global variance and this within-cycle variance, with the selected aligned template, Gaussian RMS intervals, continuity and zero0.4 unchanged. Use cached E25-18000 forecasts across three cutoffs; no training, optimization or new source data. A selected formula must transfer to the current checkpoint and fixed128 runtime before publication. + +## E47 confidence projection 6000, exact full package validation +- Checkpoint SHA-256: `0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.371766; relative MASE 0.748576; relative WQL 0.527239. +- term skill: long=0.3937, medium=0.4056, short=0.3496. +- domain skill: Econ/Fin=0.1167, Energy=0.2278, Healthcare=0.4464, Nature=0.4283, Sales=0.3521, Transport=0.4660, Web/CloudOps=0.4929. +- frequency skill: A=0.2915, D=0.3581, H=0.3903, M=0.1171, Q=0.1834, S=0.4239, T=0.4292, W=0.2017. +- variates skill: multivariate=0.3895, univariate=0.3573. +- Outcome: Selected for publication: skill 0.371766 versus 0.371479 for the previous package; relative MASE 0.748576 and WQL 0.527239. All 97 configurations and 151170 instances passed, with no quantile crossings. Actual package inference took 140.57 seconds on the one H100 while five heavy training runs and two head-only runs shared it. Relocation/determinism checks precede the atomic replacement. + +## E53 complete seasonal variance comparison +No training; inference seed 0. E25-18000 checkpoint SHA-256 f6d2c41a690159a5b9c2034be45718c408a30b0d34d9607c9a768b9926781bbd. + +screen: 8.50 CPU diagnostic seconds. +- global: skill 0.374500; term: short=0.3517, medium=0.4069, long=0.3994; domain: Econ/Fin=0.1332, Energy=0.2347, Healthcare=0.4319, Nature=0.4254, Sales=0.3438, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2006, M=0.1023, W-SUN=0.0521, D=0.3442, H=0.3953, 15T=0.2125, W-FRI=-0.0051, 10T=0.6138, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. +- within_cycle: skill 0.374386; term: short=0.3515, medium=0.4068, long=0.3994; domain: Econ/Fin=0.1320, Energy=0.2346, Healthcare=0.4305, Nature=0.4254, Sales=0.3450, Transport=0.4650, Web/CloudOps=0.5007; freq: A-DEC=0.3692, Q-DEC=0.2024, M=0.1005, W-SUN=0.0487, D=0.3444, H=0.3951, 15T=0.2124, W-FRI=-0.0050, 10T=0.6139, W-TUE=0.5773, W-THU=0.1903, W-WED=0.3133, 5T=0.5112, 10S=0.4218. + +backcast: 8.12 CPU diagnostic seconds. +- global: skill 0.332400; term: short=0.2953, medium=0.3574, long=0.3980; domain: Econ/Fin=0.1526, Energy=0.2268, Healthcare=0.3995, Nature=0.3561, Sales=0.3986, Transport=0.3699, Web/CloudOps=0.4472; freq: A-DEC=0.2996, Q-DEC=0.2330, M=0.1721, W-SUN=-0.0043, D=0.3516, H=0.3643, 15T=0.2254, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3397. +- within_cycle: skill 0.332143; term: short=0.2948, medium=0.3575, long=0.3979; domain: Econ/Fin=0.1529, Energy=0.2266, Healthcare=0.3952, Nature=0.3561, Sales=0.3986, Transport=0.3704, Web/CloudOps=0.4471; freq: A-DEC=0.2996, Q-DEC=0.2353, M=0.1665, W-SUN=-0.0082, D=0.3519, H=0.3640, 15T=0.2255, W-FRI=0.2597, 10T=0.3130, W-TUE=0.5335, W-THU=0.2049, W-WED=0.3474, 5T=0.4329, 10S=0.3396. + +backcast2: 7.99 CPU diagnostic seconds. +- global: skill 0.356697; term: short=0.3411, medium=0.3874, long=0.3657; domain: Econ/Fin=0.1045, Energy=0.2331, Healthcare=0.3610, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4303; freq: A-DEC=0.3474, Q-DEC=0.1548, M=0.1599, W-SUN=0.0316, D=0.4275, H=0.3891, 15T=0.1072, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4648, 10S=0.2798. +- within_cycle: skill 0.356794; term: short=0.3414, medium=0.3873, long=0.3654; domain: Econ/Fin=0.1040, Energy=0.2329, Healthcare=0.3653, Nature=0.4656, Sales=0.5516, Transport=0.4179, Web/CloudOps=0.4301; freq: A-DEC=0.3474, Q-DEC=0.1544, M=0.1677, W-SUN=0.0298, D=0.4273, H=0.3891, 15T=0.1064, W-FRI=0.1243, 10T=0.4930, W-TUE=0.0782, W-THU=0.3037, W-WED=0.5352, 5T=0.4647, 10S=0.2791. + +Outcome: retain total history variance. Within-cycle variance loses on the main and first earlier cutoff, with only a small second-earlier gain. The trend-related failure mode does not justify changing the global formula. + +E47 relocation and determinism passed: the candidate and a separately copied package in a fresh /tmp directory produced bitwise identical, finite, monotone quantiles for univariate daily, univariate hourly and multivariate medium-horizon examples. Both ran with /tmp as the working directory. Publish the complete candidate atomically after these checks. + +## E54: train the full model with longer raw context +E21's untrained extension and E29's frozen, coarsened history memory did not provide consistent gains. Hypothesis: adapting all existing parameters to raw 8192-point histories can use older cycles without the mismatch of an untrained extension or lossy extra memory. Two matched arms initialize from our E25-24000 EMA, with identical model size, original loss, seed101, packed_sample, source probabilities, batch128, LR3e-5 and 12000-step schedule. The sampler draws context sizes512/1024/2048/8192 with probabilities0.1/0.15/0.35/0.4 in both arms. The control then keeps only the last4096 points; the candidate keeps8192. Future labels and sampler RNG are matched exactly, including synthetic draws and aggregation. Both train every model parameter. This comparison changes only the retained raw history. + +At inference, positivity and the fixed seasonal rule continue to inspect only the recent4096 observations; continuity and zero projection retain their existing lookbacks. The candidate's neural encoder and normalization use up to8192. No external weights or new source data are introduced; the parameter count is unchanged. New generator/sign-augmentation seed101 must be declared if selected. Maximum-shape batch128/context8192/horizon1024 memory check, including allocated placeholders for Adam moments and EMA, measured9960 MiB peak allocated and10530 MiB reserved, with finite gradients in4.37 seconds. No optimizer update or checkpoint came from this random fixture. Queue the control after E50 head_control completes; queue the longer-context arm after E38 expanded corpus completes, preserving the one-H100 allocation. + +E54 data check passed in3.26 CPU seconds: all four sampled context sizes produced identical future labels, period metadata, overlapping recent history and sampler RNG states between the two arms. + +E54 long_context_control training started at 2026-10-22T05:04:35Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E55: transfer the matched partial-target training difference +E42's 6000-step checkpoint improves all three cutoffs over its exact seed/data/initialization-matched E38 control, but both restarted trajectories began from an older E25 checkpoint. Hypothesis: the parameter difference between these matched runs isolates a useful training correction that can transfer to the selected later model. Form one fixed model with weights = current E47 confidence6000 + E42 partial6000 - E38 control6000 for their common backbone tensors, leaving the confidence projection unchanged. Use coefficient1 with no grid search. This is a deterministic composition of our own trained weights, with all three parent hashes recorded. No new training or data, and one model forecasts every instance. Evaluate the main screen first; if promising, require earlier-cutoff and exact full-package checks. + +## E50 head_control 1000-step screen +- Checkpoint SHA-256: `a88f59494b256bf95addea9f00fa7b631cd67dc762228f523d95eec8047a05d8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.136118412017822 seconds. +- Overall skill 0.375630; relative MASE 0.745780; relative WQL 0.522726. +- term skill: long=0.3996, medium=0.4068, short=0.3537. +- domain skill: Econ/Fin=0.1403, Energy=0.2347, Healthcare=0.4405, Nature=0.4291, Sales=0.3396, Transport=0.4656, Web/CloudOps=0.4997. +- frequency skill: A=0.3779, D=0.3539, H=0.3951, M=0.0943, Q=0.1980, S=0.4231, T=0.4359, W=0.2102. +- variates skill: multivariate=0.3935, univariate=0.3610. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_control 3000-step screen +- Checkpoint SHA-256: `75b9f4860e4c4345f2cedb6eb2f9ffe5c9e65aede03a314c72b20b1e8a1f7aaf`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.069400310516357 seconds. +- Overall skill 0.375411; relative MASE 0.746024; relative WQL 0.522921. +- term skill: long=0.3996, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1387, Energy=0.2345, Healthcare=0.4401, Nature=0.4293, Sales=0.3399, Transport=0.4650, Web/CloudOps=0.4996. +- frequency skill: A=0.3759, D=0.3533, H=0.3949, M=0.0963, Q=0.1980, S=0.4231, T=0.4355, W=0.2102. +- variates skill: multivariate=0.3933, univariate=0.3608. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_control 6000-step screen +- Checkpoint SHA-256: `dd8fc459f097a0bc0c7cb133473130aa32e1dc520fd7f03ff50dc26366d1122e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.82920217514038 seconds. +- Overall skill 0.375304; relative MASE 0.746102; relative WQL 0.523045. +- term skill: long=0.3996, medium=0.4065, short=0.3532. +- domain skill: Econ/Fin=0.1404, Energy=0.2343, Healthcare=0.4375, Nature=0.4291, Sales=0.3402, Transport=0.4652, Web/CloudOps=0.4997. +- frequency skill: A=0.3770, D=0.3531, H=0.3950, M=0.0965, Q=0.1987, S=0.4230, T=0.4355, W=0.2086. +- variates skill: multivariate=0.3931, univariate=0.3607. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +E50 head_control completed6000 steps in 685.6 elapsed training-loop seconds. Every non-head tensor remains bitwise equal to the E25-24000 parent. + +## E50 head_paired 1000-step screen +- Checkpoint SHA-256: `337e19aac481543a8ba78bd837f00c8a714315313e665b1b5a038d009a905a2a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.40800166130066 seconds. +- Overall skill 0.375721; relative MASE 0.745631; relative WQL 0.522677. +- term skill: long=0.3997, medium=0.4067, short=0.3539. +- domain skill: Econ/Fin=0.1403, Energy=0.2344, Healthcare=0.4425, Nature=0.4292, Sales=0.3396, Transport=0.4658, Web/CloudOps=0.4998. +- frequency skill: A=0.3786, D=0.3544, H=0.3951, M=0.0952, Q=0.1978, S=0.4234, T=0.4358, W=0.2099. +- variates skill: multivariate=0.3935, univariate=0.3612. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_paired 3000-step screen +- Checkpoint SHA-256: `1043bbd666890cb730f2931875860ed661f54bae5236a7c93bbbe03764487222`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.516828536987305 seconds. +- Overall skill 0.375342; relative MASE 0.746117; relative WQL 0.522970. +- term skill: long=0.3997, medium=0.4065, short=0.3533. +- domain skill: Econ/Fin=0.1387, Energy=0.2340, Healthcare=0.4415, Nature=0.4295, Sales=0.3399, Transport=0.4651, Web/CloudOps=0.4994. +- frequency skill: A=0.3750, D=0.3534, H=0.3947, M=0.0981, Q=0.1978, S=0.4235, T=0.4353, W=0.2097. +- variates skill: multivariate=0.3930, univariate=0.3609. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +## E50 head_paired 6000-step screen +- Checkpoint SHA-256: `8aacc5fadfa1a9d214aeba0cd1f39bde9aaf038b9ee2a487dafa57b9e904479e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.942206621170044 seconds. +- Overall skill 0.375234; relative MASE 0.746235; relative WQL 0.523068. +- term skill: long=0.3997, medium=0.4064, short=0.3531. +- domain skill: Econ/Fin=0.1405, Energy=0.2337, Healthcare=0.4385, Nature=0.4294, Sales=0.3403, Transport=0.4654, Web/CloudOps=0.4995. +- frequency skill: A=0.3760, D=0.3533, H=0.3947, M=0.0981, Q=0.1988, S=0.4234, T=0.4354, W=0.2077. +- variates skill: multivariate=0.3928, univariate=0.3609. +- Outcome: Small gains at1000 are lost at3000 and6000. Paired loss trails the matched individual-loss control at the later checkpoints; neither arm surpasses the selected confidence model. No package replacement. + +E50 head_paired completed6000 steps in 687.3 elapsed training-loop seconds. Every non-head tensor remains bitwise equal to the E25-24000 parent. + +## E38 original corpus control12000, matched screening +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.037413597106934 seconds. +- Overall skill 0.360533; relative MASE 0.761352; relative WQL 0.537094. +- term skill: long=0.3910, medium=0.4047, short=0.3305. +- domain skill: Econ/Fin=0.1118, Energy=0.1871, Healthcare=0.4084, Nature=0.4251, Sales=0.3445, Transport=0.4588, Web/CloudOps=0.5084. +- frequency skill: A=0.3744, D=0.3432, H=0.3820, M=0.0997, Q=0.1999, S=0.4419, T=0.4062, W=0.2010. +- variates skill: multivariate=0.3952, univariate=0.3315. +- Outcome: The restarted control improves over its12000-step parent but remains below uninterrupted E25-24000. Retain as the paired reference for corpus expansion and partial-target training. + +## E38 original corpus control12000, selected fixed inference rules +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.83461022377014 seconds. +- Overall skill 0.373819; relative MASE 0.747477; relative WQL 0.524569. +- term skill: long=0.3971, medium=0.4072, short=0.3512. +- domain skill: Econ/Fin=0.1366, Energy=0.2343, Healthcare=0.4105, Nature=0.4297, Sales=0.3412, Transport=0.4642, Web/CloudOps=0.5006. +- frequency skill: A=0.3777, D=0.3471, H=0.3939, M=0.0915, Q=0.2002, S=0.4231, T=0.4362, W=0.2036. +- variates skill: multivariate=0.3936, univariate=0.3576. +- Outcome: The restarted control improves over its12000-step parent but remains below uninterrupted E25-24000. Retain as the paired reference for corpus expansion and partial-target training. + +E38 original-corpus control completed12000 steps in 3967.3 elapsed training-loop seconds. E48 phase_synth replaced it on the same H100 after completion. + +## E55 matched partial-target weight difference, screen +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.02963423728943 seconds. +- Overall skill 0.375848; relative MASE 0.745876; relative WQL 0.522292. +- term skill: long=0.3998, medium=0.4069, short=0.3540. +- domain skill: Econ/Fin=0.1449, Energy=0.2367, Healthcare=0.4308, Nature=0.4298, Sales=0.3356, Transport=0.4655, Web/CloudOps=0.5000. +- frequency skill: A=0.3786, D=0.3503, H=0.3960, M=0.1012, Q=0.2008, S=0.4236, T=0.4351, W=0.2163. +- variates skill: multivariate=0.3939, univariate=0.3611. +- Outcome: Skill 0.375848 is only 0.000056 above the selected E47 model. Check both earlier cutoffs before a full-package evaluation; no replacement yet. + +## E56: bounded influence of difficult training windows +Hypothesis: a linear average of normalized window losses gives unusually difficult or abruptly changing futures too much influence, while the benchmark aggregates relative configuration errors geometrically. Keep the original per-window weighted quantile/median loss and context-only seasonal weights, but replace each window loss L by 0.25*log1p(L/0.25) before averaging. The derivative is bounded by1 and declines for difficult windows; this is a robust surrogate, not a claim to exactly optimize benchmark skill. The scale0.25 is fixed in advance, with no sweep. + +Match E38 original-corpus control exactly: parent E25-12000, seed79, packed_sample, source weights, batch256, LR5e-5, 12000-step schedule and save3000. No new source data, architecture or inference rule. Queue after E42 completes12000, then compare against cached control checkpoints and earlier cutoffs. The loss scale is saved in training arguments. + +## E55 transferred partial-target update, backcast +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.927225589752197 seconds. +- Overall skill 0.335000; relative MASE 0.798832; relative WQL 0.553589. +- term skill: long=0.3978, medium=0.3567, short=0.3005. +- domain skill: Econ/Fin=0.1675, Energy=0.2279, Healthcare=0.4021, Nature=0.3600, Sales=0.3983, Transport=0.3718, Web/CloudOps=0.4491. +- frequency skill: A=0.3286, D=0.3484, H=0.3640, M=0.1855, Q=0.2333, S=0.3447, T=0.3347, W=0.2831. +- variates skill: multivariate=0.3522, univariate=0.3210. +- Outcome: Mixed transfer: main +0.000056, first earlier +0.000874, second earlier -0.000595 versus E47. Keep the published package. Revisit the same coefficient with the final12000-step matched checkpoints; no full-package test of this6000-step composition. + +## E55 transferred partial-target update, backcast2 +- Checkpoint SHA-256: `031411940fdebc895e3cf681512924f680e7feaccdfbda46f85890397fe20bd0`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.91679048538208 seconds. +- Overall skill 0.357904; relative MASE 0.771656; relative WQL 0.534289. +- term skill: long=0.3649, medium=0.3860, short=0.3441. +- domain skill: Econ/Fin=0.1130, Energy=0.2354, Healthcare=0.3520, Nature=0.4680, Sales=0.5482, Transport=0.4200, Web/CloudOps=0.4303. +- frequency skill: A=0.3535, D=0.4265, H=0.3897, M=0.1535, Q=0.1485, S=0.2805, T=0.3574, W=0.2617. +- variates skill: multivariate=0.3618, univariate=0.3547. +- Outcome: Mixed transfer: main +0.000056, first earlier +0.000874, second earlier -0.000595 versus E47. Keep the published package. Revisit the same coefficient with the final12000-step matched checkpoints; no full-package test of this6000-step composition. + +E54 long_context_8192 training started at 2026-10-22T05:11:31Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E38 expanded corpus final12000, matched screen +- Checkpoint SHA-256: `8aa07643add22cc1f8e45c069d19ff54bda8c0853c8e7076eb5923467942327b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.707714796066284 seconds. +- Overall skill 0.359331; relative MASE 0.763140; relative WQL 0.537852. +- term skill: long=0.3931, medium=0.4039, short=0.3277. +- domain skill: Econ/Fin=0.1164, Energy=0.1854, Healthcare=0.3936, Nature=0.4242, Sales=0.3431, Transport=0.4578, Web/CloudOps=0.5093. +- frequency skill: A=0.3748, D=0.3312, H=0.3834, M=0.1029, Q=0.2013, S=0.4405, T=0.4056, W=0.2056. +- variates skill: multivariate=0.3951, univariate=0.3293. +- Outcome: Skill 0.359331 versus matched original-corpus control0.360533. The early near tie becomes a final regression. Do not select the expanded corpus for the current model; retain all packed data and receipts for future experiments. + +E38 expanded-corpus arm completed12000 steps in 4098.4 elapsed training-loop seconds. E54 long_context_8192 started after its process exited on the same H100. + +## E48 synthetic phase diffusion3000, matched screen +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.34250235557556 seconds. +- Overall skill 0.353459; relative MASE 0.767933; relative WQL 0.544338. +- term skill: long=0.3849, medium=0.3994, short=0.3222. +- domain skill: Econ/Fin=0.1025, Energy=0.1767, Healthcare=0.4158, Nature=0.4111, Sales=0.3476, Transport=0.4532, Web/CloudOps=0.5044. +- frequency skill: A=0.3736, D=0.3385, H=0.3748, M=0.0857, Q=0.1907, S=0.4365, T=0.3973, W=0.1999. +- variates skill: multivariate=0.3856, univariate=0.3267. +- Outcome: Skill0.353459 versus amplitude-only E31 score0.352625 at the same step/seed/data stream. Earlier-cutoff checks are pending; continue the trial. + +E56 log_window_loss training started at 2026-10-22T05:14:05Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E57: period-relative phase projections with a frozen backbone +Hypothesis: encoder and future-query attention can use seasonal history more efficiently when supplied explicit relative phase for each frequency-derived period, rather than having to reconstruct it from generic position embeddings and scalar period metadata. Add zero-initialized linear projections of per-point sine/cosine phase for the two periods to context patches and future-query patches. Positions are relative to the forecast origin; periods below2 yield zero features, and missing context positions are masked. There are65536 new parameters, with no calendar dates or dataset identifiers. + +Initialize from the selected E47 confidence6000 package; freeze every existing parameter, including the confidence projection. Train only the two phase projections on packed_sample and the unchanged local synthetic/sign generator, seed107, paired-sign weighted quantile/median loss, batch64, LR2e-4, 6000-step cosine schedule, save1000. Confirm zero-initialization equivalence and maximum-shape memory before starting alongside the six existing trainers on the one H100. No new source data. + +E57 checks passed: the zero-initialized model is bitwise equal to the parent on mixed-frequency, partially missing CPU contexts. Maximum-shape paired batch128/context4096/horizon1024 used3647 MiB peak allocated and3920 MiB reserved, including EMA and optimizer-state placeholders, with finite gradients in1.20 seconds. No optimizer update or checkpoint came from these fixtures. Start batch64 as planned; train only65536 projection parameters. + +## E52 varied requested horizons3000, matched screen +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.744144678115845 seconds. +- Overall skill 0.359510; relative MASE 0.763513; relative WQL 0.537290. +- term skill: long=0.3912, medium=0.4026, short=0.3294. +- domain skill: Econ/Fin=0.1112, Energy=0.1841, Healthcare=0.4177, Nature=0.4232, Sales=0.3464, Transport=0.4589, Web/CloudOps=0.5065. +- frequency skill: A=0.3765, D=0.3429, H=0.3831, M=0.1035, Q=0.1995, S=0.4418, T=0.4003, W=0.2081. +- variates skill: multivariate=0.3922, univariate=0.3323. +- Outcome: Skill0.359510 versus E42 partial-target control0.358812. The gain is promising; matched earlier-cutoff evaluations are queued. + +## E48 matched3000 comparison: amplitude_synth, backcast +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.832332372665405 seconds. +- Overall skill 0.322014; relative MASE 0.811414; relative WQL 0.566499. +- term skill: long=0.3860, medium=0.3513, short=0.2839. +- domain skill: Econ/Fin=0.1393, Energy=0.2195, Healthcare=0.3717, Nature=0.3475, Sales=0.3988, Transport=0.3598, Web/CloudOps=0.4348. +- frequency skill: A=0.3171, D=0.3485, H=0.3526, M=0.1707, Q=0.2099, S=0.3414, T=0.3170, W=0.2493. +- variates skill: multivariate=0.3360, univariate=0.3107. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: phase_synth, backcast +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.44191288948059 seconds. +- Overall skill 0.322626; relative MASE 0.811284; relative WQL 0.565567. +- term skill: long=0.3871, medium=0.3526, short=0.2840. +- domain skill: Econ/Fin=0.1401, Energy=0.2216, Healthcare=0.3676, Nature=0.3459, Sales=0.3983, Transport=0.3597, Web/CloudOps=0.4368. +- frequency skill: A=0.3175, D=0.3449, H=0.3527, M=0.1680, Q=0.2099, S=0.3428, T=0.3207, W=0.2496. +- variates skill: multivariate=0.3385, univariate=0.3097. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: amplitude_synth, backcast2 +- Checkpoint SHA-256: `6f3e68f1b70e9cde6872473dc4d834c16195e72656ba974eb39d48413a10af63`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.063983917236328 seconds. +- Overall skill 0.346071; relative MASE 0.781652; relative WQL 0.547076. +- term skill: long=0.3649, medium=0.3705, short=0.3294. +- domain skill: Econ/Fin=0.0773, Energy=0.2205, Healthcare=0.3375, Nature=0.4551, Sales=0.5561, Transport=0.4102, Web/CloudOps=0.4240. +- frequency skill: A=0.3378, D=0.4197, H=0.3812, M=0.1601, Q=0.1370, S=0.2856, T=0.3361, W=0.2413. +- variates skill: multivariate=0.3528, univariate=0.3406. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E48 matched3000 comparison: phase_synth, backcast2 +- Checkpoint SHA-256: `06c74c2540e7fd208186a407ae6c38fcdeafe5e152887e1d7642d65c18084e64`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.462491750717163 seconds. +- Overall skill 0.346572; relative MASE 0.781891; relative WQL 0.546071. +- term skill: long=0.3645, medium=0.3710, short=0.3303. +- domain skill: Econ/Fin=0.0768, Energy=0.2203, Healthcare=0.3341, Nature=0.4562, Sales=0.5562, Transport=0.4104, Web/CloudOps=0.4261. +- frequency skill: A=0.3370, D=0.4191, H=0.3813, M=0.1474, Q=0.1380, S=0.2827, T=0.3397, W=0.2426. +- variates skill: multivariate=0.3544, univariate=0.3402. +- Outcome: Phase diffusion gains at all three cutoffs at3000: main+0.000834, earlier1+0.000612, earlier2+0.000501. Continue to6000 and later matched checkpoints. + +## E42 final12000, matched mean-template screen +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.56895399093628 seconds. +- Overall skill 0.361108; relative MASE 0.761463; relative WQL 0.536050. +- term skill: long=0.3906, medium=0.4043, short=0.3319. +- domain skill: Econ/Fin=0.1096, Energy=0.1895, Healthcare=0.4193, Nature=0.4256, Sales=0.3404, Transport=0.4593, Web/CloudOps=0.5063. +- frequency skill: A=0.3721, D=0.3420, H=0.3825, M=0.1108, Q=0.1995, S=0.4420, T=0.4045, W=0.2122. +- variates skill: multivariate=0.3937, univariate=0.3339. +- Outcome: The partial-target change still improves over its matched original-corpus control. The direct model remains below the published later E25/E47 lineage. Earlier-cutoff checks and the prespecified final-checkpoint weight-difference transfer are pending. + +## E42 final12000, selected fixed inference rules +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.01974844932556 seconds. +- Overall skill 0.374349; relative MASE 0.747467; relative WQL 0.523688. +- term skill: long=0.3969, medium=0.4067, short=0.3525. +- domain skill: Econ/Fin=0.1345, Energy=0.2359, Healthcare=0.4230, Nature=0.4302, Sales=0.3371, Transport=0.4647, Web/CloudOps=0.4986. +- frequency skill: A=0.3753, D=0.3458, H=0.3943, M=0.1064, Q=0.1999, S=0.4233, T=0.4344, W=0.2143. +- variates skill: multivariate=0.3921, univariate=0.3599. +- Outcome: The partial-target change still improves over its matched original-corpus control. The direct model remains below the published later E25/E47 lineage. Earlier-cutoff checks and the prespecified final-checkpoint weight-difference transfer are pending. + +E42 completed12000 steps in 4034.2 elapsed training-loop seconds. E56 replaced it on the same H100. + +## E52 matched3000 comparison: partial_targets, backcast +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.31913948059082 seconds. +- Overall skill 0.329377; relative MASE 0.806571; relative WQL 0.557590. +- term skill: long=0.3896, medium=0.3560, short=0.2940. +- domain skill: Econ/Fin=0.1487, Energy=0.2246, Healthcare=0.4210, Nature=0.3485, Sales=0.3987, Transport=0.3621, Web/CloudOps=0.4433. +- frequency skill: A=0.3183, D=0.3586, H=0.3563, M=0.1681, Q=0.2258, S=0.3434, T=0.3271, W=0.2657. +- variates skill: multivariate=0.3451, univariate=0.3166. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: horizon_jitter, backcast +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.87836766242981 seconds. +- Overall skill 0.329077; relative MASE 0.807099; relative WQL 0.557723. +- term skill: long=0.3896, medium=0.3557, short=0.2936. +- domain skill: Econ/Fin=0.1451, Energy=0.2244, Healthcare=0.4181, Nature=0.3490, Sales=0.3989, Transport=0.3628, Web/CloudOps=0.4429. +- frequency skill: A=0.3192, D=0.3567, H=0.3569, M=0.1660, Q=0.2272, S=0.3431, T=0.3263, W=0.2674. +- variates skill: multivariate=0.3446, univariate=0.3165. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: partial_targets, backcast2 +- Checkpoint SHA-256: `fce955a709ee54429c943e3962df49055444d5a15453865a01e4883614425917`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.110735416412354 seconds. +- Overall skill 0.352022; relative MASE 0.776423; relative WQL 0.540782. +- term skill: long=0.3678, medium=0.3760, short=0.3367. +- domain skill: Econ/Fin=0.0867, Energy=0.2248, Healthcare=0.3701, Nature=0.4601, Sales=0.5593, Transport=0.4130, Web/CloudOps=0.4281. +- frequency skill: A=0.3418, D=0.4285, H=0.3860, M=0.1767, Q=0.1499, S=0.2821, T=0.3437, W=0.2407. +- variates skill: multivariate=0.3578, univariate=0.3473. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E52 matched3000 comparison: horizon_jitter, backcast2 +- Checkpoint SHA-256: `ef30f8bd58927ec0a18dc5c68a7b18c0d8066c0b3ff6dbe31b6fec82af26eb0c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.243326425552368 seconds. +- Overall skill 0.352445; relative MASE 0.776496; relative WQL 0.540026. +- term skill: long=0.3678, medium=0.3759, short=0.3375. +- domain skill: Econ/Fin=0.0824, Energy=0.2247, Healthcare=0.3724, Nature=0.4606, Sales=0.5600, Transport=0.4138, Web/CloudOps=0.4293. +- frequency skill: A=0.3405, D=0.4280, H=0.3865, M=0.1811, Q=0.1490, S=0.2826, T=0.3439, W=0.2424. +- variates skill: multivariate=0.3585, univariate=0.3475. +- Outcome: Horizon jitter gains main+0.000697 and earlier2+0.000423, but loses earlier1 by0.000300. Continue to6000 to assess whether the effect persists; no package change. + +## E57 period-relative phase projection, initial screen +- Checkpoint SHA-256: `275e6d68dda364b71999bf311a8ce7acf09ae4fb4642b8e07c404dd1bd9849ca`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.636561393737793 seconds. +- Overall skill 0.375793; relative MASE 0.745649; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4406, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0954, Q=0.1982, S=0.4239, T=0.4362, W=0.2090. +- variates skill: multivariate=0.3937, univariate=0.3611. +- Outcome: Exactly equal to the E47 parent score0.3757929301726527, validating the zero-initialized runtime before training. + +## E55 final12000 matched training difference, screen +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.509355783462524 seconds. +- Overall skill 0.375956; relative MASE 0.746201; relative WQL 0.521885. +- term skill: long=0.3991, medium=0.4059, short=0.3549. +- domain skill: Econ/Fin=0.1387, Energy=0.2371, Healthcare=0.4442, Nature=0.4287, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3506, H=0.3961, M=0.1054, Q=0.1984, S=0.4235, T=0.4345, W=0.2191. +- variates skill: multivariate=0.3928, univariate=0.3622. +- Outcome: Skill0.375956 versus selected E47 score0.375793. This is a larger screen gain than the6000-step difference; evaluate both earlier cutoffs before selecting. + +## E57 period-relative phase projections1000, screen +- Checkpoint SHA-256: `2deeff17c98c6993f9da1713c973fe0f803358a717c021e81438cdf203ae5f51`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.055758476257324 seconds. +- Overall skill 0.375590; relative MASE 0.745958; relative WQL 0.522667. +- term skill: long=0.3989, medium=0.4062, short=0.3542. +- domain skill: Econ/Fin=0.1398, Energy=0.2354, Healthcare=0.4399, Nature=0.4278, Sales=0.3393, Transport=0.4661, Web/CloudOps=0.4996. +- frequency skill: A=0.3762, D=0.3549, H=0.3950, M=0.0942, Q=0.1970, S=0.4219, T=0.4359, W=0.2092. +- variates skill: multivariate=0.3933, univariate=0.3612. +- Outcome: Skill0.375590 is slightly below the parent0.375793. Continue to3000/6000 to assess whether training recovers, as the previous confidence projection did late in its schedule. + +## E42 final12000 matched comparison: large_corpus_control, backcast +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.9762020111084 seconds. +- Overall skill 0.330213; relative MASE 0.806120; relative WQL 0.556510. +- term skill: long=0.3888, medium=0.3557, short=0.2960. +- domain skill: Econ/Fin=0.1456, Energy=0.2279, Healthcare=0.4182, Nature=0.3493, Sales=0.3975, Transport=0.3647, Web/CloudOps=0.4422. +- frequency skill: A=0.2987, D=0.3583, H=0.3572, M=0.1590, Q=0.2332, S=0.3409, T=0.3303, W=0.2690. +- variates skill: multivariate=0.3460, univariate=0.3174. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E42 final12000 matched comparison: partial_targets, backcast +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.47197651863098 seconds. +- Overall skill 0.331074; relative MASE 0.805060; relative WQL 0.555811. +- term skill: long=0.3901, medium=0.3561, short=0.2969. +- domain skill: Econ/Fin=0.1467, Energy=0.2289, Healthcare=0.4192, Nature=0.3505, Sales=0.3984, Transport=0.3646, Web/CloudOps=0.4431. +- frequency skill: A=0.3115, D=0.3560, H=0.3581, M=0.1677, Q=0.2337, S=0.3423, T=0.3297, W=0.2763. +- variates skill: multivariate=0.3468, univariate=0.3183. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E55 final12000 transferred difference, backcast +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.976391792297363 seconds. +- Overall skill 0.335609; relative MASE 0.797954; relative WQL 0.553184. +- term skill: long=0.3979, medium=0.3572, short=0.3014. +- domain skill: Econ/Fin=0.1631, Energy=0.2288, Healthcare=0.4091, Nature=0.3616, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4491. +- frequency skill: A=0.3254, D=0.3493, H=0.3647, M=0.1918, Q=0.2328, S=0.3430, T=0.3345, W=0.2857. +- variates skill: multivariate=0.3525, univariate=0.3218. +- Outcome: Transfer gains main+0.000163 and earlier1+0.001483, but loses earlier2 by0.001028. Average gain across the three cutoffs is positive; run exact full validation before deciding whether to publish this tradeoff. + +## E42 final12000 matched comparison: large_corpus_control, backcast2 +- Checkpoint SHA-256: `7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.495740175247192 seconds. +- Overall skill 0.353454; relative MASE 0.776299; relative WQL 0.538480. +- term skill: long=0.3687, medium=0.3751, short=0.3393. +- domain skill: Econ/Fin=0.0914, Energy=0.2288, Healthcare=0.3664, Nature=0.4591, Sales=0.5548, Transport=0.4142, Web/CloudOps=0.4303. +- frequency skill: A=0.3473, D=0.4293, H=0.3865, M=0.1743, Q=0.1540, S=0.2821, T=0.3466, W=0.2433. +- variates skill: multivariate=0.3605, univariate=0.3477. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E42 final12000 matched comparison: partial_targets, backcast2 +- Checkpoint SHA-256: `a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 27.049270629882812 seconds. +- Overall skill 0.353096; relative MASE 0.776739; relative WQL 0.538771. +- term skill: long=0.3692, medium=0.3760, short=0.3381. +- domain skill: Econ/Fin=0.0920, Energy=0.2294, Healthcare=0.3671, Nature=0.4574, Sales=0.5540, Transport=0.4141, Web/CloudOps=0.4294. +- frequency skill: A=0.3519, D=0.4253, H=0.3874, M=0.1772, Q=0.1555, S=0.2805, T=0.3464, W=0.2443. +- variates skill: multivariate=0.3599, univariate=0.3476. +- Outcome: Final partial-target model gains main+0.000575 and earlier1+0.000861, but loses earlier2 by0.000358. Direct model remains below the published later lineage. + +## E55 final12000 transferred difference, backcast2 +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.92556405067444 seconds. +- Overall skill 0.357472; relative MASE 0.772231; relative WQL 0.534610. +- term skill: long=0.3642, medium=0.3858, short=0.3437. +- domain skill: Econ/Fin=0.1127, Energy=0.2350, Healthcare=0.3474, Nature=0.4678, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4300. +- frequency skill: A=0.3556, D=0.4262, H=0.3901, M=0.1532, Q=0.1527, S=0.2796, T=0.3567, W=0.2577. +- variates skill: multivariate=0.3616, univariate=0.3541. +- Outcome: Transfer gains main+0.000163 and earlier1+0.001483, but loses earlier2 by0.001028. Average gain across the three cutoffs is positive; run exact full validation before deciding whether to publish this tradeoff. + +E31 amplitude-varying synthetic run completed24000 steps in7471.1 elapsed training-loop seconds on the shared H100. Final checkpoint is being checked with the selected fixed inference rules at all three cutoffs. + +## E58: increase width from our own trained model (preparing) +Repeated continuations of the36.8M model show diminishing gains. Hypothesis: more capacity can improve learning from the allowed corpus after a function-preserving initialization, given a sufficiently long matched schedule. Widen the selected E47 model from d512/heads8 to d1024/heads16, retaining enc6/dec4 and patch16. Duplicate hidden representations; duplicate input columns with weights divided by2; duplicate output rows. Preserve attention K/V grouping, repeat layernorm vectors, and repeat the original512-dimensional positional vector. Verify the unperturbed conversion on fixed synthetic fixtures. Then add independently seeded1%-of-tensor-standard-deviation noise to matrix weights to break duplicated-neuron symmetry, measuring the resulting prediction change. This is an initialization derived only from our own trained weights. + +A matched original-width control will use the same parent, data windows, seed113 and original sign-augmented loss. Proposed batch128, LR3e-5 and24000-step schedule are subject to a maximum-shape memory check after E31 releases its training slot. For widened matrices with duplicated input columns, use half the base learning rate and twice the weight decay to retain comparable initial functional update/decay scales; other parameters use the original rate. These settings and any necessary memory-driven batch adjustment will be recorded before training. No external weights or data. + +## E55 final12000 transferred update, exact full package validation +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372143; relative MASE 0.748865; relative WQL 0.526402. +- term skill: long=0.3930, medium=0.4049, short=0.3509. +- domain skill: Econ/Fin=0.1163, Energy=0.2302, Healthcare=0.4510, Nature=0.4286, Sales=0.3487, Transport=0.4659, Web/CloudOps=0.4912. +- frequency skill: A=0.2931, D=0.3551, H=0.3913, M=0.1284, Q=0.1851, S=0.4235, T=0.4275, W=0.2120. +- variates skill: multivariate=0.3885, univariate=0.3588. +- Outcome: Select for publication after relocation and determinism checks. Full skill0.372143 improves on E47 score0.371766. All97 configurations and151170 instances passed, with no quantile crossings; actual inference123.68 seconds. Earlier temporal diagnostics retain a tradeoff: first earlier cutoff+0.001483, second earlier cutoff-0.001028. The mean gain across the main and two earlier screens is positive; this is validation selection, not a held-out reward claim. + +E58 conversion produced 146477344 parameters. Maximum normalized-quantile difference before noise was 0.000001669; after the fixed1% matrix noise it was 0.018048. Conversion took 2.38 CPU seconds. Parent hash and noise seed113 are recorded in wide_capacity_initial.pt.json. + +Maximum-shape memory checks, including optimizer moments and EMA placeholders, used13326 MiB reserved at batch128 and10708 MiB at batch96; both had finite gradients. Choose batch96 for both arms to preserve evaluation headroom. Increase the planned schedule from24000 to32000 steps so the planned number of windows remains3072000 per arm. Save/evaluate4000,8000,16000,24000,32000. Base LR3e-5, seed113, unchanged context/horizon mixture and packed_sample. Wider-matrix LR multiplier0.5 and decay multiplier2 remain as declared. Start the wide arm now that E31 has exited; queue the original-width control after E57 completes. Research and package inference use batch64 for both widths to keep memory comparable. + +E55 relocation/determinism checks passed: the candidate and a separate fresh /tmp copy, both launched from /tmp, produced bitwise identical finite monotone quantiles for daily, hourly and multivariate medium-horizon examples. Publish the complete model/report/manifest/provenance/log bundle atomically. + +## E59: equal-weight ensemble of complementary training variants +The final E31 amplitude-varying model improves both earlier cutoffs over its recency24000 control, while its main fixed-rule screen is lower. The selected E55 transfer has the opposite second-earlier tradeoff. Hypothesis: an equal-weight average can reduce these differences. Reuse cached quantiles for E55 partial_delta12k and E31 amplitude24000, with both members forecasting every instance. Test only the fixed50/50 average, with and without applying the selected zero0.4 projection once more after averaging; averaging two zero-projected forecasts can otherwise introduce small positive values. No weight sweep or training. If promising, build and validate the actual two-member runtime before publication. + +## E31 final24000 with selected fixed rules, screen +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.934752464294434 seconds. +- Overall skill 0.375166; relative MASE 0.746944; relative WQL 0.522686. +- term skill: long=0.3998, medium=0.4070, short=0.3527. +- domain skill: Econ/Fin=0.1414, Energy=0.2355, Healthcare=0.4087, Nature=0.4266, Sales=0.3412, Transport=0.4655, Web/CloudOps=0.5053. +- frequency skill: A=0.3762, D=0.3445, H=0.3950, M=0.0900, Q=0.2023, S=0.4234, T=0.4389, W=0.2104. +- variates skill: multivariate=0.3958, univariate=0.3582. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E31 final24000 with selected fixed rules, backcast +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.675416946411133 seconds. +- Overall skill 0.334745; relative MASE 0.799254; relative WQL 0.553722. +- term skill: long=0.3965, medium=0.3574, short=0.3003. +- domain skill: Econ/Fin=0.1603, Energy=0.2277, Healthcare=0.4000, Nature=0.3619, Sales=0.3979, Transport=0.3709, Web/CloudOps=0.4497. +- frequency skill: A=0.3115, D=0.3485, H=0.3643, M=0.1990, Q=0.2289, S=0.3403, T=0.3365, W=0.2702. +- variates skill: multivariate=0.3522, univariate=0.3205. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E31 final24000 with selected fixed rules, backcast2 +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.473368406295776 seconds. +- Overall skill 0.358910; relative MASE 0.771616; relative WQL 0.532644. +- term skill: long=0.3672, medium=0.3833, short=0.3462. +- domain skill: Econ/Fin=0.1126, Energy=0.2349, Healthcare=0.3493, Nature=0.4705, Sales=0.5536, Transport=0.4202, Web/CloudOps=0.4327. +- frequency skill: A=0.3556, D=0.4300, H=0.3901, M=0.1370, Q=0.1497, S=0.2870, T=0.3573, W=0.2669. +- variates skill: multivariate=0.3623, univariate=0.3562. +- Outcome: Relative to E25 recency24000: main-0.000336, earlier1+0.000565, earlier2+0.000635. Do not replace the main package with this model alone. Test the prespecified equal-weight blend with the selected E55 model. + +## E59 cached equal-weight comparison +No training; fixed inference seed0 and ensemble weight0.5 for each member. Member weights: selected E55 partial_delta12k SHA-256 721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802; amplitude24000 hash is recorded in its matched reports. + +screen: 2.65 CPU diagnostic seconds. +- average: skill 0.376116; term: short=0.3545, medium=0.4069, long=0.3997; domain: Econ/Fin=0.1408, Energy=0.2367, Healthcare=0.4304, Nature=0.4279, Sales=0.3385, Transport=0.4658, Web/CloudOps=0.5025; freq: A-DEC=0.3755, Q-DEC=0.2008, M=0.0994, W-SUN=0.0865, D=0.3491, H=0.3958, 15T=0.2143, W-FRI=-0.0164, 10T=0.6125, W-TUE=0.5565, W-THU=0.2049, W-WED=0.3155, 5T=0.5141, 10S=0.4235. +- average_then_zero: skill 0.376000; term: short=0.3545, medium=0.4068, long=0.3994; domain: Econ/Fin=0.1408, Energy=0.2367, Healthcare=0.4304, Nature=0.4277, Sales=0.3386, Transport=0.4658, Web/CloudOps=0.5021; freq: A-DEC=0.3755, Q-DEC=0.2008, M=0.0999, W-SUN=0.0865, D=0.3489, H=0.3957, 15T=0.2143, W-FRI=-0.0164, 10T=0.6124, W-TUE=0.5565, W-THU=0.2049, W-WED=0.3154, 5T=0.5138, 10S=0.4235. + +backcast: 2.59 CPU diagnostic seconds. +- average: skill 0.335702; term: short=0.3015, medium=0.3577, long=0.3976; domain: Econ/Fin=0.1625, Energy=0.2286, Healthcare=0.4066, Nature=0.3622, Sales=0.3978, Transport=0.3714, Web/CloudOps=0.4500; freq: A-DEC=0.3193, Q-DEC=0.2313, M=0.1979, W-SUN=0.0360, D=0.3493, H=0.3648, 15T=0.2260, W-FRI=0.2606, 10T=0.3193, W-TUE=0.5296, W-THU=0.2330, W-WED=0.3440, 5T=0.4376, 10S=0.3419. +- average_then_zero: skill 0.335612; term: short=0.3014, medium=0.3575, long=0.3976; domain: Econ/Fin=0.1625, Energy=0.2286, Healthcare=0.4066, Nature=0.3619, Sales=0.3980, Transport=0.3714, Web/CloudOps=0.4498; freq: A-DEC=0.3193, Q-DEC=0.2313, M=0.1983, W-SUN=0.0360, D=0.3491, H=0.3648, 15T=0.2260, W-FRI=0.2606, 10T=0.3188, W-TUE=0.5296, W-THU=0.2330, W-WED=0.3440, 5T=0.4372, 10S=0.3419. + +backcast2: 2.43 CPU diagnostic seconds. +- average: skill 0.358667; term: short=0.3455, medium=0.3850, long=0.3661; domain: Econ/Fin=0.1134, Energy=0.2353, Healthcare=0.3493, Nature=0.4696, Sales=0.5519, Transport=0.4203, Web/CloudOps=0.4320; freq: A-DEC=0.3562, Q-DEC=0.1515, M=0.1452, W-SUN=0.0558, D=0.4288, H=0.3904, 15T=0.1044, W-FRI=0.1452, 10T=0.4937, W-TUE=0.1018, W-THU=0.3276, W-WED=0.5366, 5T=0.4664, 10S=0.2839. +- average_then_zero: skill 0.358497; term: short=0.3453, medium=0.3849, long=0.3659; domain: Econ/Fin=0.1134, Energy=0.2352, Healthcare=0.3493, Nature=0.4693, Sales=0.5513, Transport=0.4203, Web/CloudOps=0.4318; freq: A-DEC=0.3562, Q-DEC=0.1515, M=0.1452, W-SUN=0.0558, D=0.4286, H=0.3904, 15T=0.1044, W-FRI=0.1452, 10T=0.4927, W-TUE=0.1018, W-THU=0.3276, W-WED=0.5364, 5T=0.4661, 10S=0.2839. + +Outcome: plain averaging wins all three cutoffs over the selected single model. Reapplying the zero projection after averaging is worse at every cutoff. Build the actual two-member package and verify cached/runtime agreement, full validation and relocation before publication. + +E58 wide_capacity_control training started at 2026-10-22T05:35:38Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E59 actual two-member runtime produced bitwise identical quantiles to the cached plain50/50 average for every point in all97 main-screen configurations. Its screening skill is0.37611643951533646, matching the probe exactly. Proceed to actual full-package inference and scoring. + +## E57 period-relative phase projections3000, screen +- Checkpoint SHA-256: `740fed81313fbb2dc2060173ae11ed120d6cca9600620cd1c9d9331ccac699e5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.340542793273926 seconds. +- Overall skill 0.375400; relative MASE 0.745694; relative WQL 0.523171. +- term skill: long=0.3995, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1392, Energy=0.2355, Healthcare=0.4394, Nature=0.4265, Sales=0.3394, Transport=0.4660, Web/CloudOps=0.4999. +- frequency skill: A=0.3762, D=0.3544, H=0.3946, M=0.0943, Q=0.1976, S=0.4227, T=0.4359, W=0.2085. +- variates skill: multivariate=0.3928, univariate=0.3611. +- Outcome: The6000-step score0.375840 is only0.000047 above its E47 parent, after earlier regressions. Existing model tensors remain bitwise unchanged. Check earlier cutoffs before selecting any use of these projections. + +## E57 period-relative phase projections6000, screen +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.05087399482727 seconds. +- Overall skill 0.375840; relative MASE 0.745321; relative WQL 0.522695. +- term skill: long=0.3997, medium=0.4065, short=0.3542. +- domain skill: Econ/Fin=0.1396, Energy=0.2356, Healthcare=0.4472, Nature=0.4272, Sales=0.3377, Transport=0.4655, Web/CloudOps=0.4998. +- frequency skill: A=0.3762, D=0.3562, H=0.3947, M=0.0979, Q=0.1989, S=0.4232, T=0.4357, W=0.2089. +- variates skill: multivariate=0.3935, univariate=0.3614. +- Outcome: The6000-step score0.375840 is only0.000047 above its E47 parent, after earlier regressions. Existing model tensors remain bitwise unchanged. Check earlier cutoffs before selecting any use of these projections. + +E57 completed6000 steps in1147.4 elapsed training-loop seconds. Every pre-existing tensor is bitwise equal to the E47 parent; only the65536 phase-projection parameters changed. E58 original-width control started after this process exited. + +## E58 widened initialization, main screen at batch64 +- Checkpoint SHA-256: `495eed9e1a09379b3cbcdadbee447d2c519a2cff8239c0756cf94f49f8a1b55e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 43.54188299179077 seconds. +- Overall skill 0.375710; relative MASE 0.745704; relative WQL 0.522645. +- term skill: long=0.3998, medium=0.4067, short=0.3538. +- domain skill: Econ/Fin=0.1394, Energy=0.2348, Healthcare=0.4397, Nature=0.4283, Sales=0.3400, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3540, H=0.3951, M=0.0946, Q=0.1984, S=0.4240, T=0.4362, W=0.2087. +- variates skill: multivariate=0.3937, univariate=0.3610. +- Outcome: Initial score0.375710 remains close to the original model before any larger-model training. The matched original-width initialization at the same inference batch size is being checked. + +## E56 log window loss3000, matched screen +- Checkpoint SHA-256: `14dd06fb6dff3c336f5aa26b8525d7ccb921a80b3e7be4d22b285584c14ff3bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.476420640945435 seconds. +- Overall skill 0.357135; relative MASE 0.765561; relative WQL 0.539835. +- term skill: long=0.3893, medium=0.3998, short=0.3270. +- domain skill: Econ/Fin=0.1142, Energy=0.1808, Healthcare=0.3930, Nature=0.4235, Sales=0.3538, Transport=0.4615, Web/CloudOps=0.5024. +- frequency skill: A=0.3804, D=0.3293, H=0.3825, M=0.1125, Q=0.2032, S=0.4413, T=0.3984, W=0.2094. +- variates skill: multivariate=0.3893, univariate=0.3303. +- Outcome: Score0.357135 regresses versus original-loss control0.358802. Continue to6000 before deciding whether to stop this objective. + +## E48 phase diffusion6000, matched screen +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.55935049057007 seconds. +- Overall skill 0.356225; relative MASE 0.765189; relative WQL 0.541626. +- term skill: long=0.3862, medium=0.3999, short=0.3266. +- domain skill: Econ/Fin=0.1072, Energy=0.1811, Healthcare=0.4144, Nature=0.4178, Sales=0.3484, Transport=0.4543, Web/CloudOps=0.5048. +- frequency skill: A=0.3702, D=0.3423, H=0.3775, M=0.0903, Q=0.1971, S=0.4361, T=0.4007, W=0.2000. +- variates skill: multivariate=0.3887, univariate=0.3292. +- Outcome: Score0.356225 versus amplitude-only0.355543: the main gain persists at6000. Earlier cutoffs are being evaluated. + +## E52 varied requested horizons6000, matched screen +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.603736400604248 seconds. +- Overall skill 0.359683; relative MASE 0.762743; relative WQL 0.537542. +- term skill: long=0.3900, medium=0.4024, short=0.3303. +- domain skill: Econ/Fin=0.1129, Energy=0.1876, Healthcare=0.4160, Nature=0.4253, Sales=0.3425, Transport=0.4576, Web/CloudOps=0.5040. +- frequency skill: A=0.3774, D=0.3429, H=0.3812, M=0.1107, Q=0.1984, S=0.4413, T=0.4021, W=0.2071. +- variates skill: multivariate=0.3915, univariate=0.3332. +- Outcome: Score0.359683 versus E42 partial-target control0.359222: a smaller main gain persists. Check both earlier cutoffs. + +## E54 original-context control6000, screen +- Checkpoint SHA-256: `14d964cb2b828f8e81c8b656b33da583b2f5fb48a3f003d043ba7c0b88cd3137`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.69702458381653 seconds. +- Overall skill 0.374515; relative MASE 0.746663; relative WQL 0.523973. +- term skill: long=0.3995, medium=0.4071, short=0.3516. +- domain skill: Econ/Fin=0.1381, Energy=0.2362, Healthcare=0.4110, Nature=0.4291, Sales=0.3380, Transport=0.4658, Web/CloudOps=0.5007. +- frequency skill: A=0.3757, D=0.3496, H=0.3960, M=0.0674, Q=0.2005, S=0.4225, T=0.4371, W=0.2070. +- variates skill: multivariate=0.3945, univariate=0.3581. +- Outcome: Fresh continuation is below the E25 parent. Keep as the matched source-window/seed reference for the8192-context arm. + +## E48 matched6000 comparison: amplitude_synth, backcast +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.44511580467224 seconds. +- Overall skill 0.324002; relative MASE 0.810229; relative WQL 0.564005. +- term skill: long=0.3880, medium=0.3521, short=0.2864. +- domain skill: Econ/Fin=0.1415, Energy=0.2210, Healthcare=0.3855, Nature=0.3485, Sales=0.3980, Transport=0.3607, Web/CloudOps=0.4366. +- frequency skill: A=0.3171, D=0.3509, H=0.3541, M=0.1703, Q=0.2160, S=0.3413, T=0.3204, W=0.2494. +- variates skill: multivariate=0.3381, univariate=0.3126. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: phase_synth, backcast +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.959611415863037 seconds. +- Overall skill 0.322903; relative MASE 0.811500; relative WQL 0.564954. +- term skill: long=0.3870, medium=0.3532, short=0.2843. +- domain skill: Econ/Fin=0.1406, Energy=0.2220, Healthcare=0.3697, Nature=0.3497, Sales=0.3989, Transport=0.3583, Web/CloudOps=0.4353. +- frequency skill: A=0.3141, D=0.3444, H=0.3533, M=0.1676, Q=0.2139, S=0.3417, T=0.3204, W=0.2546. +- variates skill: multivariate=0.3382, univariate=0.3105. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: amplitude_synth, backcast2 +- Checkpoint SHA-256: `7fe2746b237fb2699c2d8c812595666df0888cde656498043e01847bb552c783`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 20.365211486816406 seconds. +- Overall skill 0.349572; relative MASE 0.778615; relative WQL 0.543345. +- term skill: long=0.3660, medium=0.3724, short=0.3345. +- domain skill: Econ/Fin=0.0821, Energy=0.2234, Healthcare=0.3611, Nature=0.4581, Sales=0.5590, Transport=0.4121, Web/CloudOps=0.4247. +- frequency skill: A=0.3403, D=0.4277, H=0.3841, M=0.1545, Q=0.1409, S=0.2820, T=0.3394, W=0.2470. +- variates skill: multivariate=0.3548, univariate=0.3453. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E48 matched6000 comparison: phase_synth, backcast2 +- Checkpoint SHA-256: `8d6371333e936bbfc2aa746819bfd0cedd392f873ce79c1d6f729b205c3f0b87`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.906906366348267 seconds. +- Overall skill 0.348439; relative MASE 0.780846; relative WQL 0.543682. +- term skill: long=0.3636, medium=0.3707, short=0.3341. +- domain skill: Econ/Fin=0.0817, Energy=0.2219, Healthcare=0.3552, Nature=0.4580, Sales=0.5591, Transport=0.4110, Web/CloudOps=0.4239. +- frequency skill: A=0.3402, D=0.4247, H=0.3827, M=0.1524, Q=0.1420, S=0.2780, T=0.3407, W=0.2441. +- variates skill: multivariate=0.3541, univariate=0.3439. +- Outcome: Phase diffusion retains a main gain but loses about0.0011 at both earlier cutoffs. The earlier3000-step gains did not persist. Stop this branch; it is not selected. + +## E59 equal-weight two-member ensemble, exact full package validation +- Checkpoint SHA-256: `a5f575ec44defbc0ca0c4aeb29618bbcc0e09f726985851eee4027ea698cfadd`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372254; relative MASE 0.748754; relative WQL 0.526294. +- term skill: long=0.3937, medium=0.4059, short=0.3504. +- domain skill: Econ/Fin=0.1179, Energy=0.2297, Healthcare=0.4376, Nature=0.4278, Sales=0.3512, Transport=0.4661, Web/CloudOps=0.4950. +- frequency skill: A=0.2917, D=0.3537, H=0.3910, M=0.1216, Q=0.1860, S=0.4235, T=0.4302, W=0.2080. +- variates skill: multivariate=0.3905, univariate=0.3573. +- Outcome: Select after relocation/determinism checks: full skill0.372254 versus single-model0.372143; relative MASE0.748754 and WQL0.526294. All97 configurations and151170 instances passed with no quantile crossings. Actual package inference234.68 seconds while training shared the one H100. Main screening and both earlier cutoffs improve; every member forecasts every instance with fixed equal weights. + +E48 stopped cleanly at step7631, after 2736.0 elapsed process seconds at the stop request. Final checkpoint SHA-256 `702c419a404c2aad31011fb824ace504576f5e74244fc4228229fdfb2d970a9a`. The stop checkpoint is retained for provenance and is not selected. + +E59 relocation/determinism passed: the two-member candidate and a separate /tmp copy, both launched from /tmp, produced bitwise identical finite monotone forecasts on daily, hourly and multivariate medium-horizon examples. The complete two-member package is ready for atomic publication. + +## E57 phase projections final6000, backcast +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.856826066970825 seconds. +- Overall skill 0.333418; relative MASE 0.800235; relative WQL 0.555251. +- term skill: long=0.3968, medium=0.3558, short=0.2984. +- domain skill: Econ/Fin=0.1603, Energy=0.2271, Healthcare=0.4058, Nature=0.3594, Sales=0.3943, Transport=0.3716, Web/CloudOps=0.4455. +- frequency skill: A=0.3079, D=0.3513, H=0.3638, M=0.1776, Q=0.2354, S=0.3427, T=0.3327, W=0.2745. +- variates skill: multivariate=0.3498, univariate=0.3201. +- Outcome: Reject this feature addition: main gain0.000047 is offset by earlier1 loss0.000708 and earlier2 loss0.000030 versus the frozen E47 parent. No package change from this branch. + +## E52 varied requested horizons6000, backcast +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.876362562179565 seconds. +- Overall skill 0.330107; relative MASE 0.806559; relative WQL 0.556384. +- term skill: long=0.3900, medium=0.3554, short=0.2954. +- domain skill: Econ/Fin=0.1459, Energy=0.2294, Healthcare=0.4132, Nature=0.3489, Sales=0.3970, Transport=0.3634, Web/CloudOps=0.4423. +- frequency skill: A=0.3187, D=0.3539, H=0.3583, M=0.1613, Q=0.2281, S=0.3442, T=0.3292, W=0.2708. +- variates skill: multivariate=0.3469, univariate=0.3164. +- Outcome: Relative to E42 partial-target control6000: main+0.000461, earlier1-0.000193, earlier2+0.000278. Continue to the final12000 checkpoint; a small positive average effect persists. + +## E57 phase projections final6000, backcast2 +- Checkpoint SHA-256: `956fb0c541a5ae81aaccd7b059143720c5b55d0c030df0162d2eae0736701832`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.712015867233276 seconds. +- Overall skill 0.358470; relative MASE 0.770691; relative WQL 0.534015. +- term skill: long=0.3646, medium=0.3858, short=0.3453. +- domain skill: Econ/Fin=0.1102, Energy=0.2363, Healthcare=0.3561, Nature=0.4700, Sales=0.5508, Transport=0.4205, Web/CloudOps=0.4287. +- frequency skill: A=0.3495, D=0.4331, H=0.3891, M=0.1593, Q=0.1505, S=0.2824, T=0.3568, W=0.2548. +- variates skill: multivariate=0.3620, univariate=0.3556. +- Outcome: Reject this feature addition: main gain0.000047 is offset by earlier1 loss0.000708 and earlier2 loss0.000030 versus the frozen E47 parent. No package change from this branch. + +## E52 varied requested horizons6000, backcast2 +- Checkpoint SHA-256: `1276edf6f471ab96e61e61ead3cb813a58a4cadfac530d2c190072d9b211c182`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.18545150756836 seconds. +- Overall skill 0.353179; relative MASE 0.775830; relative WQL 0.539265. +- term skill: long=0.3689, medium=0.3764, short=0.3382. +- domain skill: Econ/Fin=0.0847, Energy=0.2293, Healthcare=0.3759, Nature=0.4588, Sales=0.5595, Transport=0.4134, Web/CloudOps=0.4274. +- frequency skill: A=0.3432, D=0.4263, H=0.3869, M=0.1771, Q=0.1489, S=0.2829, T=0.3454, W=0.2495. +- variates skill: multivariate=0.3591, univariate=0.3484. +- Outcome: Relative to E42 partial-target control6000: main+0.000461, earlier1-0.000193, earlier2+0.000278. Continue to the final12000 checkpoint; a small positive average effect persists. + +## E60 filtered shared drivers for a frozen cross-channel adapter +Hypothesis: earlier joint adapters saw lagged shared latent drivers but no channel-specific response filtering. A synthetic fast driver and a smoothed response may better represent thermal and energy relationships. Compare original joint generation against causal exponential filtering of half the channels in half the synthetic groups. Filtering time constant is log-uniform from1 to316 steps, applied before observation noise with256 warmup points and stationary initial level. Real windows, latent drivers, coefficients, noise, signs and scales use matched main RNG draws. +- Parent: own E55 partial_delta12k checkpoint, SHA-256721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802. All original weights frozen. Add the previously tested zero-output cross-channel attention adapter (1051136 parameters). Every instance is forecast; one-channel inputs have the identity adapter. +- Data: the26 allow-listed sources in packed_joint plus the original locally generated multivariate latent-driver generator. Synthetic fraction0.30. Candidate adds the declared filtered-response generator. No validation input or labels enter training. +- Matched seed137; independent filter seed400140. Groups16, channels2/3/4/8 with probabilities0.4/0.2/0.2/0.2; contexts512/1024/2048/4096 and horizons32/128/512/1024 follow the original joint sampler. Paired-sign loss in both arms, AdamW LR0.0002,6000 steps, save1000/3000/6000 for diagnostics. One shared H100; training elapsed time will be recorded separately for each arm. +- Selection: compare all97 configurations and both earlier cutoffs against the frozen parent and matched control. First verify sampler matching, identity initialization and maximum-shape memory without optimizer updates. No outcome yet. + +## E56 logarithmic window loss3000 +- Checkpoint SHA-256: `14dd06fb6dff3c336f5aa26b8525d7ccb921a80b3e7be4d22b285584c14ff3bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.476420640945435 seconds. +- Overall skill 0.357135; relative MASE 0.765561; relative WQL 0.539835. +- term skill: long=0.3893, medium=0.3998, short=0.3270. +- domain skill: Econ/Fin=0.1142, Energy=0.1808, Healthcare=0.3930, Nature=0.4235, Sales=0.3538, Transport=0.4615, Web/CloudOps=0.5024. +- frequency skill: A=0.3804, D=0.3293, H=0.3825, M=0.1125, Q=0.2032, S=0.4413, T=0.3984, W=0.2094. +- variates skill: multivariate=0.3893, univariate=0.3303. +- Outcome: Below matched control; the loss transformation is not selected. + +## E56 logarithmic window loss6000 +- Checkpoint SHA-256: `3346c86c6ce73e739fdd2a286b7cd4c1dab7430f6ee1ea8056b8db4943c48d66`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.688469886779785 seconds. +- Overall skill 0.357689; relative MASE 0.764496; relative WQL 0.539655. +- term skill: long=0.3904, medium=0.4011, short=0.3270. +- domain skill: Econ/Fin=0.1167, Energy=0.1822, Healthcare=0.3871, Nature=0.4260, Sales=0.3525, Transport=0.4624, Web/CloudOps=0.5018. +- frequency skill: A=0.3766, D=0.3301, H=0.3834, M=0.1073, Q=0.2061, S=0.4406, T=0.3995, W=0.2098. +- variates skill: multivariate=0.3901, univariate=0.3306. +- Outcome: Skill0.357689 versus matched control0.358628; second regression. Stop and retain existing linear window loss. + +## E54 recent4096 matched control final12000 +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.02079463005066 seconds. +- Overall skill 0.375764; relative MASE 0.744880; relative WQL 0.523131. +- term skill: long=0.4000, medium=0.4083, short=0.3532. +- domain skill: Econ/Fin=0.1410, Energy=0.2368, Healthcare=0.4240, Nature=0.4300, Sales=0.3368, Transport=0.4653, Web/CloudOps=0.5016. +- frequency skill: A=0.3753, D=0.3535, H=0.3960, M=0.0712, Q=0.2025, S=0.4230, T=0.4374, W=0.2130. +- variates skill: multivariate=0.3961, univariate=0.3591. +- Outcome: Finished12000 steps in2491.2 training-loop seconds. Small gain over frozen parent; await the8192 arm before interpretation. + +## E58 widened146M first4000 +- Checkpoint SHA-256: `a8e3dbf8f591804fb3ac6c72ac632dd9e18038e4da7f195208e56f85f41ecd29`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.12893605232239 seconds. +- Overall skill 0.374121; relative MASE 0.747837; relative WQL 0.523810. +- term skill: long=0.3989, medium=0.4070, short=0.3512. +- domain skill: Econ/Fin=0.1400, Energy=0.2366, Healthcare=0.4144, Nature=0.4278, Sales=0.3414, Transport=0.4641, Web/CloudOps=0.4992. +- frequency skill: A=0.3730, D=0.3465, H=0.3947, M=0.0955, Q=0.1987, S=0.4198, T=0.4367, W=0.2046. +- variates skill: multivariate=0.3940, univariate=0.3578. +- Outcome: Ahead of matched37M control by0.000510, but below initial checkpoint. Continue the prespecified longer capacity comparison. + +## E58 matched37M first4000 +- Checkpoint SHA-256: `65969ac2e314e6103c326ab0fe1c550d53a285833d9f983e1c1cdff0d7fb66b3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.00419569015503 seconds. +- Overall skill 0.373612; relative MASE 0.748644; relative WQL 0.524097. +- term skill: long=0.3990, medium=0.4070, short=0.3502. +- domain skill: Econ/Fin=0.1392, Energy=0.2363, Healthcare=0.4121, Nature=0.4272, Sales=0.3410, Transport=0.4638, Web/CloudOps=0.4989. +- frequency skill: A=0.3725, D=0.3451, H=0.3948, M=0.0947, Q=0.1985, S=0.4190, T=0.4363, W=0.2034. +- variates skill: multivariate=0.3937, univariate=0.3572. +- Outcome: Below starting checkpoint; matched capacity comparison continues. + +E56 stop receipt: {"stopped_utc": "2026-10-22T05:53:09.078048+00:00", "reason": "Main screen below matched E38 control at both3000 and6000; prune negative branch.", "final_checkpoint": "/workspace/research/runs/log_window_loss/ema006767.pt", "final_checkpoint_sha256": "ec25440f0d11ac776874679e366255ce9cf54138f2e6802efba22bc88157d06c", "final_step": 6767, "elapsed_training_process_seconds": null} + +E56 measured training-process elapsed time was2298.259 seconds (the previous receipt field was null because the reader used the wrong key; corrected in log_window_loss_stop_receipt.json). + +E60 checks passed: { + "cpu_check_seconds": 1.9617000540019944, + "changed_synthetic_context_values": 21054, + "identity_matches_parent_bitwise": true, + "main_and_filter_rng_matched": true, + "real_windows_unchanged": true, + "optimizer_updates": 0, + "gpu_fixture_seconds": 1.0786702629411593, + "allocated_mib": 2625.63525390625, + "reserved_mib": 3872.0, + "parameters": 37851936, + "trainable_parameters": 1051136, + "loss": 0.3574138879776001 +} +Both arms now start on the shared H100. No optimizer updates occurred during fixtures. + +## E61 log-uniform autoregressive memory in synthetic windows +Hypothesis: the original AR coefficient uniform0.2..0.995 overwhelmingly supplies rapidly decorrelating noise. Energy and short-horizon electricity remain weak across cutoffs; slow stochastic level variation may be missing. Change only the AR coefficient draw to phi=exp(-1/tau), log10(tau) uniform0..4. Keep the existing zero initial state and sqrt(1-phi^2) innovation normalization. All Fourier seasons, trends, changepoints, intermittency, observation-noise draws, synthetic fraction and real-window draws remain matched. +- Matched reference is the already completed E42 partial_targets run; do not retrain it. Same own E25 recency12000 initialization, seed79, packed_sample95-source corpus, B256, AdamW LR0.00005,12000 steps, saves3000/6000/12000. The E42 handling of partially observed targets is unchanged. +- Source declaration if selected: original local generator plus the modified log-uniform AR-time-constant generator, seed79. No new external data or pretrained assets. +- Scheduled after E52 releases its H100 allocation. Validate main screening and both earlier cutoffs against E42 at matched steps, then consider a matched parameter-difference transfer only if the learned effect is useful. No outcome yet. + +E61 sampler checks passed: {"cpu_seconds": 4.961035819957033, "main_rng_matched": true, "real_windows_unchanged": true, "periods_and_missing_masks_unchanged": true, "changed_synthetic_context_values": 31554, "optimizer_updates": 0} + +## E60 joint_filtered_control_ema0 +- Checkpoint SHA-256: `3a7e46a74247ccf366c4e2b950fe1e1cc3625c52f7db1f6fdebab261d1d66ae8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.121415376663208 seconds. +- Overall skill 0.375956; relative MASE 0.746201; relative WQL 0.521885. +- term skill: long=0.3991, medium=0.4059, short=0.3549. +- domain skill: Econ/Fin=0.1387, Energy=0.2371, Healthcare=0.4442, Nature=0.4287, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3506, H=0.3961, M=0.1054, Q=0.1984, S=0.4235, T=0.4345, W=0.2191. +- variates skill: multivariate=0.3928, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E60 joint_filtered_control_ema1000 +- Checkpoint SHA-256: `8f3493cddbf6579a69ed813b056f8a16110f6309d7589016703b68022bef205c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.04537320137024 seconds. +- Overall skill 0.376238; relative MASE 0.745929; relative WQL 0.521603. +- term skill: long=0.4000, medium=0.4050, short=0.3554. +- domain skill: Econ/Fin=0.1387, Energy=0.2375, Healthcare=0.4442, Nature=0.4301, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4986. +- frequency skill: A=0.3739, D=0.3521, H=0.3962, M=0.1054, Q=0.1984, S=0.4213, T=0.4350, W=0.2191. +- variates skill: multivariate=0.3934, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E60 joint_filtered_candidate_ema1000 +- Checkpoint SHA-256: `444ffa52005a89ef409a284a2a952d82da7f760e17f1ea865f118b1bb878fec5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.930442571640015 seconds. +- Overall skill 0.376281; relative MASE 0.745845; relative WQL 0.521590. +- term skill: long=0.4002, medium=0.4050, short=0.3554. +- domain skill: Econ/Fin=0.1387, Energy=0.2376, Healthcare=0.4442, Nature=0.4299, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4988. +- frequency skill: A=0.3739, D=0.3524, H=0.3961, M=0.1054, Q=0.1984, S=0.4208, T=0.4351, W=0.2191. +- variates skill: multivariate=0.3935, univariate=0.3622. +- Outcome: Initial identity is exact. At1000 both adapters show a small main-screen improvement; filtered versus control difference0.000043 is inconclusive. Continue to matched3000/6000 and earlier-cutoff diagnostics. + +## E58 matched37M at8000 +- Checkpoint SHA-256: `2e8a53df1226d34548c14d2f6aa29531e9562825e077658040ad03cf1584e407`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.826340913772583 seconds. +- Overall skill 0.374665; relative MASE 0.746940; relative WQL 0.523529. +- term skill: long=0.3997, medium=0.4070, short=0.3518. +- domain skill: Econ/Fin=0.1410, Energy=0.2366, Healthcare=0.4123, Nature=0.4301, Sales=0.3395, Transport=0.4651, Web/CloudOps=0.4997. +- frequency skill: A=0.3794, D=0.3492, H=0.3961, M=0.0913, Q=0.2022, S=0.4225, T=0.4363, W=0.2001. +- variates skill: multivariate=0.3935, univariate=0.3592. +- Outcome: Recovered from the4000-step dip but remains below its parent. Await the matched146M checkpoint. + +## E31 amplitude synthesis final24000 with original mean-template runtime +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.28603458404541 seconds. +- Overall skill 0.361862; relative MASE 0.761019; relative WQL 0.535099. +- term skill: long=0.3937, medium=0.4047, short=0.3318. +- domain skill: Econ/Fin=0.1167, Energy=0.1881, Healthcare=0.4079, Nature=0.4215, Sales=0.3445, Transport=0.4600, Web/CloudOps=0.5131. +- frequency skill: A=0.3736, D=0.3413, H=0.3832, M=0.0977, Q=0.2001, S=0.4426, T=0.4085, W=0.2080. +- variates skill: multivariate=0.3973, univariate=0.3321. +- Outcome: Finished24000 steps in7471.1 training-loop seconds. Original-rule screening score slightly exceeds matched E25; current-rule and ensemble comparisons are recorded separately. This checkpoint is member1 of E59. + +## E60 joint_filtered_control_ema3000 +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.558463096618652 seconds. +- Overall skill 0.376364; relative MASE 0.746340; relative WQL 0.521106. +- term skill: long=0.4004, medium=0.4033, short=0.3562. +- domain skill: Econ/Fin=0.1387, Energy=0.2353, Healthcare=0.4442, Nature=0.4338, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4989. +- frequency skill: A=0.3739, D=0.3535, H=0.3966, M=0.1054, Q=0.1984, S=0.4217, T=0.4342, W=0.2193. +- variates skill: multivariate=0.3937, univariate=0.3622. +- Outcome: Both remain ahead of the frozen parent on the main screen. Unfiltered control now leads by 0.000084; earlier-cutoff evaluations are running. Continue both to 6000 as specified. + +## E60 joint_filtered_candidate_ema3000 +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.436699151992798 seconds. +- Overall skill 0.376280; relative MASE 0.746320; relative WQL 0.521261. +- term skill: long=0.4005, medium=0.4035, short=0.3559. +- domain skill: Econ/Fin=0.1387, Energy=0.2352, Healthcare=0.4442, Nature=0.4324, Sales=0.3348, Transport=0.4657, Web/CloudOps=0.4997. +- frequency skill: A=0.3739, D=0.3528, H=0.3961, M=0.1054, Q=0.1984, S=0.4201, T=0.4351, W=0.2193. +- variates skill: multivariate=0.3935, univariate=0.3622. +- Outcome: Both remain ahead of the frozen parent on the main screen. Unfiltered control now leads by 0.000084; earlier-cutoff evaluations are running. Continue both to 6000 as specified. + +## E62 matched horizon-training correction transferred to the selected backbone +Hypothesis: E52's varied requested horizons may add to E42's partial-target correction when transferred to the later E47 backbone. Repeat the successful E55 matched-difference method with the E52 final checkpoint: E47 confidence6000 + E52 horizon_jitter12000 - E38 control12000. Coefficient is fixed at 1.0, with no sweep. This is equivalently the E55 backbone plus the E52-minus-E42 horizon-training difference, apart from floating-point order. Confidence projection remains unchanged. All three parents originate from our own random initialization and permitted sources. +- No new training or data. CPU merge records parent hashes and elapsed time; the candidate will use the current fixed inference rules. +- Compare the main screen and both earlier cutoffs against E55 and the current E59 package before any full validation or publication. A single main-screen gain is insufficient. No outcome yet. + +E61 long_memory_synth training started at 2026-10-22T06:01:39Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E60 joint_filtered_control at3000, backcast_evals +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.748270750045776 seconds. +- Overall skill 0.334618; relative MASE 0.799261; relative WQL 0.553928. +- term skill: long=0.3961, medium=0.3571, short=0.3004. +- domain skill: Econ/Fin=0.1631, Energy=0.2278, Healthcare=0.4091, Nature=0.3620, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4461. +- frequency skill: A=0.3254, D=0.3492, H=0.3639, M=0.1918, Q=0.2328, S=0.3399, T=0.3325, W=0.2872. +- variates skill: multivariate=0.3503, univariate=0.3218. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_control at3000, backcast2_evals +- Checkpoint SHA-256: `97b73dfac1a108dd79b419bef760ae281f25de78496cf982297bcd6c46f2bf3b`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.68830132484436 seconds. +- Overall skill 0.355826; relative MASE 0.774983; relative WQL 0.535445. +- term skill: long=0.3630, medium=0.3845, short=0.3417. +- domain skill: Econ/Fin=0.1127, Energy=0.2316, Healthcare=0.3474, Nature=0.4679, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4270. +- frequency skill: A=0.3556, D=0.4260, H=0.3879, M=0.1532, Q=0.1527, S=0.2768, T=0.3543, W=0.2578. +- variates skill: multivariate=0.3579, univariate=0.3541. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_candidate at3000, backcast_evals +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.67229199409485 seconds. +- Overall skill 0.334545; relative MASE 0.799017; relative WQL 0.554218. +- term skill: long=0.3960, medium=0.3575, short=0.3001. +- domain skill: Econ/Fin=0.1631, Energy=0.2272, Healthcare=0.4091, Nature=0.3627, Sales=0.3971, Transport=0.3715, Web/CloudOps=0.4460. +- frequency skill: A=0.3254, D=0.3486, H=0.3640, M=0.1918, Q=0.2328, S=0.3383, T=0.3328, W=0.2870. +- variates skill: multivariate=0.3502, univariate=0.3218. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E60 joint_filtered_candidate at3000, backcast2_evals +- Checkpoint SHA-256: `c37a8eddae4fc7419ea3ae0a28efc99dd6346e84f2d1807b5b6cb4013eeb2699`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.532593488693237 seconds. +- Overall skill 0.356065; relative MASE 0.774672; relative WQL 0.535261. +- term skill: long=0.3639, medium=0.3845, short=0.3418. +- domain skill: Econ/Fin=0.1127, Energy=0.2321, Healthcare=0.3474, Nature=0.4679, Sales=0.5489, Transport=0.4199, Web/CloudOps=0.4274. +- frequency skill: A=0.3556, D=0.4256, H=0.3883, M=0.1532, Q=0.1527, S=0.2764, T=0.3550, W=0.2576. +- variates skill: multivariate=0.3584, univariate=0.3541. +- Outcome: Reject the adapter branch: both earlier cutoffs regress against E55, by more than the main-screen gain. Filtering does not fix this failure. Prune both runs before their planned6000 endpoint; retain stop checkpoints for provenance. + +## E63 corpus expansion at 146M capacity +Hypothesis: E38's larger packed corpus did not improve the 37M model over 12,000 continuation steps, but a larger model with a longer schedule may benefit from the additional diversity. Add one matched data arm to E58: the same 146M initialization and optimization, using packed_expanded instead of packed_sample. The already-running E58 146M arm is the control; it is not retrained. +- Both packs contain the same 95 allow-listed directories. Source probabilities are read from packed_sample in both arms, so this changes within-source diversity rather than source balance. The expanded pack contains 5,653,290,832 points versus 958,745,103 in the control. No new generator or external source. +- Same own wide_capacity_initial checkpoint, seed 113, B96, 32,000 steps, base LR 0.00003, matched width-dependent AdamW groups, independently sign-augmented loss and EMA. Same runtime and batch64 for validation. All parameters train. +- First verify that the new loader reproduces the control's sampler exactly when given the control pack, and that expanded source probabilities match. The model and maximum tensor shapes are unchanged from the measured E58 memory fixture. +- Start after E60 adapter jobs stop. Compare checkpoints at 4000/8000/16000/24000/32000; evaluate earlier cutoffs before selection. This explicitly tests the interaction of corpus diversity and capacity, rather than repeating the small-model data comparison. No outcome yet. + +E63 checks passed: {"cpu_seconds": 6.780377898016013, "control_sampler_bitwise_equal": true, "source_probabilities_identical": true, "optimizer_updates": 0, "initial_checkpoint_sha256": "c3d41b52987eb033dcc60b4cd59e13e8adb75e319fe5f5bc043296faaac04849"} + +E60 joint_filtered_control stopped: {"final_step": 4691, "final_checkpoint": "/workspace/research/runs/joint_filtered_control/ema004691.pt", "checkpoint_sha256": "8d48a377b49cfd980a973aa9505565a537ed69c27c621ccf39b19d5787fb720b", "last_logged_training_seconds": 592.3, "last_logged_step": 4650, "all_original_tensors_bitwise_unchanged": true, "reason": "Both earlier cutoffs regress at3000 by more than the main gain; negative branch pruned."} + +E60 joint_filtered_candidate stopped: {"final_step": 4648, "final_checkpoint": "/workspace/research/runs/joint_filtered_candidate/ema004648.pt", "checkpoint_sha256": "1574e71b8877b5620a5929a55df22347c9475184194dec37ccb38c0eb71ed9c8", "last_logged_training_seconds": 590.2, "last_logged_step": 4600, "all_original_tensors_bitwise_unchanged": true, "reason": "Both earlier cutoffs regress at3000 by more than the main gain; negative branch pruned."} + +## E52 varied requested horizons final12000 +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.63369631767273 seconds. +- Overall skill 0.362379; relative MASE 0.760035; relative WQL 0.534923. +- term skill: long=0.3913, medium=0.4055, short=0.3334. +- domain skill: Econ/Fin=0.1099, Energy=0.1916, Healthcare=0.4150, Nature=0.4272, Sales=0.3410, Transport=0.4599, Web/CloudOps=0.5083. +- frequency skill: A=0.3715, D=0.3433, H=0.3828, M=0.1086, Q=0.1994, S=0.4416, T=0.4075, W=0.2138. +- variates skill: multivariate=0.3960, univariate=0.3343. +- Outcome: Completed in3887.5 training-loop seconds (3897.218 process seconds). Main improves versus matched E42; inspect both earlier cutoffs and E62 transfer. + +## E52 final12000 first earlier cutoff +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 19.096883296966553 seconds. +- Overall skill 0.331566; relative MASE 0.804478; relative WQL 0.555396. +- term skill: long=0.3906, medium=0.3563, short=0.2975. +- domain skill: Econ/Fin=0.1463, Energy=0.2302, Healthcare=0.4120, Nature=0.3520, Sales=0.3984, Transport=0.3650, Web/CloudOps=0.4442. +- frequency skill: A=0.3138, D=0.3562, H=0.3588, M=0.1622, Q=0.2341, S=0.3415, T=0.3316, W=0.2747. +- variates skill: multivariate=0.3480, univariate=0.3182. +- Outcome: Improves over E42 by0.000492. + +## E52 final12000 second earlier cutoff +- Checkpoint SHA-256: `830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 18.59932589530945 seconds. +- Overall skill 0.353232; relative MASE 0.776549; relative WQL 0.538676. +- term skill: long=0.3692, medium=0.3768, short=0.3380. +- domain skill: Econ/Fin=0.0898, Energy=0.2297, Healthcare=0.3632, Nature=0.4567, Sales=0.5538, Transport=0.4144, Web/CloudOps=0.4314. +- frequency skill: A=0.3506, D=0.4238, H=0.3876, M=0.1727, Q=0.1527, S=0.2824, T=0.3479, W=0.2436. +- variates skill: multivariate=0.3614, univariate=0.3466. +- Outcome: Improves over E42 by0.000136. The final horizon variation treatment improves all three matched screening windows. + +## E62 transferred horizon correction main screen +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.18038821220398 seconds. +- Overall skill 0.377343; relative MASE 0.744367; relative WQL 0.520847. +- term skill: long=0.3993, medium=0.4068, short=0.3570. +- domain skill: Econ/Fin=0.1398, Energy=0.2376, Healthcare=0.4513, Nature=0.4321, Sales=0.3339, Transport=0.4661, Web/CloudOps=0.4995. +- frequency skill: A=0.3721, D=0.3559, H=0.3958, M=0.1049, Q=0.1994, S=0.4226, T=0.4360, W=0.2230. +- variates skill: multivariate=0.3942, univariate=0.3636. +- Outcome: Main gain0.001387 over E55. CPU composition1.266 seconds; await both earlier-cutoff checks before full validation. + +## E62 transferred horizon correction first earlier cutoff +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.59067988395691 seconds. +- Overall skill 0.336227; relative MASE 0.797258; relative WQL 0.552638. +- term skill: long=0.3980, medium=0.3585, short=0.3020. +- domain skill: Econ/Fin=0.1632, Energy=0.2299, Healthcare=0.4035, Nature=0.3641, Sales=0.3973, Transport=0.3720, Web/CloudOps=0.4497. +- frequency skill: A=0.3264, D=0.3494, H=0.3653, M=0.1894, Q=0.2332, S=0.3419, T=0.3364, W=0.2851. +- variates skill: multivariate=0.3539, univariate=0.3218. +- Outcome: Improves over E55 by0.000618 and current E59 ensemble by0.000525; second earlier cutoff pending. + +## E64 replace the horizon-corrected member in the fixed equal-weight ensemble +Hypothesis: E62 improves all three windows against E55, but the current E59 ensemble remains stronger at the second earlier cutoff. Replace only member0 of E59 with E62 and retain the amplitude-trained member1, applying the same equal quantile average after each member's fixed rules. No new weights, training, blend coefficient or postprocessing is introduced. Every member still forecasts every instance. +- Use cached forecasts first on the main screen and both earlier cutoffs. Compare the candidate ensemble with E62 alone and E59. Validate the actual package if the composition offers a useful improvement. + +## E62 transferred horizon correction second earlier cutoff +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.85834312438965 seconds. +- Overall skill 0.357693; relative MASE 0.772232; relative WQL 0.534241. +- term skill: long=0.3647, medium=0.3858, short=0.3439. +- domain skill: Econ/Fin=0.1095, Energy=0.2360, Healthcare=0.3457, Nature=0.4673, Sales=0.5494, Transport=0.4200, Web/CloudOps=0.4312. +- frequency skill: A=0.3533, D=0.4246, H=0.3905, M=0.1533, Q=0.1508, S=0.2809, T=0.3574, W=0.2594. +- variates skill: multivariate=0.3632, univariate=0.3532. +- Outcome: Improves over E55 by0.000222. All three screening windows improve against the single-model parent; E59 still leads at this cutoff. Proceed to full validation and the fixed E64 ensemble comparison. + +E64 member checkpoint hashes: 22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb. + +E64 cached screen: skill 0.376788946; relative MASE 0.745126449; relative WQL 0.521243098; CPU elapsed 4.12 seconds. Group skill: {"term": {"short": 0.3554964007817075, "medium": 0.4073693459600539, "long": 0.3998307241854733}, "domain": {"Econ/Fin": 0.14130300023652653, "Energy": 0.2369496172656066, "Healthcare": 0.4331271903068751, "Nature": 0.4295973732895463, "Sales": 0.3381125790990753, "Transport": 0.4660477929672022, "Web/CloudOps": 0.5028903628931379}, "freq": {"A-DEC": 0.37465521703273497, "Q-DEC": 0.20133386157730448, "M": 0.09799796329514798, "W-SUN": 0.09310304137899561, "D": 0.35177652554445227, "H": 0.39569724381500315, "15T": 0.21510285937582785, "W-FRI": -0.01717810068114023, "10T": 0.6134978939570246, "W-TUE": 0.5590219029222432, "W-THU": 0.20713023925638596, "W-WED": 0.3147893218102069, "5T": 0.5146554293758923, "10S": 0.42304338912946016}}. + +E64 cached backcast: skill 0.336038010; relative MASE 0.797789283; relative WQL 0.552583914; CPU elapsed 3.90 seconds. Group skill: {"term": {"short": 0.3017705847743448, "medium": 0.3583628431586988, "long": 0.3977762964359516}, "domain": {"Econ/Fin": 0.16247452271830498, "Energy": 0.22924210402608347, "Healthcare": 0.4037429866174578, "Nature": 0.3634291235876055, "Sales": 0.3979195783227222, "Transport": 0.3717322673047254, "Web/CloudOps": 0.45027750430374125}, "freq": {"A-DEC": 0.31962125220900417, "Q-DEC": 0.23151630865404227, "M": 0.19676862244049742, "W-SUN": 0.04104954385433246, "D": 0.3494141749986718, "H": 0.36512969667883677, "15T": 0.22647340624655954, "W-FRI": 0.26044659511767176, "10T": 0.3206375756185784, "W-TUE": 0.5251272756681418, "W-THU": 0.23336875275806457, "W-WED": 0.34380336710053805, "5T": 0.4388723441407405, "10S": 0.34124569112919356}}. + +E64 cached backcast2: skill 0.358773194; relative MASE 0.771487726; relative WQL 0.532959635; CPU elapsed 3.84 seconds. Group skill: {"term": {"short": 0.3455453575305818, "medium": 0.3850562697420571, "long": 0.3662794409758179}, "domain": {"Econ/Fin": 0.11178929070509958, "Energy": 0.2358139051710867, "Healthcare": 0.3485087569088834, "Nature": 0.46931745466541086, "Sales": 0.5520970513032182, "Transport": 0.4203697870790297, "Web/CloudOps": 0.4324624263189104}, "freq": {"A-DEC": 0.3552674881858966, "Q-DEC": 0.15052699940899794, "M": 0.14543941174604302, "W-SUN": 0.05780563284435891, "D": 0.4280091613762501, "H": 0.39053406736994467, "15T": 0.10558086695082369, "W-FRI": 0.14677601366514947, "10T": 0.4931102944101511, "W-TUE": 0.10259191794259981, "W-THU": 0.32777977287160787, "W-WED": 0.5368109233756173, "5T": 0.46691593361082795, "10S": 0.2842010268357835}}. + +E64 improves over current E59 on all three cutoffs. Versus E62 alone, it trails on the main screen and first earlier cutoff but gains at the second. Both complete packages will receive full validation; the current root remains E59 until that comparison and determinism checks finish. + +E64 actual package matches the cached equal-weight composition bitwise for every quantile in all 97 screening configurations. Proceed to exact full-package validation. + +## E65 recent normalization with an 8192-point encoder context +Hypothesis: adding older history changes the normalization reference as well as supplying extra observations. E54's final8192 model scores0.375118 versus its matched4096 control0.375764. Test whether retaining the recent4096 mean and standard deviation makes older context easier to use. The encoder still receives all8192 points; every point and future target uses the recent reference frame. If the recent segment has no finite observations, fall back to the full available context. +- Change only normalization. Same E54 initialization from own recency24000, seed101, matched packed_sample windows, B128, LR0.00003,12000 steps, maximum context8192 and sample context8192. Contexts of at most4096 retain the original formula. Fixed inference corrections still see only4096 observations. The existing E54 long-context run is the control. No new sources or generators. +- Training-data diagnostic: 256 real allowed-corpus windows, seed151;101 had sufficient older and recent history. Full/recent standard-deviation ratio p10/p50/p90 was0.932/1.003/1.255; absolute mean shift in recent standard deviations was0.0068/0.0512/0.4089. This motivates testing the frame, without establishing it as the cause of the regression. Diagnostic CPU time1.90 seconds; no validation data used. +- Verify exact equivalence for contexts at most4096 and finite fallback behavior before launch. Check main screens at3000/6000/12000 and earlier cutoffs before selection. No outcome yet. + +E65 checks passed: {"cpu_seconds": 0.7186618210980669, "short_context_normalization_bitwise_equal": true, "short_context_forecast_bitwise_equal": true, "recent_reference_and_empty_recent_fallback_verified": true, "all_missing_finite": true, "optimizer_updates": 0} + +## E62 exact full-package validation +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.373420; relative MASE 0.747096; relative WQL 0.525505. +- term skill: long=0.3931, medium=0.4057, short=0.3528. +- domain skill: Econ/Fin=0.1173, Energy=0.2305, Healthcare=0.4574, Nature=0.4321, Sales=0.3479, Transport=0.4663, Web/CloudOps=0.4919. +- frequency skill: A=0.2918, D=0.3600, H=0.3910, M=0.1281, Q=0.1853, S=0.4226, T=0.4289, W=0.2156. +- variates skill: multivariate=0.3899, univariate=0.3600. +- Outcome: Full skill0.373420 versus E59 published0.372254. All97 configurations and151170 instances pass; no quantile crossings. Actual inference116.659 seconds. Await E64 full comparison and relocation/determinism before choosing the next publication. + +## E54 context8192 final12000 +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.50181746482849 seconds. +- Overall skill 0.375118; relative MASE 0.744591; relative WQL 0.524419. +- term skill: long=0.4042, medium=0.4057, short=0.3513. +- domain skill: Econ/Fin=0.1426, Energy=0.2337, Healthcare=0.4381, Nature=0.4222, Sales=0.3378, Transport=0.4707, Web/CloudOps=0.5001. +- frequency skill: A=0.3749, D=0.3573, H=0.3955, M=0.0779, Q=0.2010, S=0.4259, T=0.4332, W=0.2127. +- variates skill: multivariate=0.3910, univariate=0.3622. +- Outcome: Finished in3285.3 training-loop seconds (3296.255 process seconds). Main skill0.375118 remains below matched4096 control0.375764. Do not select this checkpoint; E65 isolates the normalization-frame hypothesis. + +## E58 widened146M at8000 +- Checkpoint SHA-256: `822fdf9f16fb741ab5e23728ad13cac2838a70ad4cfa23a191c9373294a6b4d5`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.286028146743774 seconds. +- Overall skill 0.374330; relative MASE 0.747410; relative WQL 0.523759. +- term skill: long=0.3993, medium=0.4074, short=0.3512. +- domain skill: Econ/Fin=0.1416, Energy=0.2364, Healthcare=0.4073, Nature=0.4301, Sales=0.3397, Transport=0.4652, Web/CloudOps=0.4995. +- frequency skill: A=0.3799, D=0.3459, H=0.3958, M=0.0911, Q=0.2002, S=0.4225, T=0.4364, W=0.2039. +- variates skill: multivariate=0.3933, univariate=0.3588. +- Outcome: Main skill0.374330 versus matched37M0.374665, reversing the small4000-step advantage. Both remain below initialization. Continue the prespecified32000-step capacity comparison; no capacity conclusion or package change yet. + +## E64 exact full-package validation after operator recovery +- Checkpoint SHA-256: `35306ec57b81c42e8fbdfab14adc96293400eee0dbd808fadbb3c973f9ff427e`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.372871; relative MASE 0.747913; relative WQL 0.525850. +- term skill: long=0.3938, medium=0.4063, short=0.3513. +- domain skill: Econ/Fin=0.1184, Energy=0.2299, Healthcare=0.4400, Nature=0.4295, Sales=0.3508, Transport=0.4663, Web/CloudOps=0.4954. +- frequency skill: A=0.2911, D=0.3562, H=0.3909, M=0.1203, Q=0.1862, S=0.4230, T=0.4309, W=0.2097. +- variates skill: multivariate=0.3912, univariate=0.3579. +- Outcome: Full skill0.372871 beats E59 but trails E62 single0.373420. Both pass relocation/determinism. Select E62 single, retaining E64 as a replayable alternative. E64 full inference79.236 seconds on an otherwise idle H100; do not compare that timing directly with concurrent-training measurements. + +## Operator interruption and recovery, 2026-10-22 +All previous container processes were confirmed ended; the H100 was idle. No credentials were inspected. Completed reports and atomic checkpoints were retained. E64 full validation was rerun because no completed report survived. Both E62 and E64 passed asset hashes and independent relocation: [ + { + "package": "/run-state/workspace/research/candidate-horizon-delta12k", + "checkpoint_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "configurations": 3, + "bitwise_equal_after_relocation": true, + "finite_and_monotone": true, + "seconds": 6.016964558046311 + }, + { + "package": "/run-state/workspace/research/candidate-horizon-ensemble", + "checkpoint_sha256": "35306ec57b81c42e8fbdfab14adc96293400eee0dbd808fadbb3c973f9ff427e", + "configurations": 3, + "bitwise_equal_after_relocation": true, + "finite_and_monotone": true, + "seconds": 6.803807514021173 + } +] + + +Publication decision: E62 single has the highest exact full-validation skill among replayed candidates (0.373419858), improves all three screening cutoffs versus E55, and wins the main screen and first earlier cutoff against E64. E64 retains a second-earlier-cutoff advantage but is lower on full validation. Publish E62 with complete runtime, all own-checkpoint lineage, generator code, pinned requirements, this experiment log and the full report. Scores remain on the validation scale, not the held-out reward scale. + +## E66 matched recovery of interrupted research runs +The operator interruption ended all trainers. E58 146M had step/EMA8000, while its37M control also had12000; neither had Adam or sampler state. Both arms restart from their own step8000 and EMA8000, preserving a common comparison point. Fresh AdamW and a shared new sampler seed179 begin at global step8001, with400-step rewarmup and the original cosine schedule through32000. This is a documented matched continuation, not an exact resumption of the old optimizer trajectory. Existing control12000 is retained but is not the recovered comparison control. +- E63 expanded146M had only initialization saved, so it restarts from its own initial checkpoint with original seed113. It will receive the identical optimizer/stream reset at global8000 to match E58 recovery. E61 slow-memory and E65 recent normalization had no completed checkpoints, so they restart from their declared parent, original seeds and settings. No baseline or completed scientific comparison is retrained. +- New driver saves weights, EMA, optimizer, CPU/CUDA RNG, sampler and batch RNG states, and the prefetched next batch atomically every1000 steps. Independent interrupted/continuous fixture: {"seed": 191, "steps": 4, "batch": 2, "fixture_parameters": 164384, "purpose": "recovery fixture only; never selected", "maximum_model_difference": 1.2101430968414206e-14, "maximum_ema_difference": 2.4147350785597155e-15, "maximum_optimizer_difference": 7.095019016745141e-16, "rng_and_prefetched_batch_bitwise_equal": true, "note": "Complete state restored; GPU training replay differs by floating-point roundoff, so training replay is not claimed bitwise identical. Package inference checks are separately bitwise."}. Four optimizer updates per fixture path used only permitted data; fixture weights are never candidates. +- Work lost after the last usable checkpoints: E58 large at least800 steps, control at least1550 beyond its latest12000 (the matched restart also intentionally returns to8000); E63 at least1700; E61 at least2150; E65 at least300. Last logged elapsed times before interruption:2432.6,2101.5,388.0,542.2,71.8 seconds respectively. These are concurrent process times, not summed exclusive GPU time. + +## E67 end-to-end paired-sign training on the selected horizon-corrected model +Hypothesis: E50 updated only the output head and did not sustain a paired-loss gain. The full encoder/decoder may be able to learn complementary sign-orientation forecasts when optimized through the exact neural average used in inference. Compare two full-model continuations from own E62: both forward x and -x, but the control scores each orientation separately while the candidate scores their ordered-quantile average. This changes the loss, not the sampled windows, number of forward passes, architecture or inference. +- Both arms retain E52 random requested-horizon prefixes and E42 partial-target future-key masking, now integrated with the selected confidence features. At inference the requested horizon is fully available and the forward pass must remain bitwise identical at initialization to E62. +- Own parent horizon_delta12k.pt (SHA-25622c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c); seed197, independent horizon seed300200, packed_sample95 allowed sources and the same local generator, B64 distinct windows /128 signed rows, LR0.00002,12000 steps, all parameters train. Same warmup400 and cosine schedule. Every runtime member forecasts every instance; no validation data are used for gradients. +- Check initialization identity, paired-loss sign symmetry and the independence of unused future tokens. Measure maximum-shape memory before launch. Compare main and both earlier cutoffs; a main-only gain is insufficient. Complete recovery state includes both sampler RNGs. No outcome yet. + +E67 checks passed: { + "cpu_seconds": 3.4358641319558956, + "initial_forecast_bitwise_parent": true, + "unused_future_tokens_do_not_change_requested_prefix": true, + "paired_loss_sign_symmetric": true, + "matched_sampler_main_and_horizon_rng": true, + "gpu_fixture_seconds": 3.137407455011271, + "allocated_mib": 5783.81689453125, + "reserved_mib": 6266.0, + "optimizer_updates": 0 +}. Current allocated/reserved process footprint fits both additional paired arms within the single80GB H100. Each new arm uses about6.3GiB reserved at maximum shape. + +## E68 fixed upward quantile-level shift +Hypothesis: E62 coverage diagnostics show upper-tail underprediction in several groups, while lower-tail excess inclusive coverage is largely due to ties at exact zero. Test one globally fixed quantile-function shift from level p to p+0.025, linearly interpolating between adjacent predicted deciles and extrapolating the uppermost interval. This is equivalent to75% of q(p)+25% of q(p+0.1), with upper-end linear extrapolation. It shifts the median as well as intervals. No dataset-specific parameters, context optimization, new training or weight fitting. +- Apply after the existing fixed rules. Monotonicity and nonnegative quantiles for nonnegative histories are preserved by upward interpolation/extrapolation. Compare only unchanged and the predeclared+0.025 setting on the main screen and both earlier cutoffs. No coefficient sweep. +- Descriptive coverage files horizon_delta_calibration_bounds.json and calibration_diagnostic.py retain strict/inclusive tie bounds. Parent weights SHA-25622c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c. No outcome yet. + +E68 screen, CPU elapsed2.34 seconds: +- unchanged: skill0.377343216, relative MASE0.744366865, relative WQL0.520847298; group skill {"term": {"short": 0.35695456496017197, "medium": 0.4068421174843613, "long": 0.3992704749750494}, "domain": {"Econ/Fin": 0.1398359119561744, "Energy": 0.23759505750828103, "Healthcare": 0.4512562626750727, "Nature": 0.4321373180939323, "Sales": 0.33393397659338675, "Transport": 0.46608088355848554, "Web/CloudOps": 0.49950488336015364}, "freq": {"A-DEC": 0.37212708500173697, "Q-DEC": 0.19935115627243538, "M": 0.10494660003314427, "W-SUN": 0.09001322152715163, "D": 0.355915177294738, "H": 0.39579077444245214, "15T": 0.214120657226064, "W-FRI": -0.015604695485733178, "10T": 0.6146535484250835, "W-TUE": 0.5792731324380282, "W-THU": 0.21095087378926547, "W-WED": 0.3154347093297968, "5T": 0.5103163560669302, "10S": 0.42256110774455713}}. +- shift_up_0025: skill0.376908525, relative MASE0.742757759, relative WQL0.522704720; group skill {"term": {"short": 0.3566597008609087, "medium": 0.404403536500499, "long": 0.4005186267241073}, "domain": {"Econ/Fin": 0.14287974364263867, "Energy": 0.23414603173384185, "Healthcare": 0.43949354133666974, "Nature": 0.4298630701436009, "Sales": 0.32658918319903174, "Transport": 0.470151191104459, "Web/CloudOps": 0.5032582354135502}, "freq": {"A-DEC": 0.380333567897149, "Q-DEC": 0.20181706747540706, "M": 0.08925268144424381, "W-SUN": 0.07477217948655135, "D": 0.35474663372376547, "H": 0.3940149463382252, "15T": 0.21958831724211048, "W-FRI": -0.0580596428780249, "10T": 0.6129399194069542, "W-TUE": 0.5699015681127257, "W-THU": 0.21136203731846115, "W-WED": 0.3102694893262884, "5T": 0.5147323912192434, "10S": 0.4303777414462714}}. + +E68 backcast, CPU elapsed2.34 seconds: +- unchanged: skill0.336227035, relative MASE0.797257690, relative WQL0.552637565; group skill {"term": {"short": 0.3019534316321959, "medium": 0.35847999416902554, "long": 0.3980452217736976}, "domain": {"Econ/Fin": 0.16321936365108436, "Energy": 0.22989895953120598, "Healthcare": 0.4035339334978575, "Nature": 0.3640809439324144, "Sales": 0.39727796653561065, "Transport": 0.37202575172526886, "Web/CloudOps": 0.4496899590670599}, "freq": {"A-DEC": 0.32642568966436736, "Q-DEC": 0.23316387018660967, "M": 0.18942546327646903, "W-SUN": 0.03722616253430944, "D": 0.3493567465552936, "H": 0.3653486861566616, "15T": 0.22544143675041628, "W-FRI": 0.2612228517292393, "10T": 0.32002639781339237, "W-TUE": 0.5369423215086733, "W-THU": 0.24695593621438172, "W-WED": 0.34366857690318564, "5T": 0.43841920169431536, "10S": 0.34189056734107803}}. +- shift_up_0025: skill0.333181127, relative MASE0.800191338, relative WQL0.555676359; group skill {"term": {"short": 0.30012284957976143, "medium": 0.3563718754867885, "long": 0.3913827408796766}, "domain": {"Econ/Fin": 0.16216091726465265, "Energy": 0.22830088335034404, "Healthcare": 0.4226177811841181, "Nature": 0.3541417493195709, "Sales": 0.38842247511482564, "Transport": 0.3660239875770892, "Web/CloudOps": 0.4469561601104274}, "freq": {"A-DEC": 0.3265608246880194, "Q-DEC": 0.22474554051269913, "M": 0.18267190809841738, "W-SUN": 0.03302751086137623, "D": 0.35103471245845674, "H": 0.36176195029219793, "15T": 0.21821690985575604, "W-FRI": 0.25908813449545354, "10T": 0.3119130318041733, "W-TUE": 0.5410511096762922, "W-THU": 0.24171213296902283, "W-WED": 0.34305917574568634, "5T": 0.43719448871859334, "10S": 0.33922568556395327}}. + +E68 backcast2, CPU elapsed2.31 seconds: +- unchanged: skill0.357693384, relative MASE0.772231694, relative WQL0.534240944; group skill {"term": {"short": 0.34387576099815587, "medium": 0.38579809375160923, "long": 0.36474587566145333}, "domain": {"Econ/Fin": 0.10948663145426041, "Energy": 0.23595983020029976, "Healthcare": 0.3456833197210143, "Nature": 0.4672524394882832, "Sales": 0.5493882044206345, "Transport": 0.4200285125423293, "Web/CloudOps": 0.4311910731987415}, "freq": {"A-DEC": 0.3532937085689807, "Q-DEC": 0.15079546315571057, "M": 0.15334987951579737, "W-SUN": 0.053222430353438654, "D": 0.42461678912892176, "H": 0.39045164404809307, "15T": 0.1063009642103484, "W-FRI": 0.14702837959358672, "10T": 0.4925745835795794, "W-TUE": 0.10051793538767262, "W-THU": 0.31968494040001116, "W-WED": 0.5361596335033245, "5T": 0.4655530740312157, "10S": 0.280869499353007}}. +- shift_up_0025: skill0.352929872, relative MASE0.775985000, relative WQL0.539571964; group skill {"term": {"short": 0.3397486152051552, "medium": 0.38072074318949967, "long": 0.3585956199908913}, "domain": {"Econ/Fin": 0.10581887733310036, "Energy": 0.23338234809030112, "Healthcare": 0.3418028155977272, "Nature": 0.4611553878945821, "Sales": 0.543948848409417, "Transport": 0.4138948091247504, "Web/CloudOps": 0.42581951888726777}, "freq": {"A-DEC": 0.3525707634011239, "Q-DEC": 0.14006676676474916, "M": 0.14537682622646142, "W-SUN": 0.05718515322639861, "D": 0.42470757896302946, "H": 0.38580382383546696, "15T": 0.0967294266428953, "W-FRI": 0.16016050379952163, "10T": 0.4943536981461871, "W-TUE": 0.05512451342569891, "W-THU": 0.29480125149705005, "W-WED": 0.5302395339818361, "5T": 0.4614399225720033, "10S": 0.2693556274034984}}. + +E68 rejected: the fixed upward quantile shift loses on all three windows, including -0.00305 and -0.00476 at the earlier cutoffs. Main median MASE improves slightly but WQL worsens. Descriptive coverage imbalance does not justify a global quantile shift. Retain E62 quantiles unchanged; no further coefficient sweep. + +## E69 persistent stochastic volatility in synthetic training windows — prepared, not launched +Hypothesis: the local generator changes seasonal amplitude in E31 but its observation-noise scale stays constant throughout a window. Teach conditional uncertainty under persistent volatility by multiplying the Gaussian/AR noise component by an independent positive log-OU curve in half of synthetic windows. Leave signal, AR coefficient, observation-noise draws, real windows and the main RNG unchanged. +- Proposed matched reference: completed E42 partial-target training. Same own recency12000 parent, seed79, packed_sample, B256, LR0.00005,12000 steps and original schedule. Only the noise envelope differs; no architecture or inference change. +- Independent generator seed500082; log time constant uniform1.5..3.5 (about32..3162 steps), log standard deviation uniform0.1..0.8, stationary Gaussian initial log state, exp(logcurve-0.5*sd^2), log envelope clipped[-2.5,2.5]. Synthetic fraction remains0.2, so roughly10% of all windows receive the new envelope. +- Verify real-window and main-RNG equality before launch. Queue only when a GPU allocation is released; no training has started. Final selection requires main and both earlier-cutoff evidence. + +E69 preparation checks: {"cpu_seconds": 4.379837638000026, "main_rng_matched": true, "real_windows_unchanged": true, "periods_and_missing_masks_unchanged": true, "changed_synthetic_context_values": 52057, "optimizer_updates": 0} + +## E67 full_paired_control at1000 +- Checkpoint SHA-256: `0aa7ece151109e13af73e7ca2d6b75baa95e67898a6273a081ed38e92cfc63cd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.88213801383972 seconds. +- Overall skill 0.376434; relative MASE 0.745243; relative WQL 0.521755. +- term skill: long=0.3984, medium=0.4065, short=0.3558. +- domain skill: Econ/Fin=0.1332, Energy=0.2361, Healthcare=0.4573, Nature=0.4305, Sales=0.3351, Transport=0.4660, Web/CloudOps=0.4983. +- frequency skill: A=0.3675, D=0.3539, H=0.3948, M=0.1051, Q=0.1982, S=0.4219, T=0.4350, W=0.2252. +- variates skill: multivariate=0.3925, univariate=0.3634. +- Outcome: Paired objective leads the matched individual-orientation control by0.000426, but both trail the frozen E62 parent0.377343. Continue to3000 before interpreting the early optimization drop. + +## E67 full_paired_candidate at1000 +- Checkpoint SHA-256: `256329643ba1d7074386d227f4dafd6bdbf0faca5bf2280a60be51ddf2ad90ee`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.336730480194092 seconds. +- Overall skill 0.376860; relative MASE 0.744723; relative WQL 0.521407. +- term skill: long=0.3991, medium=0.4063, short=0.3564. +- domain skill: Econ/Fin=0.1316, Energy=0.2364, Healthcare=0.4620, Nature=0.4301, Sales=0.3350, Transport=0.4669, Web/CloudOps=0.4985. +- frequency skill: A=0.3655, D=0.3560, H=0.3951, M=0.1058, Q=0.1980, S=0.4230, T=0.4348, W=0.2256. +- variates skill: multivariate=0.3926, univariate=0.3640. +- Outcome: Paired objective leads the matched individual-orientation control by0.000426, but both trail the frozen E62 parent0.377343. Continue to3000 before interpreting the early optimization drop. + +Additional historical diagnostic: valid_backcast3 contains93 configurations and8812 instances, derived only from existing validation histories. This cutoff was not used in earlier selection. Compare E62 and its E55 predecessor, plus the fixed amplitude ensemble option; all outputs are selection/diagnostics only. Scales use capped prefixes and its own Seasonal Naive baseline. + +## Previously unused third earlier cutoff: horizon_delta12k +- Checkpoint SHA-256: `22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.37537980079651 seconds. +- Overall skill 0.387789; relative MASE 0.738165; relative WQL 0.507749. +- term skill: long=0.3944, medium=0.3602, short=0.3954. +- domain skill: Econ/Fin=0.1725, Energy=0.3191, Healthcare=0.2442, Nature=0.5053, Sales=0.3990, Transport=0.5060, Web/CloudOps=0.3880. +- frequency skill: A=0.3565, D=0.4418, H=0.4032, M=0.1118, Q=0.2628, S=0.2833, T=0.4297, W=0.2606. +- variates skill: multivariate=0.3722, univariate=0.3998. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +## Previously unused third earlier cutoff: partial_delta12k +- Checkpoint SHA-256: `721d1029284ea6f36d4c6f169eb001382a97a2848953fad84e3e62fb5a222802`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.088595867156982 seconds. +- Overall skill 0.387664; relative MASE 0.738315; relative WQL 0.507852. +- term skill: long=0.3943, medium=0.3601, short=0.3953. +- domain skill: Econ/Fin=0.1728, Energy=0.3188, Healthcare=0.2482, Nature=0.5065, Sales=0.3984, Transport=0.5041, Web/CloudOps=0.3876. +- frequency skill: A=0.3519, D=0.4408, H=0.4034, M=0.1157, Q=0.2629, S=0.2853, T=0.4287, W=0.2628. +- variates skill: multivariate=0.3721, univariate=0.3997. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +## Previously unused third earlier cutoff: amplitude_fixed_ema24000 +- Checkpoint SHA-256: `ecab9102fc11909555044c67dffda85280e06a375f1733351c7e9a39bf2ce9bb`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 24.98914361000061 seconds. +- Overall skill 0.386555; relative MASE 0.740761; relative WQL 0.508011. +- term skill: long=0.3906, medium=0.3617, short=0.3941. +- domain skill: Econ/Fin=0.1763, Energy=0.3186, Healthcare=0.2144, Nature=0.5055, Sales=0.3950, Transport=0.5054, Web/CloudOps=0.3892. +- frequency skill: A=0.3670, D=0.4397, H=0.4032, M=0.1018, Q=0.2609, S=0.2818, T=0.4298, W=0.2517. +- variates skill: multivariate=0.3715, univariate=0.3982. +- Outcome: 93 configurations and8812 instances have enough remaining history. E62 retains a small0.000124 gain over E55 here; amplitude-only is lower. Scores are diagnostic and have their own Seasonal Naive reference. Retain the published E62 while checking the fixed ensemble combinations. + +Third earlier cutoff, fixed horizon+amplitude ensemble: skill0.387712467, relative MASE0.738747107, relative WQL0.507475454; CPU1.61 seconds; group skill {"term": {"short": 0.3954701763614715, "medium": 0.36122355126648487, "long": 0.39279890497296066}, "domain": {"Econ/Fin": 0.1751736307959596, "Energy": 0.31921698125326037, "Healthcare": 0.23298033105692906, "Nature": 0.5060089627880903, "Sales": 0.3975145877969797, "Transport": 0.5058849307923443, "Web/CloudOps": 0.3889682376441502}, "freq": {"A-DEC": 0.3624040337196054, "Q-DEC": 0.2624518143609271, "M": 0.10707417310085743, "W-SUN": 0.1583361093273692, "D": 0.4418985852875217, "H": 0.403440739007801, "15T": 0.2601635557329961, "W-FRI": 0.014090974305712378, "10T": 0.6023775368816131, "W-TUE": 0.24266767576389037, "W-THU": 0.3814500446358562, "W-WED": 0.36993536616236844, "5T": 0.4629495965892555, "10S": 0.28289459770032044}}. + +Third earlier cutoff, fixed partial+amplitude ensemble: skill0.387583102, relative MASE0.738907219, relative WQL0.507579906; CPU1.63 seconds; group skill {"term": {"short": 0.39530402146176624, "medium": 0.36114921433277336, "long": 0.39271964935249504}, "domain": {"Econ/Fin": 0.17527256907786126, "Energy": 0.31900374729462777, "Healthcare": 0.23531552352603602, "Nature": 0.5063494545833882, "Sales": 0.3972024195554572, "Transport": 0.5049447049689553, "Web/CloudOps": 0.3887045854899489}, "freq": {"A-DEC": 0.36012619804016577, "Q-DEC": 0.2622822707122595, "M": 0.10906468169471106, "W-SUN": 0.15682778156902044, "D": 0.44126848409451547, "H": 0.4035052878161369, "15T": 0.26032721770481526, "W-FRI": 0.011894162492874005, "10T": 0.6016201297891219, "W-TUE": 0.2491326450741952, "W-THU": 0.38350286292612645, "W-WED": 0.3695417432322957, "5T": 0.4619676858363392, "10S": 0.2838781358710065}}. + +The new historical check does not overturn the publication: E62 beats E55 individually at this fourth available window, while the fixed ensemble comparison remains a documented alternative. Full validation and main screening still favor the published single model. + +## E70 training-only compiler throughput diagnostic +Hypothesis: operator/kernel overhead limits the many small transformer operations on one H100. Benchmark torch.compile on the existing own E62 model and unpaired training loss, using64 permitted pretraining windows of context2048/horizon512, seed223. No optimizer updates; no validation examples; no compiler change to the published runtime. Compare eager and compiled loss, gradient direction and absolute differences, then alternate20-step forward/backward timing blocks three times under the existing shared-GPU load. Compilation uses two CPU workers. Any numerical or performance difference is recorded before considering a separate training experiment. No outcome yet. + +## E58/E66 recovered37M control at global12000 +- Checkpoint SHA-256: `5341c5600f5fd3f82a33a9a756ce30ee980973e90c0163455ea2ce545601b051`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.337642669677734 seconds. +- Overall skill 0.374083; relative MASE 0.747749; relative WQL 0.523935. +- term skill: long=0.3989, medium=0.4070, short=0.3511. +- domain skill: Econ/Fin=0.1395, Energy=0.2360, Healthcare=0.4006, Nature=0.4331, Sales=0.3401, Transport=0.4656, Web/CloudOps=0.4984. +- frequency skill: A=0.3744, D=0.3455, H=0.3952, M=0.0891, Q=0.1999, S=0.4216, T=0.4369, W=0.2041. +- variates skill: multivariate=0.3932, univariate=0.3585. +- Outcome: Skill0.374083, below its own8000 EMA0.374665 and initial parent0.375793. First4000 updates after the documented optimizer reset; await the matched146M result. Training losses over shared steps9550..10500 are nearly equal: large0.345200, control0.345264. + +## E67 full_paired_control at3000 +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.129313945770264 seconds. +- Overall skill 0.378018; relative MASE 0.743740; relative WQL 0.520156. +- term skill: long=0.4008, medium=0.4068, short=0.3576. +- domain skill: Econ/Fin=0.1354, Energy=0.2381, Healthcare=0.4531, Nature=0.4314, Sales=0.3329, Transport=0.4660, Web/CloudOps=0.5026. +- frequency skill: A=0.3720, D=0.3538, H=0.3970, M=0.1035, Q=0.1971, S=0.4224, T=0.4379, W=0.2235. +- variates skill: multivariate=0.3959, univariate=0.3634. +- Outcome: Both exceed the E62 main screen0.377343. Paired0.378318 leads control0.378018; check both earlier cutoffs before selection. Training continues toward6000. + +## E67 full_paired_candidate at3000 +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.954200506210327 seconds. +- Overall skill 0.378318; relative MASE 0.743356; relative WQL 0.519924. +- term skill: long=0.4020, medium=0.4066, short=0.3577. +- domain skill: Econ/Fin=0.1339, Energy=0.2391, Healthcare=0.4511, Nature=0.4303, Sales=0.3325, Transport=0.4661, Web/CloudOps=0.5042. +- frequency skill: A=0.3674, D=0.3531, H=0.3978, M=0.1030, Q=0.1972, S=0.4232, T=0.4383, W=0.2236. +- variates skill: multivariate=0.3969, univariate=0.3631. +- Outcome: Both exceed the E62 main screen0.377343. Paired0.378318 leads control0.378018; check both earlier cutoffs before selection. Training continues toward6000. + +## E67 full_paired_control_ema3000 evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.129313945770264 seconds. +- Overall skill 0.378018; relative MASE 0.743740; relative WQL 0.520156. +- term skill: long=0.4008, medium=0.4068, short=0.3576. +- domain skill: Econ/Fin=0.1354, Energy=0.2381, Healthcare=0.4531, Nature=0.4314, Sales=0.3329, Transport=0.4660, Web/CloudOps=0.5026. +- frequency skill: A=0.3720, D=0.3538, H=0.3970, M=0.1035, Q=0.1971, S=0.4224, T=0.4379, W=0.2235. +- variates skill: multivariate=0.3959, univariate=0.3634. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_control_ema3000 backcast_evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.22196912765503 seconds. +- Overall skill 0.336172; relative MASE 0.797227; relative WQL 0.552750. +- term skill: long=0.3984, medium=0.3579, short=0.3019. +- domain skill: Econ/Fin=0.1591, Energy=0.2292, Healthcare=0.4105, Nature=0.3647, Sales=0.3944, Transport=0.3718, Web/CloudOps=0.4497. +- frequency skill: A=0.3173, D=0.3530, H=0.3656, M=0.1894, Q=0.2304, S=0.3411, T=0.3359, W=0.2800. +- variates skill: multivariate=0.3535, univariate=0.3220. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_control_ema3000 backcast2_evals +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.114278316497803 seconds. +- Overall skill 0.357963; relative MASE 0.772252; relative WQL 0.533779. +- term skill: long=0.3643, medium=0.3867, short=0.3442. +- domain skill: Econ/Fin=0.1073, Energy=0.2363, Healthcare=0.3529, Nature=0.4659, Sales=0.5494, Transport=0.4196, Web/CloudOps=0.4322. +- frequency skill: A=0.3515, D=0.4255, H=0.3911, M=0.1494, Q=0.1504, S=0.2817, T=0.3589, W=0.2528. +- variates skill: multivariate=0.3643, univariate=0.3528. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.954200506210327 seconds. +- Overall skill 0.378318; relative MASE 0.743356; relative WQL 0.519924. +- term skill: long=0.4020, medium=0.4066, short=0.3577. +- domain skill: Econ/Fin=0.1339, Energy=0.2391, Healthcare=0.4511, Nature=0.4303, Sales=0.3325, Transport=0.4661, Web/CloudOps=0.5042. +- frequency skill: A=0.3674, D=0.3531, H=0.3978, M=0.1030, Q=0.1972, S=0.4232, T=0.4383, W=0.2236. +- variates skill: multivariate=0.3969, univariate=0.3631. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 backcast_evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.824409246444702 seconds. +- Overall skill 0.335739; relative MASE 0.797824; relative WQL 0.553058. +- term skill: long=0.3982, medium=0.3579, short=0.3012. +- domain skill: Econ/Fin=0.1554, Energy=0.2283, Healthcare=0.4138, Nature=0.3640, Sales=0.3938, Transport=0.3730, Web/CloudOps=0.4488. +- frequency skill: A=0.3126, D=0.3515, H=0.3664, M=0.1838, Q=0.2305, S=0.3411, T=0.3345, W=0.2832. +- variates skill: multivariate=0.3522, univariate=0.3223. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## E67 full_paired_candidate_ema3000 backcast2_evals +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.085822582244873 seconds. +- Overall skill 0.358235; relative MASE 0.771602; relative WQL 0.533775. +- term skill: long=0.3637, medium=0.3876, short=0.3445. +- domain skill: Econ/Fin=0.1066, Energy=0.2361, Healthcare=0.3468, Nature=0.4694, Sales=0.5483, Transport=0.4212, Web/CloudOps=0.4313. +- frequency skill: A=0.3537, D=0.4237, H=0.3911, M=0.1509, Q=0.1498, S=0.2809, T=0.3593, W=0.2593. +- variates skill: multivariate=0.3635, univariate=0.3540. +- Outcome: Matched whole-model sign-loss comparison; all parameters train, seed 197. Main screen improves; earlier cutoffs are mixed. Complete package validation follows. + +## long_memory_synth_recovery_ema3000 +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.661465406417847 seconds. +- Overall skill 0.360588; relative MASE 0.761649; relative WQL 0.536793. +- term skill: long=0.3910, medium=0.4017, short=0.3318. +- domain skill: Econ/Fin=0.1155, Energy=0.1829, Healthcare=0.4341, Nature=0.4242, Sales=0.3463, Transport=0.4592, Web/CloudOps=0.5066. +- frequency skill: A=0.3750, D=0.3500, H=0.3816, M=0.1111, Q=0.2000, S=0.4415, T=0.4013, W=0.2067. +- variates skill: multivariate=0.3919, univariate=0.3345. +- Outcome: E61 slower synthetic AR dynamics; seed79; improves main screen over matched E42 at3000 steps. Continue and check earlier cutoffs. + +## recent_normalization_recovery_ema3000 +- Checkpoint SHA-256: `a55a5681f52782a142f44595f69d5aef59579fa7f64124c72b9de918189d8ff9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.14950752258301 seconds. +- Overall skill 0.373434; relative MASE 0.747021; relative WQL 0.525533. +- term skill: long=0.3987, medium=0.4024, short=0.3519. +- domain skill: Econ/Fin=0.1428, Energy=0.2320, Healthcare=0.4255, Nature=0.4235, Sales=0.3398, Transport=0.4701, Web/CloudOps=0.4974. +- frequency skill: A=0.3847, D=0.3515, H=0.3961, M=0.0795, Q=0.2007, S=0.4234, T=0.4320, W=0.2036. +- variates skill: multivariate=0.3889, univariate=0.3609. +- Outcome: E65 recent4096 normalization with8192 context; seed101; improves matched E54 3000-step long-context result .372681. Continue. + +### E70 compiler cache infrastructure diagnostic +Both the default and /tmp Triton caches reject child-directory-to-parent os.replace with EXDEV. Same-parent replacement succeeds. A local SiblingFileCacheManager preserves Triton keys and group formats while writing unique same-parent temporary files. Byte, text, overwrite and group fixtures passed (initial fixture used an invalid nonhex key; corrected before accepting the fixture). No installed library files, model parameters, optimizer state or inference runtime were changed. Retrying the identical training-only compile benchmark; no optimizer updates. + +### E70 fixed-shape compiler benchmark outcome +Seed223, B64, C2048, H512, own E62 checkpoint 22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c; no optimizer updates and only allowed training windows. Compilation 51.065s; total benchmark 80.009s. Alternating three blocks: eager mean0.119890s versus compiled mean0.064745s, speedup1.852. Loss0.228576794 vs0.228607744; gradient cosine0.998925465, maximum absolute gradient difference0.000610351562. bf16 arithmetic differs slightly; this is not bitwise training equivalence. Other experiments shared the H100. Variable-shape compatibility is being checked before use in training; published inference is unchanged. + +## E71 finer eight-point patches — prepared, not launched +Hypothesis: E17 benefited from32→16-point patches, and the current model still has short-horizon energy errors. Test16→8-point patches while preserving physical position units and all attention/MLP/confidence parameters. Fold the two halves of context, query and recency input projections by summation and keep the first8 output rows, as in the earlier resolution experiment. This is an own-weight initialization, not an exact function-preserving conversion. Initialize from E62, use seed197/B64/LR2e-5/12000 steps with paired sign loss, and compare to the already-running E67 paired16-point arm. Keep the identical sampler and its16-point random-prefix rounding; only model patch resolution changes. CPU fixtures and initial evaluation precede training. No additional data or synthetic generator. Waiting for training memory to become available. + +E70 variable-shape follow-up: torch.compile(dynamic=True, fullgraph=True) failed in the installed PyTorch tensorification pass: TensorReferenceAnalysis lacks python_mod. No optimizer updates occurred. Test static shape specialization with a64-graph cache limit instead, preserving the existing16 context/horizon combinations. Dynamic failure log: compiler_variable_shapes.log. + +## E72 convex mixtures of training windows — prepared, not launched +Hypothesis: interpolating real dynamics can expand effective corpus diversity and regularize the forecast mapping beyond drawing additional series. On25% of sampled rows, choose a different row with the same two periods, normalize the donor using context-only mean/std into the primary context units, then combine context and future separately with a Beta(2,2) coefficient. Missing positions use mask intersection; require8 common observed context points and1 common future label. Both real and existing locally synthetic rows are eligible. Independent seed600200 preserves the main corpus/generator stream and requested-horizon stream. Planned own E62 initialization, seed197, paired loss, B64, LR2e-5,12000 steps, identical E67 paired control settings. No inference changes. Fixtures: {"cpu_seconds": 2.7141120220185257, "seed": 197, "mixture_seed": 600200, "rows": 192, "changed_context_rows": 43, "main_and_horizon_rng_matched": true, "changing_labels_does_not_change_contexts": true, "finite_masks_respected": true, "optimizer_updates": 0}. Await training allocation. + +### E58 symmetry diagnostic +Seed239, four allowed training windows, no optimizer updates, CPU5.262225491984282s. At global12000, duplicate-stream encoder5 activations differ by only0.001181 relative RMS, versus0.001124 at initialization. Sampled duplicate-row matrix cosines remain0.99987–0.99997. The nearly redundant streams weaken the interpretation that this experiment tested useful extra capacity. Full measurements: wide_capacity_symmetry_diagnostic.json. No current weights changed. + +## E73 independently initialized extra feature stream — prepared, not launched +Hypothesis: widening by near-identical copies keeps the extra neurons redundant. Build a146,477,344-parameter model with the original512 features and a separate randomly initialized512-feature stream. Inherited linear maps occupy their original blocks; new internal maps are independently random; cross-stream maps and new output-head columns start at zero. Layer normalization operates on each512-feature group separately so the parent function survives initialization. All maps, including cross-stream connections, will train. This changes initialization and normalization grouping relative to E58. Conversion seed241; own E47 parent. Same training seed113, B96, LR3e-5,32000-step schedule and optimizer/sampler reset at8000 with seed179 as the completed/recovered small control. Use unit LR multipliers because original columns are no longer duplicated or divided. No new data or generator. Conversion fixture: {"method": "independent random feature stream with block-diagonal inherited projections, zero cross-stream projections and zero new output columns; separate512-feature layer normalization", "parent_sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", "random_initialization_seed": 241, "fixture_max_abs_difference": 1.6689300537109375e-06, "new_stream_activation": {"relative_rms_difference": 1.4169212579727173}, "learning_rate_multipliers": "one for every parameter", "checkpoint_sha256": "d164d8b12223032b23948d0dcb17389d10f8e739a30a1ade5f677d2a948e965b", "parameters": 146477344, "cpu_seconds": 2.802320774004329, "optimizer_updates": 0}. Initial screen and gradient checks precede training. + +### E70 static shape specialization outcome +All four tested context/horizon shapes compiled and produced finite gradients; returning to2048/512 reused graph1, with four unique graphs total. Loss differences remained below0.00007. First calls took47.33,38.52,51.27,46.47 seconds; steady forward/backward speedups ranged1.60–1.94 under shared load. Complete result compiler_static_shapes_result.json, elapsed208.31172983598663s. Static specialization is usable, but16 training shapes incur compilation cost and bf16 arithmetic changes; existing active training runs remain eager. + +## E58/E66 recovered146M at global12000 +- Checkpoint SHA-256: `3d39cb54e80093bf97c2d95eda6bd30fefa65ec47b33ba70838dc881321e31ea`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.74531269073486 seconds. +- Overall skill 0.373963; relative MASE 0.747878; relative WQL 0.524045. +- term skill: long=0.3982, medium=0.4082, short=0.3507. +- domain skill: Econ/Fin=0.1409, Energy=0.2357, Healthcare=0.3980, Nature=0.4325, Sales=0.3406, Transport=0.4658, Web/CloudOps=0.4987. +- frequency skill: A=0.3756, D=0.3419, H=0.3949, M=0.0902, Q=0.1997, S=0.4220, T=0.4377, W=0.2068. +- variates skill: multivariate=0.3930, univariate=0.3584. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E63 expanded corpus at146M first4000 +- Checkpoint SHA-256: `c89939a906b619e3d119a26d2edf1b567ff902930ca78b3e58cdce5903ed3077`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.43943977355957 seconds. +- Overall skill 0.373186; relative MASE 0.749492; relative WQL 0.524216. +- term skill: long=0.3994, medium=0.4061, short=0.3496. +- domain skill: Econ/Fin=0.1406, Energy=0.2371, Healthcare=0.4020, Nature=0.4224, Sales=0.3395, Transport=0.4650, Web/CloudOps=0.5007. +- frequency skill: A=0.3699, D=0.3383, H=0.3939, M=0.1020, Q=0.2066, S=0.4209, T=0.4379, W=0.2018. +- variates skill: multivariate=0.3928, univariate=0.3571. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E61 slow AR3000 first earlier cutoff +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.004189491271973 seconds. +- Overall skill 0.329626; relative MASE 0.805342; relative WQL 0.558025. +- term skill: long=0.3886, medium=0.3565, short=0.2947. +- domain skill: Econ/Fin=0.1530, Energy=0.2229, Healthcare=0.4151, Nature=0.3515, Sales=0.3980, Transport=0.3624, Web/CloudOps=0.4448. +- frequency skill: A=0.3216, D=0.3548, H=0.3555, M=0.1730, Q=0.2272, S=0.3450, T=0.3293, W=0.2673. +- variates skill: multivariate=0.3459, univariate=0.3164. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E61 slow AR3000 second earlier cutoff +- Checkpoint SHA-256: `c8d675cce3857f6c065a231ccbd4f2dfb76c6c49236da051d13b450287006a6f`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.961536407470703 seconds. +- Overall skill 0.353271; relative MASE 0.774762; relative WQL 0.539854. +- term skill: long=0.3691, medium=0.3752, short=0.3388. +- domain skill: Econ/Fin=0.0921, Energy=0.2250, Healthcare=0.3726, Nature=0.4619, Sales=0.5589, Transport=0.4127, Web/CloudOps=0.4305. +- frequency skill: A=0.3401, D=0.4317, H=0.3862, M=0.1746, Q=0.1512, S=0.2822, T=0.3452, W=0.2437. +- variates skill: multivariate=0.3595, univariate=0.3482. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E67 paired3000 third earlier cutoff +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 26.884973287582397 seconds. +- Overall skill 0.389069; relative MASE 0.736752; relative WQL 0.506597. +- term skill: long=0.3965, medium=0.3605, short=0.3968. +- domain skill: Econ/Fin=0.1707, Energy=0.3208, Healthcare=0.2592, Nature=0.5054, Sales=0.3991, Transport=0.5053, Web/CloudOps=0.3895. +- frequency skill: A=0.3624, D=0.4436, H=0.4039, M=0.1198, Q=0.2578, S=0.2862, T=0.4305, W=0.2611. +- variates skill: multivariate=0.3741, univariate=0.4006. +- Outcome: Diagnostic checkpoint; training continues. See experiment hypothesis and matched controls above. + +## E67 candidate3000 complete package validation +- Checkpoint SHA-256: `2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374401; relative MASE 0.746075; relative WQL 0.524578. +- term skill: long=0.3961, medium=0.4055, short=0.3534. +- domain skill: Econ/Fin=0.1115, Energy=0.2320, Healthcare=0.4573, Nature=0.4303, Sales=0.3470, Transport=0.4663, Web/CloudOps=0.4964. +- frequency skill: A=0.2888, D=0.3569, H=0.3930, M=0.1278, Q=0.1823, S=0.4232, T=0.4312, W=0.2160. +- variates skill: multivariate=0.3926, univariate=0.3596. +- Outcome: Full public-package validation. Training seed197, B64 distinct windows with both signs, LR2e-5;3000-step checkpoint at687.5s of training-loop elapsed time on the shared single H100. Exact public inference 129.863s. Paired candidate wins full validation and main screen; it improves earlier cutoffs2/3 versus E62, but loses0.000488 on cutoff1. Control full skill0.374180 versus paired0.374401. Select paired3000 with this temporal tradeoff recorded; training continues. + +## E67 control3000 complete package validation +- Checkpoint SHA-256: `c98f8d82047e6e0ecd00f144307623afdd581ee6624d880063f810d090e1a473`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374180; relative MASE 0.746358; relative WQL 0.524749. +- term skill: long=0.3948, medium=0.4057, short=0.3535. +- domain skill: Econ/Fin=0.1134, Energy=0.2311, Healthcare=0.4600, Nature=0.4313, Sales=0.3473, Transport=0.4663, Web/CloudOps=0.4949. +- frequency skill: A=0.2923, D=0.3579, H=0.3922, M=0.1281, Q=0.1825, S=0.4224, T=0.4308, W=0.2163. +- variates skill: multivariate=0.3915, univariate=0.3600. +- Outcome: Full public-package validation. Training seed197, B64 distinct windows with both signs, LR2e-5;3000-step checkpoint at687.5s of training-loop elapsed time on the shared single H100. Exact public inference 131.546s. Paired candidate wins full validation and main screen; it improves earlier cutoffs2/3 versus E62, but loses0.000488 on cutoff1. Control full skill0.374180 versus paired0.374401. Select paired3000 with this temporal tradeoff recorded; training continues. + +E67 publication decision: paired3000 checkpoint2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238, full0.3744010291; main0.3783180328; earlier cutoffs0.3357387876/0.3582353306/0.3890690875. Relative to published E62, full gain0.000981171, main gain0.000974817, earlier changes-0.000488248/+0.000541947/+0.001280498. All97 full configurations and151170 instances pass with no quantile crossings. Three example configurations are bitwise equal after independent relocation; runtime/weight hashes verified. The published inference remains eager. + +## E74 equal ensemble of E62 and its paired3000 continuation +Hypothesis: fixed forecast averaging can retain the parent's stronger first earlier cutoff while preserving gains from paired-sign training. Test exactly one equal-weight quantile mean after each model's existing fixed rules, without a weight sweep or additional zero projection. Both models would forecast every instance. Reuse cached predictions for screening; no training, new seed or source. Evaluate main and all three earlier cutoffs, then full validation only if promising; an actual packaged replay remains required before publication. Members: E62 hash22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, E67 hash2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238. + +## full_paired_control_ema6000 +- Checkpoint SHA-256: `4517cc18d0d7b022c728a208b53bb0088fcefe249246640d26e688ba800cf84c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.108938932418823 seconds. +- Overall skill 0.377544; relative MASE 0.744699; relative WQL 0.520279. +- term skill: long=0.3999, medium=0.4077, short=0.3567. +- domain skill: Econ/Fin=0.1294, Energy=0.2391, Healthcare=0.4588, Nature=0.4300, Sales=0.3396, Transport=0.4652, Web/CloudOps=0.4999. +- frequency skill: A=0.3728, D=0.3542, H=0.3955, M=0.1113, Q=0.1942, S=0.4228, T=0.4360, W=0.2279. +- variates skill: multivariate=0.3946, univariate=0.3636. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +## full_paired_candidate_ema6000 +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.94004225730896 seconds. +- Overall skill 0.378455; relative MASE 0.743557; relative WQL 0.519554. +- term skill: long=0.4019, medium=0.4071, short=0.3578. +- domain skill: Econ/Fin=0.1262, Energy=0.2397, Healthcare=0.4622, Nature=0.4291, Sales=0.3379, Transport=0.4657, Web/CloudOps=0.5030. +- frequency skill: A=0.3687, D=0.3544, H=0.3962, M=0.1031, Q=0.1932, S=0.4249, T=0.4385, W=0.2281. +- variates skill: multivariate=0.3972, univariate=0.3631. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +## wide_graft_initial +- Checkpoint SHA-256: `d164d8b12223032b23948d0dcb17389d10f8e739a30a1ade5f677d2a948e965b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 44.365342140197754 seconds. +- Overall skill 0.375793; relative MASE 0.745650; relative WQL 0.522544. +- term skill: long=0.3998, medium=0.4067, short=0.3540. +- domain skill: Econ/Fin=0.1396, Energy=0.2348, Healthcare=0.4405, Nature=0.4284, Sales=0.3399, Transport=0.4658, Web/CloudOps=0.5006. +- frequency skill: A=0.3762, D=0.3542, H=0.3951, M=0.0953, Q=0.1981, S=0.4239, T=0.4362, W=0.2089. +- variates skill: multivariate=0.3938, univariate=0.3611. +- Outcome: Paired6000 main improves to0.378455; matched control0.377544. Graft initialization reproduces parent0.375793 within numerical precision. Earlier paired diagnostics and future training determine selection. + +E74 valid_screen: skill0.37807862274263027, relativeMASE0.7436448167242383, relativeWQL0.5201222287724669, CPU0.8619319740100764s; group skills {"term": {"short": 0.35759494914169054, "medium": 0.40699311016073325, "long": 0.40082709768107416}, "domain": {"Econ/Fin": 0.1373283443599086, "Energy": 0.23867787085456083, "Healthcare": 0.4514094815443358, "Nature": 0.4314394439880541, "Sales": 0.3334613777872122, "Transport": 0.46623492569656166, "Web/CloudOps": 0.5020547204722161}, "freq": {"A-DEC": 0.3700186215632586, "Q-DEC": 0.1986150873665018, "M": 0.10412662722790622, "W-SUN": 0.07901894069086524, "D": 0.35481222927845457, "H": 0.39699199743484126, "15T": 0.21413878856050306, "W-FRI": -0.0023901912492456656, "10T": 0.615926427622083, "W-TUE": 0.5812846025030445, "W-THU": 0.20706119312963223, "W-WED": 0.31744777723871154, "5T": 0.5126119145163621, "10S": 0.4229238092063159}}. + +E74 valid_backcast: skill0.3362925418425802, relativeMASE0.7972981372266922, relativeWQL0.552500463058947, CPU0.8971402349998243s; group skills {"term": {"short": 0.30190782919949666, "medium": 0.35857372233263296, "long": 0.3983345998796374}, "domain": {"Econ/Fin": 0.15970397473963605, "Energy": 0.22932627079926182, "Healthcare": 0.40921062898616656, "Nature": 0.3642338798926953, "Sales": 0.395796512384459, "Transport": 0.3726773780449273, "Web/CloudOps": 0.4497268240013762}, "freq": {"A-DEC": 0.31984516176318767, "Q-DEC": 0.23213469399614717, "M": 0.1867528733976035, "W-SUN": 0.027286458584816375, "D": 0.35084294376677716, "H": 0.36615049422003554, "15T": 0.22473053922570885, "W-FRI": 0.2587886969661052, "10T": 0.3198607928100037, "W-TUE": 0.5430562436146349, "W-THU": 0.24609593870252322, "W-WED": 0.3423884364810911, "5T": 0.4378462658914031, "10S": 0.34158786712809996}}. + +E74 valid_backcast2: skill0.3582180334801286, relativeMASE0.771690389912856, relativeWQL0.5337426744378997, CPU0.6840074959909543s; group skills {"term": {"short": 0.3444537095616398, "medium": 0.3869421164002306, "long": 0.36441392284164364}, "domain": {"Econ/Fin": 0.10841961881158191, "Energy": 0.2363021419988357, "Healthcare": 0.34644304914503876, "Nature": 0.4685938042819019, "Sales": 0.5492137665291525, "Transport": 0.4207857629370483, "Web/CloudOps": 0.4314575495135424}, "freq": {"A-DEC": 0.3538974701075839, "Q-DEC": 0.1504553008739551, "M": 0.15220470977886436, "W-SUN": 0.04613015348540839, "D": 0.42446352745465865, "H": 0.39096253798739566, "15T": 0.10670219795421398, "W-FRI": 0.14873972396574198, "10T": 0.4961638002828159, "W-TUE": 0.08195477095370607, "W-THU": 0.32491052813791066, "W-WED": 0.5372312006064026, "5T": 0.46600691242017644, "10S": 0.28101678592852175}}. + +E74 valid_backcast3: skill0.38866584889169165, relativeMASE0.7372042201081582, relativeWQL0.506955107034635, CPU0.6765452020335943s; group skills {"term": {"short": 0.39634584808261863, "medium": 0.36050403977747736, "long": 0.39564160116149116}, "domain": {"Econ/Fin": 0.17218827750208232, "Energy": 0.32018031275863146, "Healthcare": 0.251739940360198, "Nature": 0.505730039991936, "Sales": 0.3992528233665873, "Transport": 0.5057485203797758, "Web/CloudOps": 0.38900692766706535}, "freq": {"A-DEC": 0.35992280976221613, "Q-DEC": 0.2607290890980446, "M": 0.1158596568834448, "W-SUN": 0.14646809588021303, "D": 0.4430503070010823, "H": 0.40373923909167875, "15T": 0.26167249262649306, "W-FRI": 0.026229112650416053, "10T": 0.6033044583572338, "W-TUE": 0.2614261172432897, "W-THU": 0.3805020665242401, "W-WED": 0.37420834670061953, "5T": 0.4617999415682724, "10S": 0.28494980458180186}}. + +E74 fixed ensemble recovers cutoff1 but is below the paired member on main and cutoffs2/3. Check cached full validation before deciding; no mixture coefficient tuning. + +E73 gradient fixture: {"cpu_seconds": 3.0038612950011156, "seed": 251, "allowed_training_windows": 2, "loss": 0.6392828226089478, "initial_gradients": {"head_new_columns": 1.3039275407791138, "encoder0_new_to_old_attention": 0.16236796975135803, "decoder3_new_to_old_ff": 0.3286978602409363}, "all_gradients_finite": true, "optimizer_updates": 0}. All gradients finite, with nonzero gradient to new output columns and new-to-old attention/feedforward maps at initialization. + +## E67 paired6000 backcast_evals +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 27.112698793411255 seconds. +- Overall skill 0.335119; relative MASE 0.798971; relative WQL 0.553296. +- term skill: long=0.3996, medium=0.3567, short=0.2999. +- domain skill: Econ/Fin=0.1484, Energy=0.2276, Healthcare=0.4122, Nature=0.3651, Sales=0.3962, Transport=0.3724, Web/CloudOps=0.4480. +- frequency skill: A=0.3127, D=0.3525, H=0.3668, M=0.1712, Q=0.2359, S=0.3414, T=0.3328, W=0.2844. +- variates skill: multivariate=0.3517, univariate=0.3216. +- Outcome: Compared with paired3000, cutoff1 loses0.000620 and cutoff2 gains0.001211. Main gains0.000137. Complete package validation and third earlier cutoff follow; keep paired3000 published meanwhile. + +## E67 paired6000 backcast2_evals +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.65610408782959 seconds. +- Overall skill 0.359446; relative MASE 0.769629; relative WQL 0.533126. +- term skill: long=0.3637, medium=0.3914, short=0.3451. +- domain skill: Econ/Fin=0.0947, Energy=0.2369, Healthcare=0.3640, Nature=0.4722, Sales=0.5483, Transport=0.4203, Web/CloudOps=0.4322. +- frequency skill: A=0.3460, D=0.4239, H=0.3913, M=0.1623, Q=0.1478, S=0.2801, T=0.3609, W=0.2646. +- variates skill: multivariate=0.3635, univariate=0.3561. +- Outcome: Compared with paired3000, cutoff1 loses0.000620 and cutoff2 gains0.001211. Main gains0.000137. Complete package validation and third earlier cutoff follow; keep paired3000 published meanwhile. + +E74 cached full validation: skill0.37416157579966614, relativeMASE0.7463637996830615, relativeWQL0.5247758979895311, CPU1.7625104649923742s; group skills {"term": {"short": 0.35339006443372445, "medium": 0.4058776358425863, "long": 0.39478447597143573}, "domain": {"Econ/Fin": 0.1148260686606345, "Energy": 0.2315840307823489, "Healthcare": 0.45764579718017184, "Nature": 0.4314211475708052, "Sales": 0.3476654519885174, "Transport": 0.46645466438647154, "Web/CloudOps": 0.49435858431787905}, "freq": {"A-DEC": 0.2905258409636121, "Q-DEC": 0.18415390225031736, "M": 0.12808227393650784, "W-SUN": 0.042170378733840996, "D": 0.3587361531705563, "H": 0.39218267210684865, "15T": 0.20355479619501637, "W-FRI": -0.021429381368383904, "10T": 0.615926427622083, "W-TUE": 0.5812846025030445, "W-THU": 0.20706119312963223, "W-WED": 0.31744777723871154, "5T": 0.5037733014006005, "10S": 0.4229238092063159}}. Below paired3000 skill0.374401 by0.000239. Reject: the first earlier-cutoff benefit does not outweigh lower full/main/other-earlier scores. No ensemble package is published and no weight sweep follows. + +E71 initial8-point model main screen0.3622169411 versus E62 parent0.3773432163; conversion intentionally changes function. CPU fixture0.9008s verifies constant-input projection folding, unchanged inherited tensors, finite/ordered forecasts at6/18/720/900 steps. Training recovery must justify this initialization cost. + +E58/E63 resource decision fixed before the next results: at global16000, stop the near-duplicate width trial if it remains below both its E47 parent and the matched small control; preserve a complete recovery checkpoint. At8000, assess expanded-corpus146M against its same-width original-corpus8000. Prioritize the independent-stream E73 initialization when a large training slot is released. Existing runs retain eager arithmetic. + +## E67 paired6000 exact full package +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.374279; relative MASE 0.746472; relative WQL 0.524502. +- term skill: long=0.3958, medium=0.4059, short=0.3532. +- domain skill: Econ/Fin=0.1029, Energy=0.2327, Healthcare=0.4651, Nature=0.4291, Sales=0.3514, Transport=0.4660, Web/CloudOps=0.4952. +- frequency skill: A=0.2886, D=0.3570, H=0.3913, M=0.1264, Q=0.1824, S=0.4249, T=0.4314, W=0.2203. +- variates skill: multivariate=0.3928, univariate=0.3591. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +## E67 paired6000 third earlier cutoff +- Checkpoint SHA-256: `b797a18346b75d6cc1f541b56f880cd43055890f86b872bb37425b1c92609e71`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.89822793006897 seconds. +- Overall skill 0.389533; relative MASE 0.736193; relative WQL 0.506212. +- term skill: long=0.3966, medium=0.3607, short=0.3974. +- domain skill: Econ/Fin=0.1634, Energy=0.3178, Healthcare=0.2808, Nature=0.5081, Sales=0.3977, Transport=0.5055, Web/CloudOps=0.3908. +- frequency skill: A=0.3558, D=0.4451, H=0.4045, M=0.1415, Q=0.2554, S=0.2895, T=0.4276, W=0.2643. +- variates skill: multivariate=0.3722, univariate=0.4028. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +## E65 recent normalization6000 +- Checkpoint SHA-256: `1c5bc9b814879a43941f6e59b6d2024152ec9db43014e2b4431195e52366f1ea`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.534422874450684 seconds. +- Overall skill 0.374709; relative MASE 0.745557; relative WQL 0.524426. +- term skill: long=0.4014, medium=0.4044, short=0.3523. +- domain skill: Econ/Fin=0.1384, Energy=0.2354, Healthcare=0.4238, Nature=0.4264, Sales=0.3389, Transport=0.4711, Web/CloudOps=0.4974. +- frequency skill: A=0.3756, D=0.3531, H=0.3970, M=0.0716, Q=0.2013, S=0.4239, T=0.4343, W=0.2078. +- variates skill: multivariate=0.3915, univariate=0.3610. +- Outcome: Paired6000 full0.374279 is below published3000 full0.374401 despite main/earlier2/earlier3 gains; retain3000 while training continues. Recent normalization6000 improves matched long-context baseline0.373979 and slightly exceeds4096 control0.374515; continue to12000. + +E67 paired6000 full public inference131.433437s on the shared single H100; all97 configurations and151170 instances passed. The original3k publication remains selected by full validation, with the temporal tradeoff documented. + +## E75 training loss after fixed inference transformations — prepared, not launched +Hypothesis: paired training aligns sign averaging but still scores raw neural forecasts, whereas inference changes them with seasonal and continuity priors and exact-zero projection. Compute the same fixed context statistics without model gradients, then apply the transforms differentiably to forecasts before the existing normalized median/quantile loss. Gradients include the continuity correction's dependence on the first forecast; zero/positivity thresholds remain fixed and piecewise differentiable. The target transform and seasonal loss weight stay unchanged. Planned E62 initialization, seed197, paired loss, B64, LR2e-5,12000 steps, identical data stream to E67 paired. No new data/generator and no inference changes. CPU implementation comparison: {"cpu_seconds": 0.11522011604392901, "seed": 263, "fixtures": [{"context": 8, "horizon": 6, "maximum_absolute_difference": 0.0, "finite_gradients": true}, {"context": 64, "horizon": 18, "maximum_absolute_difference": 2.384185791015625e-07, "finite_gradients": true}, {"context": 512, "horizon": 128, "maximum_absolute_difference": 1.1920928955078125e-06, "finite_gradients": true}, {"context": 4096, "horizon": 900, "maximum_absolute_difference": 7.152557373046875e-07, "finite_gradients": true}], "optimizer_updates": 0}. Fixture agreement is numerical, not bitwise, because training computes context statistics in float64. Await a training slot and one allowed-window end-to-end gradient check. + +## E61 slow AR6000 evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.034730434417725 seconds. +- Overall skill 0.361281; relative MASE 0.760333; relative WQL 0.536557. +- term skill: long=0.3915, medium=0.4029, short=0.3324. +- domain skill: Econ/Fin=0.1215, Energy=0.1845, Healthcare=0.4313, Nature=0.4272, Sales=0.3429, Transport=0.4577, Web/CloudOps=0.5068. +- frequency skill: A=0.3788, D=0.3481, H=0.3812, M=0.1116, Q=0.2006, S=0.4421, T=0.4034, W=0.2113. +- variates skill: multivariate=0.3930, univariate=0.3349. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +## E61 slow AR6000 backcast_evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.68802785873413 seconds. +- Overall skill 0.331040; relative MASE 0.803953; relative WQL 0.556635. +- term skill: long=0.3886, medium=0.3569, short=0.2972. +- domain skill: Econ/Fin=0.1588, Energy=0.2277, Healthcare=0.4061, Nature=0.3526, Sales=0.3967, Transport=0.3629, Web/CloudOps=0.4452. +- frequency skill: A=0.3244, D=0.3518, H=0.3577, M=0.1682, Q=0.2306, S=0.3442, T=0.3314, W=0.2762. +- variates skill: multivariate=0.3484, univariate=0.3169. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +## E61 slow AR6000 backcast2_evals +- Checkpoint SHA-256: `fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.468894004821777 seconds. +- Overall skill 0.354097; relative MASE 0.774005; relative WQL 0.539002. +- term skill: long=0.3704, medium=0.3752, short=0.3398. +- domain skill: Econ/Fin=0.0990, Energy=0.2275, Healthcare=0.3686, Nature=0.4617, Sales=0.5571, Transport=0.4131, Web/CloudOps=0.4308. +- frequency skill: A=0.3441, D=0.4303, H=0.3862, M=0.1683, Q=0.1512, S=0.2846, T=0.3470, W=0.2514. +- variates skill: multivariate=0.3602, univariate=0.3491. +- Outcome: Main skill0.361281 exceeds matched partial-target0.359222. Compare both earlier windows with E42; continue to12000. + +E73 compiler fixture: {"seed": 271, "batch": 16, "context": 512, "horizon": 128, "eager_loss": 0.2625328004360199, "compiled_loss": 0.26252102851867676, "gradient_cosine": 0.9994836559992685, "maximum_gradient_difference": 0.003173828125, "compile_and_gradient_comparison_seconds": 65.4888255270198, "total_seconds": 66.77216628700262, "optimizer_updates": 0, "source": "allowed packed_sample and own generator"}. Static compilation is numerically close, not bitwise; use it for the32k-step independent-stream trial to amortize the16 shape compilations. This implementation difference from the existing eager small control is explicit. Loss formula, sampler, optimizer and schedule stay fixed. + +E75 allowed-window end-to-end fixture: {"cpu_seconds": 2.641128608956933, "seed": 269, "allowed_training_and_own_synthetic_windows": 8, "loss": 0.2808418869972229, "gradient_norm": 0.18120726943016052, "all_gradients_finite": true, "optimizer_updates": 0}. No optimizer updates. + +E69 is now queued after the slow-AR trainer PID980 exits with ema012000.pt, using its declared eager settings and the same allocation. Queue receipt volatility_synth_queue.json and watcher watch_volatility_synth.log identify the run. No E69 training has started yet. + +E71 maximum-shape GPU fixture: {"seed": 277, "batch": 64, "signed_rows": 128, "context": 4096, "horizon": 1024, "optimizer_updates": 0, "loss": 0.2055814117193222, "seconds": 10.965134899015538, "peak_allocated_mib": 10373.298828125, "peak_reserved_mib": 10992.0}. Passed without optimizer updates. Queue after both E67 trainers finish12000, so its larger working set reuses their combined allocation. + +E75 queued after E65 recent-normalization finishes12000. Both new queues require the predecessor final EMA before starting, and use the declared eager settings. E72 mixup remains prepared only; E73 awaits the prespecified width checkpoint decision. + +## E76 transfer the matched slow-AR6000 correction +E61 improves the main and both earlier cutoffs at6000 versus E42. Hypothesis: this learned synthetic-dynamics correction also helps the selected paired3000 model. Form exactly base(E67 paired3000)+candidate(E61 slowAR6000)-control(E42 partial6000), coefficient1.0 on matching tensors; keep the base confidence projection unchanged. All three checkpoints were trained here on declared sources. No coefficient sweep, new training, data or inference changes. Compare the main and earlier screens before full replay. + +## E76 slow-AR correction evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.135655403137207 seconds. +- Overall skill 0.379721; relative MASE 0.741564; relative WQL 0.518831. +- term skill: long=0.4036, medium=0.4064, short=0.3597. +- domain skill: Econ/Fin=0.1442, Energy=0.2362, Healthcare=0.4597, Nature=0.4330, Sales=0.3350, Transport=0.4655, Web/CloudOps=0.5071. +- frequency skill: A=0.3715, D=0.3604, H=0.3974, M=0.0968, Q=0.1987, S=0.4260, T=0.4397, W=0.2230. +- variates skill: multivariate=0.3981, univariate=0.3647. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +## E76 slow-AR correction backcast_evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 25.913641452789307 seconds. +- Overall skill 0.336781; relative MASE 0.795517; relative WQL 0.552923. +- term skill: long=0.3965, medium=0.3587, short=0.3036. +- domain skill: Econ/Fin=0.1684, Energy=0.2257, Healthcare=0.4092, Nature=0.3689, Sales=0.3927, Transport=0.3721, Web/CloudOps=0.4520. +- frequency skill: A=0.3199, D=0.3498, H=0.3654, M=0.1876, Q=0.2323, S=0.3437, T=0.3374, W=0.2878. +- variates skill: multivariate=0.3539, univariate=0.3228. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +## E76 slow-AR correction backcast2_evals +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.258840799331665 seconds. +- Overall skill 0.360577; relative MASE 0.768980; relative WQL 0.531693. +- term skill: long=0.3677, medium=0.3876, short=0.3472. +- domain skill: Econ/Fin=0.1192, Energy=0.2354, Healthcare=0.3433, Nature=0.4736, Sales=0.5465, Transport=0.4203, Web/CloudOps=0.4380. +- frequency skill: A=0.3515, D=0.4289, H=0.3897, M=0.1383, Q=0.1499, S=0.2861, T=0.3643, W=0.2654. +- variates skill: multivariate=0.3674, univariate=0.3550. +- Outcome: Fixed coefficient1.0 matched own-model correction improves all three screens over paired3000. Full public-package validation and the third earlier cutoff follow before publication. No additional optimization. + +E76 CPU composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/full_paired_candidate/ema003000.pt": "2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238", "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb"}, "seconds": 1.1477709169848822}. + +## E77 slow-AR synthesis during full paired-sign training — prepared, not launched +E61's matched correction transfers favorably to the selected model on three screens. Hypothesis: training the confidence/horizon-aware model directly with the same slow-AR prior can improve on composing an older-backbone correction. Reuse E67's exact E62 initialization, seed197, B64, LR2e-5,12000-step schedule, paired-sign loss and independent horizon RNG300200. Change only synthetic AR phi fromU(.2,.995) toexp(-10**(-U(0,4))), preserving the main RNG calls and zero initial state. This yields time constants log-uniform1..10000 and keeps innovation variance normalized as before. Compare to the already-computed E67 paired control. No inference change, new corpus or validation training. Prioritize after a training allocation is released; E72 mixup remains an unlaunched alternative. + +## E76 slow-AR correction third earlier cutoff +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.890827178955078 seconds. +- Overall skill 0.389281; relative MASE 0.737064; relative WQL 0.506031. +- term skill: long=0.3949, medium=0.3619, short=0.3971. +- domain skill: Econ/Fin=0.1812, Energy=0.3198, Healthcare=0.2311, Nature=0.5053, Sales=0.3996, Transport=0.5073, Web/CloudOps=0.3940. +- frequency skill: A=0.3622, D=0.4457, H=0.4032, M=0.1047, Q=0.2602, S=0.2878, T=0.4313, W=0.2630. +- variates skill: multivariate=0.3743, univariate=0.4008. +- Outcome: Publish E76: full0.375612 improves paired3000 full0.374401; main0.379721 and earlier0.336781/0.360577/0.389281 all improve. All97 configurations and151170 instances pass; zero crossings. Fixed coefficient1.0 composition of own trained checkpoints; no additional training. + +## E76 slow-AR correction full package validation +- Checkpoint SHA-256: `8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.375612; relative MASE 0.744415; relative WQL 0.523713. +- term skill: long=0.3976, medium=0.4054, short=0.3551. +- domain skill: Econ/Fin=0.1204, Energy=0.2291, Healthcare=0.4651, Nature=0.4330, Sales=0.3487, Transport=0.4658, Web/CloudOps=0.4992. +- frequency skill: A=0.2896, D=0.3638, H=0.3924, M=0.1218, Q=0.1820, S=0.4260, T=0.4325, W=0.2151. +- variates skill: multivariate=0.3936, univariate=0.3609. +- Outcome: Publish E76: full0.375612 improves paired3000 full0.374401; main0.379721 and earlier0.336781/0.360577/0.389281 all improve. All97 configurations and151170 instances pass; zero crossings. Fixed coefficient1.0 composition of own trained checkpoints; no additional training. + +E76 published checkpoint SHA2568562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105. Public full inference132.224730s on the shared H100. Relocation fixture15.725434s: three example configurations, bitwise identical, finite and monotone; all runtime/weight hashes verified. The checker initially ran before candidate assembly completed and was restarted after the package existed; the infrastructure error log is retained separately. No inference runtime change. + +E77 sampler fixture: {"seed": 197, "main_and_horizon_rng_matched": true, "real_windows_bitwise_equal": true, "changed_synthetic_context_values": 37211, "cpu_seconds": 4.491440053971019, "optimizer_updates": 0}. Prepared only; no optimizer updates or launch yet. + +## wide_capacity_146m_recovery_ema16000 +- Checkpoint SHA-256: `ad4960e948e64ecf25ec3be4cdc50bae6c7076d15cd7470b028f6ac703bb1081`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.720494747161865 seconds. +- Overall skill 0.375817; relative MASE 0.745785; relative WQL 0.522408. +- term skill: long=0.3987, medium=0.4075, short=0.3541. +- domain skill: Econ/Fin=0.1398, Energy=0.2372, Healthcare=0.4246, Nature=0.4298, Sales=0.3438, Transport=0.4655, Web/CloudOps=0.5003. +- frequency skill: A=0.3787, D=0.3494, H=0.3971, M=0.0940, Q=0.1979, S=0.4232, T=0.4362, W=0.2114. +- variates skill: multivariate=0.3941, univariate=0.3609. +- Outcome: Original-corpus146M at16000 reaches0.375817, above its E47 parent0.375793 and matched small control0.375510: retain the planned continuation. Expanded corpus at8000 scores0.374266 versus original-corpus8000 .374330, an essentially tied result after a worse4000 checkpoint. Stop the expanded branch, preserve full recovery state, and prioritize an initialization that actually diversifies features. This is inconclusive for data scaling, not proof that expanded data is harmful. + +## wide_corpus_expanded_recovery_ema8000 +- Checkpoint SHA-256: `fbab74444b04d805cc04ec612964fcad5e66766d55c3f566a8dc870328ca4493`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.68104600906372 seconds. +- Overall skill 0.374266; relative MASE 0.747150; relative WQL 0.524049. +- term skill: long=0.4008, medium=0.4075, short=0.3504. +- domain skill: Econ/Fin=0.1428, Energy=0.2366, Healthcare=0.4040, Nature=0.4268, Sales=0.3397, Transport=0.4655, Web/CloudOps=0.5014. +- frequency skill: A=0.3790, D=0.3421, H=0.3958, M=0.1065, Q=0.2072, S=0.4225, T=0.4375, W=0.1966. +- variates skill: multivariate=0.3942, univariate=0.3579. +- Outcome: Original-corpus146M at16000 reaches0.375817, above its E47 parent0.375793 and matched small control0.375510: retain the planned continuation. Expanded corpus at8000 scores0.374266 versus original-corpus8000 .374330, an essentially tied result after a worse4000 checkpoint. Stop the expanded branch, preserve full recovery state, and prioritize an initialization that actually diversifies features. This is inconclusive for data scaling, not proof that expanded data is harmful. + +E63 stop requested after8000 evaluation. No validation gain justifies continuing the nearly duplicated-width expanded-data arm while E73 is ready; the complete recovery state will allow later continuation. E73 takes that allocation with seed113/B96/LR3e-5/32000, reset at8000 toseed179, and static compiled loss. Its separate feature-group normalization and independent stream are the research changes; compiler numerical differences were measured explicitly. + +E75 maximum-shape bf16 GPU fixture: {"seed": 281, "batch": 64, "context": 4096, "horizon": 1024, "optimizer_updates": 0, "loss": 0.22305740416049957, "seconds": 10.91669597796863, "peak_allocated_mib": 5362.6640625, "peak_reserved_mib": 5694.0}. All model gradients finite; no optimizer updates. + +E73 independent feature stream with static compilation, seed113 training started at 2026-10-22T07:07:01Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E71 eight-point patches, seed197 training started at 2026-10-22T07:08:06Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E63 stop receipt: {"experiment": "E63 expanded146M stopped", "step": 8501, "training_loop_seconds": 2892.9847088330425, "checkpoint_sha256": "1d578f0a2278a3a4ad7011e24957797dde52c70b7e2c6f8b369aaf8227ac7133", "ema": "/workspace/research/runs/wide_corpus_expanded_recovery/ema008501.pt", "complete_recovery": "/workspace/research/runs/wide_corpus_expanded_recovery/recovery.pt", "selection_checkpoint_step": 8000, "selection_skill": 0.3742660744379728, "outcome": "Essentially tied with original-corpus same-width8000 .3743298586; prioritize independent stream. Data scaling remains inconclusive."}. + +## E67 full_paired_control final12000 +- Checkpoint SHA-256: `b79cfdeefa1b2b20af89c8484a447dc96bfdd31234f2b08346468c8d9ece62bd`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 20.30943751335144 seconds. +- Overall skill 0.377243; relative MASE 0.745277; relative WQL 0.520379. +- term skill: long=0.4013, medium=0.4067, short=0.3560. +- domain skill: Econ/Fin=0.1346, Energy=0.2365, Healthcare=0.4485, Nature=0.4306, Sales=0.3336, Transport=0.4666, Web/CloudOps=0.5025. +- frequency skill: A=0.3681, D=0.3525, H=0.3948, M=0.1073, Q=0.2012, S=0.4245, T=0.4384, W=0.2186. +- variates skill: multivariate=0.3950, univariate=0.3628. +- Outcome: Seed197/B64/LR2e-5; final12000 is worse than the selected paired3000 and its published slow-AR correction. No publication. Matched control and candidate complete; no baseline rerun. + +## E67 full_paired_candidate final12000 +- Checkpoint SHA-256: `26d529aeaaee4484b0b4375fdc379779b08b38ac5077f0147587421f4f5fc8b0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.91175127029419 seconds. +- Overall skill 0.377427; relative MASE 0.744720; relative WQL 0.520460. +- term skill: long=0.4032, medium=0.4055, short=0.3560. +- domain skill: Econ/Fin=0.1326, Energy=0.2359, Healthcare=0.4464, Nature=0.4299, Sales=0.3326, Transport=0.4667, Web/CloudOps=0.5051. +- frequency skill: A=0.3614, D=0.3505, H=0.3948, M=0.1036, Q=0.1986, S=0.4251, T=0.4404, W=0.2181. +- variates skill: multivariate=0.3963, univariate=0.3620. +- Outcome: Seed197/B64/LR2e-5; final12000 is worse than the selected paired3000 and its published slow-AR correction. No publication. Matched control and candidate complete; no baseline rerun. + +E67 complete measured training loop times on the shared H100: individual control2794.8358459s; paired candidate2794.8673859s. These are overlapping wall times, not additive exclusive GPU seconds. + +## Operator recovery2 — 2026-10-22 +The operator reports152594 research seconds remaining; all old processes ended. Published E76 verified SHA2568562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105 and full validation0.3756123475. Resume complete optimizer/EMA/RNG/prefetched-batch checkpoints: E58/E66 wide17000 and control23000, E61 slowAR8000, E65 recent normalization9000. Their prior last logged steps17200/23750/8450/9600 represent at least200/750/450/600 unsaved updates discarded. Original phase logs remain intact, latest elapsed3043.3/3041.0/3037.0/3034.3s respectively. E73 graft had no checkpoint or logged50-step interval; E71 patch8 reached200/63.0s with no checkpoint. Restart both from saved own initialization with unchanged seeds. Compiler caches were absent after recovery, so E73 recompiles static shapes. E63 remains stopped; E67 remains complete. Phase commands/PIDs/timing are recorded in recovery2_launch_receipt.json and *_recovery2.log; queued E69/E75/E77 retain predeclared settings. + +## E78 multiple persistent scales in synthetic residuals — prepared, not launched +Hypothesis: the slow-AR improvement reflects missing persistent residual dynamics, but a single decay rate per synthetic sequence cannot represent fast variation superimposed on slow level changes. Compare four independent OU components to E77's one component. Keep the original component and main RNG draws; add three components with log-uniform time constants1..10000 from an independent RNG seed700200, then divide their sum by2 to preserve asymptotic stationary variance. All components retain zero initial state, isolating multiple scales from initialization. Other synthetic structure,20% synthetic fraction, real windows, horizon augmentation, architecture and loss remain unchanged. ParentE62, seed197/B64/LR2e-5/12000, paired-sign loss, main/horizon RNG identical to E77. This generator uses no external data. Prepare and check on allowed training windows; launch only after a suitable allocation is released. + +E78 sampler fixture passed: { "seed": 197, "extra_seed": 700200, "real_windows_bitwise_equal": 211, "synthetic_windows": 45, "changed_context_values": 26747, "main_and_horizon_rng_matched": true, "finite_masks_and_periods_matched": true, "cpu_seconds": 4.07623768504709, "optimizer_updates": 0 }; prepared only, no optimizer updates. + +## E58/E66 recovered37M control24000 +- Checkpoint SHA-256: `0a77157c454bf7a913b41493f052666ed1cfce3d65206b6c969fb8d95e6314a7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.700880765914917 seconds. +- Overall skill 0.375681; relative MASE 0.745320; relative WQL 0.522962. +- term skill: long=0.4008, medium=0.4066, short=0.3534. +- domain skill: Econ/Fin=0.1417, Energy=0.2348, Healthcare=0.4210, Nature=0.4300, Sales=0.3397, Transport=0.4677, Web/CloudOps=0.5018. +- frequency skill: A=0.3784, D=0.3533, H=0.3961, M=0.0763, Q=0.2029, S=0.4222, T=0.4370, W=0.2113. +- variates skill: multivariate=0.3953, univariate=0.3596. +- Outcome: Seed113, matched reset at8000 toseed179. Skill0.375681 remains slightly below E47parent0.375793; continue the predeclared schedule to32000. E58large24000 is pending. + +## E79 fresh pretraining at37M and146M — prepared, not launched +Hypothesis: duplicating a mature smaller representation and continuing at a small learning rate limits the useful benefit of capacity. Test distinct random initializations under one matched modern recipe. Both arms use the same direct encoder/decoder architecture (patch16,6encoder/4decoder blocks, recency/confidence inputs and partial-target masks); widths512/1024 with8/16heads are the only architectural difference. Every tensor is initialized here with seed307; no parent weights. Both use packed_sample,20% own synthetic windows, the proven slow-AR time-constant prior1..10000, independent horizon-prefix augmentation seed300310, paired-sign objective, seed307 sampling, batch48 distinct/96signed rows, AdamW LR2e-4,400-step warmup and96000-step cosine schedule, EMA. Both use the same static compiled loss after a numerical/memory fixture. Save every1000; screen4000/8000/16000/24000/48000/72000/96000, with earlier cutoffs for promising candidates. This is a matched width comparison within the new recipe; comparisons to the old published lineage are model-selection comparisons, not clean causal claims about width. Reuse no released or baseline weights. Launch only after existing allocations release. The extended schedule supplies4.608M distinct sampled windows per arm; stop a clearly unpromising branch when its checkpoints establish that result. + +## E71 patch8 first1000 +- Checkpoint SHA-256: `67648eaef1f0a4fe5a7c5526f25c2c8724735720463d99250e814632841f9ada`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.271108627319336 seconds. +- Overall skill 0.374708; relative MASE 0.748109; relative WQL 0.522638. +- term skill: long=0.3990, medium=0.3996, short=0.3553. +- domain skill: Econ/Fin=0.1322, Energy=0.2323, Healthcare=0.4676, Nature=0.4328, Sales=0.3481, Transport=0.4583, Web/CloudOps=0.4952. +- frequency skill: A=0.3712, D=0.3577, H=0.3912, M=0.0847, Q=0.1944, S=0.4235, T=0.4328, W=0.2289. +- variates skill: multivariate=0.3876, univariate=0.3643. +- Outcome: Seed197/B64/LR2e-5; recovers most of the conversion loss, from initial0.362217 to0.374708. Still below matched patch16 paired1000 at0.376860 and parentE62 at0.377343; continue to3000/6000 before a decision. + +E79 initial checkpoint receipts: [ { "path": "/workspace/research/random_capacity_512_initial.pt", "sha256": "19da01694123fcb13df815689ca66460d0da596bd31dfabfabb08dda6f7801e4", "parameters": 36800800, "seed": 307, "cpu_seconds": 0.5544250560924411, "optimizer_updates": 0 }, { "path": "/workspace/research/random_capacity_1024_initial.pt", "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", "parameters": 146477344, "seed": 307, "cpu_seconds": 2.0617611361667514, "optimizer_updates": 0 } ] + +E79 width512 fixture: { "width": 512, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": { "batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 4520.62451171875, "peak_reserved_mib": 4784.0 }, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999952735476323, "max_gradient_difference": 4.57763671875e-05, "compile_comparison_seconds": 53.98739787377417, "total_seconds": 63.50496790325269, "source": "allowed packed_sample and own synthetic generator only" } + +E79 width1024 fixture: { "width": 1024, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": { "batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 10162.86376953125, "peak_reserved_mib": 10694.0 }, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999932382274589, "max_gradient_difference": 6.103515625e-05, "compile_comparison_seconds": 62.02263342216611, "total_seconds": 72.94260076899081, "source": "allowed packed_sample and own synthetic generator only" } + +E79 both arms are queued after E58wide and E71patch8 release their allocations; their complete recovery files must exist. Queue receipts random_capacity_512_queue.json and random_capacity_1024_queue.json preserve exact commands. Both use B48/96000/seed307/static compilation. No training has started. Compiler caches are backed up under research/compiler_cache_backup and can be restored to the same /tmp paths after another recovery. + +postloss started 2026-10-22T07:27:21.677278+00:00 after recent_normalization_recovery completed. Original predeclared settings and seed retained. + +## Operator recovery3 — 2026-10-23 +Operator reports151596 research seconds remaining; all prior processes ended. Submission E76 hash verified unchanged. Resume complete state at wide20000/control28000/slowAR10000/patch8 2000. Last logged steps20100/28400/10850/2700 imply at least100/400/850/700 discarded unsaved updates; phase2 elapsed768.6/769.5/767.8/770.0s. Graft reached100 updates/722.7s without checkpoint; restart own seed113 initialization, restored compiler caches (13.8722s). Recent normalization completed12000 with final phase training loop708.0175s; do not retrain. Volatility/paired-slowAR and fresh-width queues restored with new dependencies. Postloss reached200/43.0s with nonfinite losses, no checkpoint; numerical diagnosis precedes restarting. Prior phase logs retained; no credential access. + +E75 numerical failure diagnosed on allowed-corpus step53, seed197, without optimizer updates: one row has context magnitude2.2842e18 and float32 variance accumulation overflow, yielding infinite normalization scale. The normalized neural output is finite, but conversion to raw units produces nonfinite values. Context postprocessing statistics themselves remain finite. Add a float64 fallback only on rows with nonfinite mean/scale; ordinary-row arithmetic remains bitwise unchanged. Restart this experiment from E62 after regression checks; no affected checkpoint will be selected. This correction is part of this comparison and will be retained in its inference runtime if selected. + +## E65 recent normalization final12000 +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 31.676968097686768 seconds. +- Overall skill 0.375806; relative MASE 0.744151; relative WQL 0.523574. +- term skill: long=0.4022, medium=0.4055, short=0.3535. +- domain skill: Econ/Fin=0.1427, Energy=0.2348, Healthcare=0.4380, Nature=0.4255, Sales=0.3383, Transport=0.4706, Web/CloudOps=0.4994. +- frequency skill: A=0.3754, D=0.3572, H=0.3959, M=0.0785, Q=0.2042, S=0.4248, T=0.4352, W=0.2109. +- variates skill: multivariate=0.3924, univariate=0.3622. +- Outcome: Seed101/B128/LR3e-5. Main0.375806 narrowly exceeds4096-control0.375764 and8192-full-normalization0.375118; evaluate earlier windows against both matched controls. Final resumed phase708.0175 training-loop seconds; prior interrupted phases are retained separately. + +E75 numerical regression passed: ordinary rows bitwise original; observed overflowing row now finite loss2.6841469 and all gradients finite,7.0381s,0optimizer updates. Fixed-parent replay of250original training batches found no nonfinite postprocessed forecasts in21.9482s. Restarted seed197/B64/LR2e-5/12000 from E62. Future validation uses postloss_inference with the same overflow fallback. The first earlier-control evaluation launch used the old trend summary runtime by mistake and was cancelled; corrected comparisons are named long_context_control_fixed128_ema12000. No selection uses the cancelled diagnostic. + +E76 descriptive paired full-validation comparison against E67paired3000: improvement0.0012113184,51/97configurations improve. Resampling dataset-directory clusters (28keys, seed317,5000draws) gives skill-delta percentiles[-0.0006681,0.0012221,0.0031907]. The range crosses zero and adaptive validation reuse prevents a held-out significance claim. Retain E76 based on measured full/earlier scores, while recognizing this is a small improvement. Largest gains include us_births daily and bizitobs_l2c short; ETT2 minute short worsens. Full per-configuration log-error differences retained in slow_ar_delta6k_comparison.json. + +## E80 matched control for the overflow correction — prepared +E75 needs a numerical fallback for rare overflowing training rows. To isolate its postprocessing-aware objective, prepare a control with exactly the same fallback but the original E67 paired-sign loss. ParentE62,seed197,B64,LR2e-5,12000steps, matching data/horizon RNG. No other inference or training change. This is a newly required numerical control, not a baseline rerun. + +## E81 equal ensemble of E76 and recent-normalization12000 +The longer-history candidate has a stronger second earlier cutoff but lower main/first-earlier performance than E76. Test whether averaging their postprocessed quantiles reduces complementary errors. Fixed equal weights; every member must forecast every instance if packaged. Compare cached main and both earlier predictions first. No coefficient sweep, new fitting, data or training. Reject unless the diagnostic tradeoff justifies full public-package replay. + +E80 overflow-only paired control queued alongside fresh-capacity arms after the old wide/patch8 allocations release. E78 multiscale-AR queued after postloss releases its allocation. Both use declared seed197/B64/LR2e-5/12000 settings; every command is retained in its queue receipt. Neither has started. + +## E65 matched comparison recent_normalization_recovery backcast_evals +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.444558143615723 seconds. +- Overall skill 0.335105; relative MASE 0.796743; relative WQL 0.554866. +- term skill: long=0.4010, medium=0.3564, short=0.2994. +- domain skill: Econ/Fin=0.1646, Energy=0.2213, Healthcare=0.4212, Nature=0.3540, Sales=0.3970, Transport=0.3770, Web/CloudOps=0.4538. +- frequency skill: A=0.3179, D=0.3541, H=0.3610, M=0.1841, Q=0.2288, S=0.3371, T=0.3395, W=0.2758. +- variates skill: multivariate=0.3510, univariate=0.3221. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison recent_normalization_recovery backcast2_evals +- Checkpoint SHA-256: `1fea846895698d0e33384a63e228b17de602d03154e41ad0c81d5cc060ed182f`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.86247205734253 seconds. +- Overall skill 0.361614; relative MASE 0.766245; relative WQL 0.531861. +- term skill: long=0.3676, medium=0.3942, short=0.3463. +- domain skill: Econ/Fin=0.1074, Energy=0.2351, Healthcare=0.3566, Nature=0.4647, Sales=0.5547, Transport=0.4203, Web/CloudOps=0.4480. +- frequency skill: A=0.3496, D=0.4310, H=0.3890, M=0.1517, Q=0.1448, S=0.2876, T=0.3677, W=0.2567. +- variates skill: multivariate=0.3709, univariate=0.3540. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_control_fixed128 backcast_evals +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 21.399088382720947 seconds. +- Overall skill 0.335548; relative MASE 0.797825; relative WQL 0.553375. +- term skill: long=0.3998, medium=0.3578, short=0.3002. +- domain skill: Econ/Fin=0.1618, Energy=0.2279, Healthcare=0.4256, Nature=0.3575, Sales=0.3966, Transport=0.3721, Web/CloudOps=0.4487. +- frequency skill: A=0.3187, D=0.3539, H=0.3656, M=0.1845, Q=0.2285, S=0.3427, T=0.3351, W=0.2751. +- variates skill: multivariate=0.3528, univariate=0.3215. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_control_fixed128 backcast2_evals +- Checkpoint SHA-256: `372edd6a03da9f577992a9cf6363b26efe7b11b35fc3aed2d50868566efd0c71`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.050649642944336 seconds. +- Overall skill 0.359190; relative MASE 0.769269; relative WQL 0.533801. +- term skill: long=0.3663, medium=0.3893, short=0.3445. +- domain skill: Econ/Fin=0.1046, Energy=0.2371, Healthcare=0.3554, Nature=0.4689, Sales=0.5535, Transport=0.4194, Web/CloudOps=0.4333. +- frequency skill: A=0.3493, D=0.4307, H=0.3894, M=0.1531, Q=0.1429, S=0.2835, T=0.3601, W=0.2577. +- variates skill: multivariate=0.3643, univariate=0.3551. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_8192 backcast_evals +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.02571153640747 seconds. +- Overall skill 0.335778; relative MASE 0.796740; relative WQL 0.553746. +- term skill: long=0.4000, medium=0.3562, short=0.3012. +- domain skill: Econ/Fin=0.1625, Energy=0.2211, Healthcare=0.4240, Nature=0.3584, Sales=0.3963, Transport=0.3783, Web/CloudOps=0.4528. +- frequency skill: A=0.3183, D=0.3550, H=0.3608, M=0.1825, Q=0.2283, S=0.3383, T=0.3410, W=0.2775. +- variates skill: multivariate=0.3516, univariate=0.3229. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +## E65 matched comparison long_context_8192 backcast2_evals +- Checkpoint SHA-256: `90a1a9da78714594078b3cafd32b1812d633f5d6bf85ba8bfa60d09fbc3ebd38`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.033729791641235 seconds. +- Overall skill 0.361619; relative MASE 0.766647; relative WQL 0.531576. +- term skill: long=0.3678, medium=0.3937, short=0.3464. +- domain skill: Econ/Fin=0.1060, Energy=0.2331, Healthcare=0.3615, Nature=0.4677, Sales=0.5540, Transport=0.4209, Web/CloudOps=0.4469. +- frequency skill: A=0.3484, D=0.4320, H=0.3875, M=0.1537, Q=0.1444, S=0.2887, T=0.3679, W=0.2592. +- variates skill: multivariate=0.3695, univariate=0.3552. +- Outcome: Recent normalization main0.375806/earlier0.335105/0.361614; full-normalization8192 main0.375118/earlier0.335778/0.361619;4096control main0.375764/earlier0.335548/0.359190. Temporal tradeoff, no single-member publication. Test complementary equal ensemble with E76 as declared E81. + +E81 main: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3792404374337234, "rel_mase_gmean": 0.7413362113099933, "rel_wql_gmean": 0.5197944315124549, "groups": {"term": {"short": 0.3580501678473965, "medium": 0.4075051608812147, "long": 0.40436165270683755}, "domain": {"Econ/Fin": 0.14514965737880325, "Energy": 0.23693703384364162, "Healthcare": 0.4508892358362413, "Nature": 0.43068317186356664, "Sales": 0.3372290847442204, "Transport": 0.46921029381701185, "Web/CloudOps": 0.5049832577126345}, "freq": {"A-DEC": 0.3741084316720569, "Q-DEC": 0.2032048606604645, "M": 0.09063626527124269, "W-SUN": 0.11024985736894433, "D": 0.35966521985300126, "H": 0.39764382964309264, "15T": 0.21216406035245483, "W-FRI": -0.006517286299776881, "10T": 0.6144670200764979, "W-TUE": 0.5505379760713061, "W-THU": 0.20290227669295913, "W-WED": 0.3148429295780334, "5T": 0.5200294927472697, "10S": 0.42580083885860065}}, "cpu_seconds": 1.3077636559028178, "members": ["/workspace/research/evals/slow_ar_delta6k", "/workspace/research/evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 backcast: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3372609628923202, "rel_mase_gmean": 0.7949387478174683, "rel_wql_gmean": 0.5525243706037937, "groups": {"term": {"short": 0.30267748548708406, "medium": 0.3587870572492281, "long": 0.4004504376989413}, "domain": {"Econ/Fin": 0.16791580188275335, "Energy": 0.2249147271500851, "Healthcare": 0.41565091499514417, "Nature": 0.36337531871749584, "Sales": 0.3953576986774914, "Transport": 0.37558039099633533, "Web/CloudOps": 0.45422426929296467}, "freq": {"A-DEC": 0.3198896505754395, "Q-DEC": 0.2324966250821987, "M": 0.1868807358115966, "W-SUN": 0.05675657061089712, "D": 0.35253814976953, "H": 0.3643205260222693, "15T": 0.2214260132321374, "W-FRI": 0.25870400902354673, "10T": 0.32373236597235966, "W-TUE": 0.534873854215015, "W-THU": 0.23833675077582528, "W-WED": 0.34309889609685684, "5T": 0.44852116184278545, "10S": 0.34093317446682636}}, "cpu_seconds": 0.9129793490283191, "members": ["/workspace/research/backcast_evals/slow_ar_delta6k", "/workspace/research/backcast_evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 backcast2: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.36253066634723885, "rel_mase_gmean": 0.7663699578325764, "rel_wql_gmean": 0.5302493230514544, "groups": {"term": {"short": 0.3479807306166687, "medium": 0.39255912185019026, "long": 0.3693846383480154}, "domain": {"Econ/Fin": 0.1149608358698847, "Energy": 0.23668310113177404, "Healthcare": 0.35088547046370666, "Nature": 0.47069187269468127, "Sales": 0.5515284168852219, "Transport": 0.42149224872299274, "Web/CloudOps": 0.44469672192663035}, "freq": {"A-DEC": 0.3516200787127538, "Q-DEC": 0.14815814613753098, "M": 0.1464874832493296, "W-SUN": 0.06348262953040695, "D": 0.4307487103712574, "H": 0.3906466140437964, "15T": 0.10333300498128906, "W-FRI": 0.155407323458577, "10T": 0.5012397694349602, "W-TUE": 0.09030520980227696, "W-THU": 0.32093855640615543, "W-WED": 0.5365268550523004, "5T": 0.4842228628098807, "10S": 0.2879093531003366}}, "cpu_seconds": 0.9467690440360457, "members": ["/workspace/research/backcast2_evals/slow_ar_delta6k", "/workspace/research/backcast2_evals/recent_normalization_recovery_ema12000"], "selection_only": true} + +E81 actual candidate hash500fdde392c269ef1a6830477580bc7890b711824097ac711885bf0220e657cb,73,598,528parameters, contains original4096 E76 and recent-normalized8192 E65. Full package replay and relocation verification started. Candidate-only, submission unchanged. + +## E71 patch8 at3000 +- Checkpoint SHA-256: `5be1ccd5e5539619e4f5ff221a4088437e7267ceb34928015a0348187e4a575e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.875902891159058 seconds. +- Overall skill 0.378312; relative MASE 0.744947; relative WQL 0.518823. +- term skill: long=0.4027, medium=0.4023, short=0.3592. +- domain skill: Econ/Fin=0.1391, Energy=0.2401, Healthcare=0.4515, Nature=0.4387, Sales=0.3471, Transport=0.4584, Web/CloudOps=0.4997. +- frequency skill: A=0.3807, D=0.3546, H=0.3955, M=0.0952, Q=0.1935, S=0.4235, T=0.4386, W=0.2325. +- variates skill: multivariate=0.3942, univariate=0.3653. +- Outcome: Seed197, interrupted then full-state resumed at2000. Main0.378312 essentially matches E67paired16-point3000 at0.378318. Continue to6000; no publication on this near tie. + +Recovery-frequency change verified on the tiny permitted-data fixture: { "maximum_model_difference": 1.5543122344752192e-15, "maximum_ema_difference": 3.0531133177191805e-16, "batch_rng_equal": true, "sampler_rng_equal": true, "seconds": 29.735046536196023, "selection_checkpoint_every": 4, "recovery_checkpoint_every": 2, "fixture_only": true }; increasing recovery-state saves preserves the sampler stream and model/EMA up to measured GPU roundoff. Newly launched jobs default to complete-state saves every250steps, while selection weights remain every1000. Already-running processes retain their original code/schedule. + +## E82 final slow-AR correction transfer — predeclared comparison +When E61 completes12000, replace the6000-step correction with its12000-step counterpart: E67paired3000 + E61slowAR12000 - E42partial12000, coefficient1.0, confidence-only tensor retained from base. This is the already-planned final matched comparison, not addition on top of E76. No coefficient sweep or further training. Check all four screening cutoffs, then full public package only if justified. slow_ar_final_comparison.py executes the fixed composition and screens after the atomic EMA exists. + +## E81 equal long-history ensemble full package +- Checkpoint SHA-256: `500fdde392c269ef1a6830477580bc7890b711824097ac711885bf0220e657cb`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.375233; relative MASE 0.744322; relative WQL 0.524415. +- term skill: long=0.3984, medium=0.4064, short=0.3536. +- domain skill: Econ/Fin=0.1215, Energy=0.2298, Healthcare=0.4558, Nature=0.4307, Sales=0.3504, Transport=0.4695, Web/CloudOps=0.4976. +- frequency skill: A=0.2913, D=0.3631, H=0.3929, M=0.1149, Q=0.1839, S=0.4258, T=0.4330, W=0.2096. +- variates skill: multivariate=0.3929, univariate=0.3608. +- Outcome: Reject for publication: full0.375233 is below selected E76 0.375612, despite first/second-earlier gains. All97configs/151170instances valid, zero crossings. Public inference213.940586s on shared H100. No coefficient sweep; retain singleton E76. + +volatility_synth started 2026-10-23T02:55:46.196186+00:00 after long_memory_synth_recovery completed. Original predeclared settings and seed retained. + +## E75 corrected postloss first1000 +- Checkpoint SHA-256: `d33a29e773434d2f0faf2bc85b73151354dcb98bedc83f28c44e776835310afa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.844736576080322 seconds. +- Overall skill 0.376671; relative MASE 0.745163; relative WQL 0.521416. +- term skill: long=0.3992, medium=0.4062, short=0.3560. +- domain skill: Econ/Fin=0.1257, Energy=0.2385, Healthcare=0.4569, Nature=0.4304, Sales=0.3363, Transport=0.4666, Web/CloudOps=0.4975. +- frequency skill: A=0.3694, D=0.3556, H=0.3962, M=0.0824, Q=0.1976, S=0.4232, T=0.4357, W=0.2250. +- variates skill: multivariate=0.3926, univariate=0.3637. +- Outcome: Finite training after the verified normalization fallback. Main0.376671 is slightly below E67paired1000 at0.376860; continue to3000/6000, with newly queued overflow-only E80 control needed to isolate the objective. + +paired_long_memory started 2026-10-23T02:56:31.210459+00:00 after wide_capacity_control_recovery completed. Original predeclared settings and seed retained. + +## E61 slowAR final12000 +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.156561374664307 seconds. +- Overall skill 0.362914; relative MASE 0.759071; relative WQL 0.534704. +- term skill: long=0.3926, medium=0.4046, short=0.3342. +- domain skill: Econ/Fin=0.1187, Energy=0.1874, Healthcare=0.4331, Nature=0.4271, Sales=0.3429, Transport=0.4595, Web/CloudOps=0.5091. +- frequency skill: A=0.3722, D=0.3472, H=0.3824, M=0.1132, Q=0.2021, S=0.4423, T=0.4070, W=0.2137. +- variates skill: multivariate=0.3958, univariate=0.3355. +- Outcome: Seed79; main0.362914 improves matched E42partial12000 at0.361108. Completed final resumed phase569.4896 training-loop seconds; prior interrupted phase logs retained. E82 transfers the final matched correction to selected paired3000, compared with the already published6000 correction. + +E75 overflow source replay identifies bitcoin_with_missing (seed197,step53,row37), with daily periods7/365 and observed values from6.0e11 to2.28e18. These scales can be legitimate crypto quantities; no data-cleaning or filtering rule is inferred. Source diagnostic0.9295CPU seconds, no optimizer updates. The numerical fallback addresses the representation range. + +E81 relocated package checks passed: three example configurations bitwise equal, finite and monotone,21.2942s. Third-earlier cached ensemble0.389488 slightly exceeds E76 0.389281, but main/full remain lower, so the publication decision remains rejection. The long-history member alone scores0.386764 at this third cutoff. + +## E58/E66 recovered37M control final32000 +- Checkpoint SHA-256: `570983ddd4f6d8e136906f1669798d938ecd93738da55f624afc5b25606249bb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.769165754318237 seconds. +- Overall skill 0.375305; relative MASE 0.746308; relative WQL 0.522900. +- term skill: long=0.3997, medium=0.4059, short=0.3535. +- domain skill: Econ/Fin=0.1400, Energy=0.2324, Healthcare=0.4362, Nature=0.4284, Sales=0.3384, Transport=0.4676, Web/CloudOps=0.5011. +- frequency skill: A=0.3825, D=0.3508, H=0.3940, M=0.0846, Q=0.2029, S=0.4232, T=0.4370, W=0.2159. +- variates skill: multivariate=0.3936, univariate=0.3604. +- Outcome: Final0.375305 below E47parent0.375793 and own24000 at0.375681. Final resumed phase616.7562 training-loop seconds; prior phase logs retained. No publication. Its allocation now trains E77pairedslowAR. + +E61 final12k EMA hashc27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e. Last resumed phase569.4895656s; phase2 reached10850 in767.8s, phase1 reached8450 in3037.0s, original pre-recovery attempt reached2150 in542.2s. These are overlapping process elapsed times, with discarded unsaved updates counted as spent compute; not exclusive GPU seconds. E65 final resumed phase708.0175s, prior phases3034.3s and71.8s. + +## E82 slowAR final correction evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.064879655838013 seconds. +- Overall skill 0.379181; relative MASE 0.741695; relative WQL 0.519643. +- term skill: long=0.4028, medium=0.4057, short=0.3593. +- domain skill: Econ/Fin=0.1465, Energy=0.2342, Healthcare=0.4607, Nature=0.4319, Sales=0.3354, Transport=0.4660, Web/CloudOps=0.5068. +- frequency skill: A=0.3720, D=0.3593, H=0.3969, M=0.1007, Q=0.1994, S=0.4227, T=0.4390, W=0.2245. +- variates skill: multivariate=0.3977, univariate=0.3640. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.045677423477173 seconds. +- Overall skill 0.336511; relative MASE 0.796069; relative WQL 0.552989. +- term skill: long=0.3975, medium=0.3593, short=0.3024. +- domain skill: Econ/Fin=0.1707, Energy=0.2251, Healthcare=0.4072, Nature=0.3664, Sales=0.3935, Transport=0.3727, Web/CloudOps=0.4527. +- frequency skill: A=0.3195, D=0.3490, H=0.3653, M=0.1930, Q=0.2358, S=0.3419, T=0.3374, W=0.2844. +- variates skill: multivariate=0.3537, univariate=0.3225. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast2_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.12555480003357 seconds. +- Overall skill 0.360111; relative MASE 0.768417; relative WQL 0.532858. +- term skill: long=0.3671, medium=0.3887, short=0.3461. +- domain skill: Econ/Fin=0.1203, Energy=0.2346, Healthcare=0.3518, Nature=0.4695, Sales=0.5471, Transport=0.4199, Web/CloudOps=0.4385. +- frequency skill: A=0.3524, D=0.4264, H=0.3900, M=0.1434, Q=0.1516, S=0.2859, T=0.3636, W=0.2642. +- variates skill: multivariate=0.3674, univariate=0.3541. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +## E82 slowAR final correction backcast3_evals +- Checkpoint SHA-256: `f74bea6307738c331bd53618fde99f32238a72a0a85beb941f51446054e95c4c`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 23.64928960800171 seconds. +- Overall skill 0.389784; relative MASE 0.736377; relative WQL 0.505671. +- term skill: long=0.3953, medium=0.3617, short=0.3980. +- domain skill: Econ/Fin=0.1860, Energy=0.3200, Healthcare=0.2362, Nature=0.5068, Sales=0.3992, Transport=0.5052, Web/CloudOps=0.3945. +- frequency skill: A=0.3688, D=0.4453, H=0.4034, M=0.1130, Q=0.2642, S=0.2924, T=0.4309, W=0.2637. +- variates skill: multivariate=0.3749, univariate=0.4013. +- Outcome: Reject replacement of E76: final correction main0.379181/earlier0.336511/0.360111 loses three screens to6000 correction0.379721/0.336781/0.360577. Third-earlier improves0.389784 versus0.389281. Fixed coefficient1; no further sweep or full replay justified by this tradeoff. Retain E76. + +E82 composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/full_paired_candidate/ema003000.pt": "2a19ebe0d41c1a18feaba318041795be4d268ce890162a5035e6fc6bf1844238", "/workspace/research/runs/long_memory_synth_recovery/ema012000.pt": "c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e", "/workspace/research/runs/partial_targets/ema012000.pt": "a0ef29e85d0cf01677a6a58e4a9f91b077073c4af95f85234eec2ddc223f4837"}, "seconds": 1.2579920410644263} + +## E61 slowAR final12k backcast_evals +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.161132097244263 seconds. +- Overall skill 0.332462; relative MASE 0.802575; relative WQL 0.555221. +- term skill: long=0.3889, medium=0.3582, short=0.2991. +- domain skill: Econ/Fin=0.1592, Energy=0.2274, Healthcare=0.4159, Nature=0.3553, Sales=0.3990, Transport=0.3647, Web/CloudOps=0.4455. +- frequency skill: A=0.3164, D=0.3542, H=0.3581, M=0.1781, Q=0.2386, S=0.3429, T=0.3325, W=0.2793. +- variates skill: multivariate=0.3483, univariate=0.3196. +- Outcome: Final direct slow-AR improves E42partial12k on both earlier cutoffs:0.332462 versus0.331074 and0.354079 versus0.353096. Matched synthetic-prior benefit survives the full schedule, while transferring its final delta is weaker than transferring6000 at the selected backbone. + +## E61 slowAR final12k backcast2_evals +- Checkpoint SHA-256: `c27613689514c4d0cd008f3f5e6bf35a14d2ff170c3786820981e52c373de10e`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.80446219444275 seconds. +- Overall skill 0.354079; relative MASE 0.774604; relative WQL 0.538615. +- term skill: long=0.3715, medium=0.3752, short=0.3393. +- domain skill: Econ/Fin=0.1039, Energy=0.2274, Healthcare=0.3615, Nature=0.4600, Sales=0.5536, Transport=0.4138, Web/CloudOps=0.4332. +- frequency skill: A=0.3506, D=0.4274, H=0.3872, M=0.1661, Q=0.1581, S=0.2852, T=0.3480, W=0.2482. +- variates skill: multivariate=0.3615, univariate=0.3480. +- Outcome: Final direct slow-AR improves E42partial12k on both earlier cutoffs:0.332462 versus0.331074 and0.354079 versus0.353096. Matched synthetic-prior benefit survives the full schedule, while transferring its final delta is weaker than transferring6000 at the selected backbone. + +E73 usage diagnostic on8allowed-corpus windows,seed337,C512,H128,5.8388CPU seconds,0optimizer updates: initial added-head contribution is zero; atEMA2000 its output RMS is0.00924times the inherited head contribution. Cross-stream query-weight norm rises from0 to0.01672times within-stream norm; head-input streams remain distinct (relative RMS difference1.4274). Distinct features are being used, but this alone does not establish validation improvement. Full receipt wide_graft_usage2k.json includes hashes. + +## E75 corrected postloss3000 +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.580218076705933 seconds. +- Overall skill 0.378814; relative MASE 0.742602; relative WQL 0.519622. +- term skill: long=0.4027, medium=0.4070, short=0.3582. +- domain skill: Econ/Fin=0.1222, Energy=0.2441, Healthcare=0.4509, Nature=0.4321, Sales=0.3355, Transport=0.4650, Web/CloudOps=0.5021. +- frequency skill: A=0.3710, D=0.3521, H=0.4006, M=0.0768, Q=0.1947, S=0.4220, T=0.4401, W=0.2249. +- variates skill: multivariate=0.3963, univariate=0.3645. +- Outcome: Main0.378814 exceeds original E67paired3000 at0.378318, but remains below selected E76 at0.379721. Check earlier cutoffs; numerical-only control E80 remains queued, so causal attribution to postprocessing loss is provisional. + +## E83 combine postprocessing-aware3000 with the selected slow-AR6000 correction +E75 improves the original paired3000 main screen, while E76 demonstrates that the matched slow-AR6000 correction transfers across cutoffs. Test a fixed composition: E75postloss3000 + E61slowAR6000 - E42partial6000. Keep E75 confidence parameters, its verified overflow fallback and all inference rules. Coefficient1.0, no sweep; evaluate all four screening cutoffs before full replay/publication. This is a predictive composition test; E80 is still needed to separate the numerical correction from the postprocessing-aware loss. No additional training or validation gradients. + +## E77 pairedslowAR first1000 +- Checkpoint SHA-256: `278af3b837eee9032d80e20e70dc9155bd1f272983232826f16ff9df95547846`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.467870473861694 seconds. +- Overall skill 0.377046; relative MASE 0.744404; relative WQL 0.521319. +- term skill: long=0.3994, medium=0.4062, short=0.3566. +- domain skill: Econ/Fin=0.1382, Energy=0.2363, Healthcare=0.4530, Nature=0.4321, Sales=0.3345, Transport=0.4673, Web/CloudOps=0.4987. +- frequency skill: A=0.3685, D=0.3562, H=0.3951, M=0.1012, Q=0.1989, S=0.4234, T=0.4360, W=0.2232. +- variates skill: multivariate=0.3931, univariate=0.3639. +- Outcome: Seed197/B64/LR2e-5; main0.377046 slightly exceeds original paired1000 at0.376860. Early checkpoint only; continue matched3000/6000/12000 comparison. + +## E75 postloss3000 backcast_evals +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.485270261764526 seconds. +- Overall skill 0.333947; relative MASE 0.800204; relative WQL 0.554393. +- term skill: long=0.3971, medium=0.3587, short=0.2981. +- domain skill: Econ/Fin=0.1484, Energy=0.2303, Healthcare=0.3976, Nature=0.3612, Sales=0.3967, Transport=0.3722, Web/CloudOps=0.4461. +- frequency skill: A=0.3136, D=0.3467, H=0.3696, M=0.1659, Q=0.2280, S=0.3365, T=0.3319, W=0.2801. +- variates skill: multivariate=0.3510, univariate=0.3200. +- Outcome: Both earlier cutoffs regress against original E67paired3000:0.333947 versus0.335739 and0.357605 versus0.358235, exceeding the main gain. Prune corrected postloss continuation, preserve complete recovery and checkpoints, and release its allocation to E78multiscale. E83 composition screening continues; E80 numerical-only control remains needed for attribution. + +## E75 postloss3000 backcast2_evals +- Checkpoint SHA-256: `82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.475824117660522 seconds. +- Overall skill 0.357605; relative MASE 0.772196; relative WQL 0.534413. +- term skill: long=0.3631, medium=0.3873, short=0.3437. +- domain skill: Econ/Fin=0.1041, Energy=0.2395, Healthcare=0.3227, Nature=0.4712, Sales=0.5519, Transport=0.4212, Web/CloudOps=0.4278. +- frequency skill: A=0.3532, D=0.4162, H=0.3932, M=0.1558, Q=0.1493, S=0.2753, T=0.3604, W=0.2566. +- variates skill: multivariate=0.3621, univariate=0.3540. +- Outcome: Both earlier cutoffs regress against original E67paired3000:0.333947 versus0.335739 and0.357605 versus0.358235, exceeding the main gain. Prune corrected postloss continuation, preserve complete recovery and checkpoints, and release its allocation to E78multiscale. E83 composition screening continues; E80 numerical-only control remains needed for attribution. + +multiscale_ar seed197 training started at 2026-10-23T03:01:47Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E75 stop receipt: {"experiment": "E75 corrected postloss stopped", "step": 3653, "checkpoint_sha256": "760314a6d65350417c4a58e32eb21cebaac953dc83820d300a4b6b24b0977cb1", "weights": "/workspace/research/runs/postloss/ema003653.pt", "recovery": "/workspace/research/runs/postloss/recovery.pt", "training_loop_final_record": {"completed_step": 3653, "training_process_loop_seconds": 799.9150489440653}, "process_receipt": {"command": ["python3", "/workspace/research/recovery/train.py", "--code-dir", "/workspace/research/postloss", "--packed", "/workspace/research/packed_sample", "--source-weights-from", "/workspace/research/packed_sample", "--out", "/workspace/research/runs/postloss", "--initialize-from", "/workspace/research/horizon_delta12k.pt", "--steps", "12000", "--batch", "64", "--lr", "2e-05", "--seed", "197", "--stop-file", "/workspace/research/postloss.stop", "--loss-mode", "paired"], "status": "complete", "pid": 1280, "log": "/workspace/research/postloss_recovery3.log", "started_utc": "2026-10-23T02:48:16Z", "note": "Restart own E62 initialization after verified float32 variance-overflow correction; original seed and recipe unchanged.", "returncode": 0, "process_seconds": 810.3138020890765}, "outcome": "Both earlier3000 cutoffs regress; E83 saved-checkpoint composition remains in screening, E80 numerical control queued."} + +## E83 postloss+slowAR evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.666229724884033 seconds. +- Overall skill 0.380251; relative MASE 0.741085; relative WQL 0.518280. +- term skill: long=0.4038, medium=0.4070, short=0.3603. +- domain skill: Econ/Fin=0.1348, Energy=0.2414, Healthcare=0.4552, Nature=0.4344, Sales=0.3382, Transport=0.4643, Web/CloudOps=0.5059. +- frequency skill: A=0.3743, D=0.3567, H=0.4003, M=0.0763, Q=0.1987, S=0.4254, T=0.4419, W=0.2242. +- variates skill: multivariate=0.3980, univariate=0.3658. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 23.061537742614746 seconds. +- Overall skill 0.335421; relative MASE 0.797508; relative WQL 0.553807. +- term skill: long=0.3950, medium=0.3597, short=0.3013. +- domain skill: Econ/Fin=0.1640, Energy=0.2281, Healthcare=0.3974, Nature=0.3657, Sales=0.3962, Transport=0.3713, Web/CloudOps=0.4494. +- frequency skill: A=0.3211, D=0.3463, H=0.3688, M=0.1723, Q=0.2313, S=0.3404, T=0.3344, W=0.2853. +- variates skill: multivariate=0.3526, univariate=0.3214. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast2_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.91576099395752 seconds. +- Overall skill 0.360099; relative MASE 0.769700; relative WQL 0.531990. +- term skill: long=0.3671, medium=0.3869, short=0.3468. +- domain skill: Econ/Fin=0.1196, Energy=0.2390, Healthcare=0.3200, Nature=0.4758, Sales=0.5509, Transport=0.4203, Web/CloudOps=0.4338. +- frequency skill: A=0.3513, D=0.4228, H=0.3920, M=0.1454, Q=0.1495, S=0.2810, T=0.3646, W=0.2628. +- variates skill: multivariate=0.3658, univariate=0.3555. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +## E83 postloss+slowAR backcast3_evals +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 23.31220841407776 seconds. +- Overall skill 0.389069; relative MASE 0.739022; relative WQL 0.505041. +- term skill: long=0.3936, medium=0.3628, short=0.3969. +- domain skill: Econ/Fin=0.1785, Energy=0.3245, Healthcare=0.2109, Nature=0.5039, Sales=0.4010, Transport=0.5082, Web/CloudOps=0.3908. +- frequency skill: A=0.3606, D=0.4409, H=0.4062, M=0.1151, Q=0.2596, S=0.2759, T=0.4323, W=0.2589. +- variates skill: multivariate=0.3734, univariate=0.4011. +- Outcome: Main0.380251 improves selectedE76 0.379721, while all earlier scores0.335421/0.360099/0.389069 are below E76 0.336781/0.360577/0.389281. Complete public full validation to check whether the main gain extends beyond the capped screen; report the temporal regressions explicitly. No publication yet. + +E83 CPU composition receipt: {"method": "matched training delta", "formula": "base + candidate - control", "coefficient": 1.0, "parent_hashes": {"/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb"}, "seconds": 1.0092943429481238} + +## E83 postprocessing-aware3000 plus slowAR6000 full public-package replay +- Checkpoint SHA-256: `0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.376131; relative MASE 0.743936; relative WQL 0.523180. +- term skill: long=0.3978, medium=0.4059, short=0.3557. +- domain skill: Econ/Fin=0.1127, Energy=0.2338, Healthcare=0.4604, Nature=0.4345, Sales=0.3517, Transport=0.4644, Web/CloudOps=0.4981. +- frequency skill: A=0.2909, D=0.3608, H=0.3952, M=0.1011, Q=0.1844, S=0.4254, T=0.4346, W=0.2165. +- variates skill: multivariate=0.3936, univariate=0.3619. +- Outcome: Publish as best full primary validation: skill0.376130733 versus E76 0.375612348; relMASE0.743936224 and relWQL0.523180415, 97 configurations/151170 instances, zero failures. Public inference120.396952s; independent relocation14.861885s gave bitwise equal finite ordered forecasts on three examples. All three earlier cutoffs regress versus E76, so this is a narrow primary-validation selection, not evidence of broad temporal improvement. Keep E76 as the more stable rollback. No training in this composition; coefficient1.0 fixed, source training seeds197/79; hashes and parent compute above. E80 numerical-only control remains queued. + +E83 descriptive cluster comparison: {"candidate": "/workspace/research/valid-report-postloss-slow-ar.json", "parent": "/workspace/research/valid-report-slow-ar-delta6k.json", "candidate_hash": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "parent_hash": "8562cb05319ed04fdd8544a1af80bf1688ba55284e59b4689aa646e34e38a105", "skill_difference": 0.0005183850211532004, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 51, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": -0.0027720070621055277, "p50": 0.0002985771391603165, "p975": 0.004193731829011101}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E58/E66 recovered146M at global24000 +- Checkpoint SHA-256: `8f9a786a85c8fcd3d4aaba9e5651a68b6f2df74d5cdc0e30907a4293dd297492`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 37.02190327644348 seconds. +- Overall skill 0.375978; relative MASE 0.744657; relative WQL 0.522931. +- term skill: long=0.4006, medium=0.4073, short=0.3537. +- domain skill: Econ/Fin=0.1411, Energy=0.2353, Healthcare=0.4235, Nature=0.4300, Sales=0.3398, Transport=0.4674, Web/CloudOps=0.5021. +- frequency skill: A=0.3775, D=0.3521, H=0.3962, M=0.0785, Q=0.2030, S=0.4233, T=0.4372, W=0.2148. +- variates skill: multivariate=0.3957, univariate=0.3598. +- Outcome: Matched 37M control24000 is0.375680951 and original E47parent0.375792930. Widened model0.375977511 is modestly higher; continue planned32000, no publication against stronger E83. Seed113 then recovery reset179, batch96, baseLR3e-5; complete recovery retained. + +## E73 independent feature stream first4000 +- Checkpoint SHA-256: `c16f146c285d9e5c8c9ae60e54af3d9d1dae3f48e1cf2104e37676062df8ad5e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 40.91307091712952 seconds. +- Overall skill 0.372085; relative MASE 0.750057; relative WQL 0.525664. +- term skill: long=0.3976, medium=0.4060, short=0.3484. +- domain skill: Econ/Fin=0.1401, Energy=0.2348, Healthcare=0.4070, Nature=0.4248, Sales=0.3416, Transport=0.4634, Web/CloudOps=0.4971. +- frequency skill: A=0.3733, D=0.3439, H=0.3937, M=0.0971, Q=0.1987, S=0.4185, T=0.4336, W=0.2014. +- variates skill: multivariate=0.3914, univariate=0.3563. +- Outcome: Main0.372084568 regresses versus own function-preserving initialization0.375792503 and original-width parent. New-stream usage was nonzero at2000; use planned8000 to distinguish transient feature learning from persistent degradation. Seed113/B96/LR3e-5, compiled static loss; no publication. + +## E78 multiscale AR first1000 +- Checkpoint SHA-256: `a3c57dba6318728692a87990bf652a9a8469fa4fb24bf925e79a6f72510936d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.617778062820435 seconds. +- Overall skill 0.377072; relative MASE 0.744319; relative WQL 0.521335. +- term skill: long=0.3993, medium=0.4061, short=0.3568. +- domain skill: Econ/Fin=0.1341, Energy=0.2362, Healthcare=0.4612, Nature=0.4310, Sales=0.3345, Transport=0.4671, Web/CloudOps=0.4985. +- frequency skill: A=0.3662, D=0.3563, H=0.3950, M=0.1046, Q=0.1987, S=0.4232, T=0.4355, W=0.2248. +- variates skill: multivariate=0.3928, univariate=0.3643. +- Outcome: Main0.377071682 is effectively tied with E77 single slowAR1000 at0.377046018 and above E67 original AR1000 at0.376859515. Early checkpoint, continue matched3000/6000/12000. Seed197, extraRNG700200, B64/LR2e-5, unchanged corpus and main/horizon RNG. + +## E84 daily and weekly aggregation of permitted real series +Hypothesis: the original two/four-fold aggregation rarely exposes coarse energy and other dynamics. On20% of real rows, independently consider a daily or weekly block average of the same allowed series at the original cutoff. Only exact integral frequency ratios are used; require8 context blocks and1 future block. Select equally among eligible daily/weekly choices. Finite-value averages use float64 sums and disjoint past/future blocks. Context and target can be shorter than requested and remain masked; periods become[7,365] or[52,1]. All original sampling/random draws and original local synthetic windows remain unchanged; extra RNGseed900200. Planned own E62 initialization, seed197, paired B64, LR2e-5/12000steps match E67. This tests coarser real-series augmentation, not additional external data. Queue after E77 to stay within one H100. +Training-only fixture: {"seed": 197, "aggregation_seed": 900200, "diagnostic_shapes_seed": 331, "cpu_seconds": 3.8464299628976732, "rows": 4096, "aggregated_rows": 459, "main_and_horizon_rng_matched": true, "nonaggregated_rows_bitwise_equal": true, "changing_future_does_not_change_context": true, "before_period_counts": {"(24, 168)": 932, "(1440, 10080)": 160, "(288, 2016)": 805, "(12, 1)": 214, "(48, 336)": 249, "(4, 1)": 235, "(7, 365)": 513, "(96, 672)": 244, "(52, 1)": 148, "(144, 1008)": 149, "(2, 91)": 5, "(1, 1)": 153, "(900, 21600)": 23, "(360, 8640)": 73, "(4, 28)": 54, "(12, 84)": 30, "(720, 5040)": 14, "(6, 42)": 24, "(360, 2520)": 7, "(450, 10800)": 3, "(72, 504)": 51, "(4, 182)": 6, "(36, 252)": 3, "(1, 7)": 1}, "after_period_counts": {"(52, 1)": 352, "(1440, 10080)": 131, "(288, 2016)": 692, "(12, 1)": 214, "(48, 336)": 231, "(4, 1)": 235, "(7, 365)": 704, "(96, 672)": 223, "(24, 168)": 778, "(1, 1)": 153, "(900, 21600)": 23, "(360, 8640)": 73, "(144, 1008)": 133, "(4, 28)": 38, "(12, 84)": 26, "(720, 5040)": 10, "(360, 2520)": 6, "(450, 10800)": 3, "(72, 504)": 41, "(2, 91)": 3, "(4, 182)": 6, "(36, 252)": 3, "(6, 42)": 17, "(1, 7)": 1}, "factor_counts": {"168": 73, "288": 97, "2016": 37, "7": 66, "1440": 26, "24": 90, "48": 14, "96": 20, "28": 12, "144": 4, "336": 6, "4": 4, "10080": 8, "1008": 1, "672": 1}, "aggregated_context_percentiles": [8.0, 48.0, 4096.0], "aggregated_target_percentiles": [1.0, 60.0, 1024.0], "optimizer_updates": 0} + +## E71 patch8 at6000 +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.29093050956726 seconds. +- Overall skill 0.381179; relative MASE 0.741215; relative WQL 0.516638. +- term skill: long=0.4036, medium=0.4049, short=0.3630. +- domain skill: Econ/Fin=0.1328, Energy=0.2446, Healthcare=0.4760, Nature=0.4387, Sales=0.3481, Transport=0.4598, Web/CloudOps=0.5005. +- frequency skill: A=0.3764, D=0.3587, H=0.3961, M=0.1191, Q=0.1895, S=0.4235, T=0.4409, W=0.2396. +- variates skill: multivariate=0.3970, univariate=0.3683. +- Outcome: Main0.381178739 exceeds matched E67paired6000 0.378455389 and selected E83main0.380250568. Test all three earlier cutoffs and full public replay before publication. Architecture change only; seed197/B64/LR2e-5; checkpoints resumed with full optimizer and RNG state. + +## E77 paired slowAR at3000 +- Checkpoint SHA-256: `0691cb2a1f55203c949dcdd159bc9da17d56a3cccbba57fa2c61a9f74b769376`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.542114734649658 seconds. +- Overall skill 0.378238; relative MASE 0.743200; relative WQL 0.520166. +- term skill: long=0.4019, medium=0.4056, short=0.3580. +- domain skill: Econ/Fin=0.1408, Energy=0.2382, Healthcare=0.4444, Nature=0.4319, Sales=0.3325, Transport=0.4662, Web/CloudOps=0.5040. +- frequency skill: A=0.3686, D=0.3549, H=0.3971, M=0.0926, Q=0.1967, S=0.4234, T=0.4392, W=0.2222. +- variates skill: multivariate=0.3972, univariate=0.3627. +- Outcome: Main0.378238485 is slightly below original E67paired3000 0.378318033; continue planned6000 before choosing. Seed197/B64/LR2e-5, main and requested-horizon sampling matched. + +## E85 transfer the slow-AR correction to the finer-patch model +E71patch8 at6000 improves the main screen and first earlier cutoff. E76 previously showed a matched slow-AR6000 correction improves all four cutoffs on patch16. Test one fixed composition: patch8_6000 + fold16to8(slowAR6000 - partial6000), where the linear fold is exactly E71 initialization: sum projection halves, retain first8 output positions, other tensors unchanged. Confidence parameters remain those of patch8. This is a transfer hypothesis, not exact function preservation. Coefficient1 with no sweep, original inference rules, all four cutoffs before full replay/publication. No new optimizer updates or random draws; original training seeds197 and79. Script patch8_delta/merge.py and all parent hashes retained. + +## E86 learn the added feature stream while freezing inherited parameters — prepared +E73 at4000 underperforms its function-preserving starting model despite using the new stream. Hypothesis: a low-rate update of every parameter disturbs the mature function while learning the random additions too slowly. Reuse exactly E73 independent-stream initialization, but protect all36,800,800 inherited entries and train the109,676,544 new/cross-stream entries atLR2e-4 for8000steps. Original seed113/B96/source/context/horizon/loss unchanged. This changes trainable scope and learning rate together and is a method comparison, not a one-factor causal attribution. Gradient entries for protected blocks are zeroed before clipping; inherited values are restored after AdamW to cancel its weight decay. References reconstruct from the saved checkpoint on resume. All outputs still come from one146M model; inference has no adaptation or freezing machinery. Await E73next8000 before allocation. +Fixture on6 allowed-corpus windows, discarded copy only: {"cpu_seconds": 8.51362281711772, "seed": 347, "optimizer_updates_on_discarded_fixture_copy": 3, "allowed_corpus_windows": 6, "protected_parameters": 36800800, "trainable_parameters": 109676544, "all_inherited_parameters_bitwise_equal_to_parent": true, "recovery_reference_reconstruction_equal": true, "new_head_max_change": 0.0006009560311213136, "losses": [0.3154084384441376, 0.5418640375137329, 3.4678804874420166], "selection_checkpoint_written": false} + +## E71 patch8 at6000 first earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 31.848629474639893 seconds. +- Overall skill 0.337263; relative MASE 0.796725; relative WQL 0.551283. +- term skill: long=0.4004, medium=0.3547, short=0.3044. +- domain skill: Econ/Fin=0.1652, Energy=0.2281, Healthcare=0.4272, Nature=0.3699, Sales=0.4068, Transport=0.3692, Web/CloudOps=0.4462. +- frequency skill: A=0.3305, D=0.3545, H=0.3635, M=0.2050, Q=0.2352, S=0.3470, T=0.3351, W=0.2877. +- variates skill: multivariate=0.3553, univariate=0.3226. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 second earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 30.961294412612915 seconds. +- Overall skill 0.360620; relative MASE 0.769294; relative WQL 0.531405. +- term skill: long=0.3643, medium=0.3909, short=0.3471. +- domain skill: Econ/Fin=0.1073, Energy=0.2373, Healthcare=0.3614, Nature=0.4729, Sales=0.5535, Transport=0.4233, Web/CloudOps=0.4312. +- frequency skill: A=0.3265, D=0.4302, H=0.3900, M=0.1513, Q=0.1529, S=0.2830, T=0.3613, W=0.2737. +- variates skill: multivariate=0.3599, univariate=0.3612. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 third earlier +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 30.769143104553223 seconds. +- Overall skill 0.384513; relative MASE 0.743664; relative WQL 0.509403. +- term skill: long=0.3930, medium=0.3668, short=0.3880. +- domain skill: Econ/Fin=0.1775, Energy=0.3064, Healthcare=0.2392, Nature=0.5093, Sales=0.3974, Transport=0.5038, Web/CloudOps=0.3894. +- frequency skill: A=0.3445, D=0.4405, H=0.4005, M=0.1373, Q=0.2471, S=0.2972, T=0.4240, W=0.2382. +- variates skill: multivariate=0.3641, univariate=0.4002. +- Outcome: Earlier skills0.337262777/0.360619944/0.384512704. First two exceed E83 and E76; third regresses materially against both, including E83 0.389069333. Record this temporal tradeoff. Full primary validation0.377160271 exceeds E83 0.376130733. + +## E71 patch8 at6000 full public-package replay +- Checkpoint SHA-256: `308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.377160; relative MASE 0.744341; relative WQL 0.521172. +- term skill: long=0.3977, medium=0.4038, short=0.3585. +- domain skill: Econ/Fin=0.1125, Energy=0.2381, Healthcare=0.4791, Nature=0.4387, Sales=0.3613, Transport=0.4600, Web/CloudOps=0.4920. +- frequency skill: A=0.2981, D=0.3626, H=0.3904, M=0.1423, Q=0.1804, S=0.4235, T=0.4341, W=0.2328. +- variates skill: multivariate=0.3923, univariate=0.3649. +- Outcome: Publish strongest full primary candidate: skill0.377160271, relMASE0.744340532 and relWQL0.521171845; 97 configurations/151170 instances and zero failures. Inference149.631765s under shared H100; relocation14.860671s, three configurations bitwise equal, finite and ordered. Earlier cutoffs1/2 improve but cutoff3 falls to0.384512704 from E83 0.389069333. This selection is based on primary full validation, with a material earlier-window tradeoff. Seed197/B64/LR2e-5; model36,665,488 parameters. Training continues to12000; E85slowAR transfer currently lowers main skill. + +E71 descriptive full comparison: {"candidate": "/workspace/research/valid-report-patch8-6k.json", "parent": "/workspace/research/valid-report-postloss-slow-ar.json", "candidate_hash": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "parent_hash": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "skill_difference": 0.001029538022933929, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 51, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": -0.0037342410536253257, "p50": 0.0011012262742491896, "p975": 0.005930261648940039}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E87 equal ensemble of postloss+slowAR and patch8_6000 +E71 improves full and first two earlier scores but regresses on the third. Its per-configuration differences against E83 run in both directions. Test a single predeclared equal average of their final quantiles, every member on every instance, to reduce these disagreements. No coefficient sweep or per-dataset rules; no additional training. Screen all four cutoffs with cached forecasts, then require a complete public-package replay if promising. Member hashes0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49 and308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988. + +E87 cached valid_screen: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.38368555666405846, "rel_mase_gmean": 0.7380746260326486, "rel_wql_gmean": 0.5146410398989778, "groups": {"term": {"short": 0.36538266249250273, "medium": 0.4082837973759923, "long": 0.4054283252594051}, "domain": {"Econ/Fin": 0.13784772212566998, "Energy": 0.24686600590076013, "Healthcare": 0.4744445530216731, "Nature": 0.43858582844670857, "Sales": 0.34499044135263635, "Transport": 0.4641713711179224, "Web/CloudOps": 0.504852655777996}, "freq": {"A-DEC": 0.37872174128763647, "Q-DEC": 0.19576783224250183, "M": 0.10352329460914667, "W-SUN": 0.0815487165237122, "D": 0.3619759620437517, "H": 0.40136898241411867, "15T": 0.21618729924976976, "W-FRI": 0.0005727425187482815, "10T": 0.6270627319464949, "W-TUE": 0.6195479435809044, "W-THU": 0.20656160899192244, "W-WED": 0.3284622519828829, "5T": 0.5178170596317864, "10S": 0.4250896621077831}}, "cpu_seconds": 0.8467225290369242, "members": ["/workspace/research/evals/postloss_slow_ar_delta6k", "/workspace/research/evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.33897078175106665, "rel_mase_gmean": 0.7947425391953629, "rel_wql_gmean": 0.549812808335635, "groups": {"term": {"short": 0.30566345086890123, "medium": 0.3596853813715456, "long": 0.4000253823922667}, "domain": {"Econ/Fin": 0.16860733481230095, "Energy": 0.23127409233361262, "Healthcare": 0.41508771848830917, "Nature": 0.3697364579642294, "Sales": 0.40314036211800997, "Transport": 0.3731226096810256, "Web/CloudOps": 0.44992972632456585}, "freq": {"A-DEC": 0.32848231511958337, "Q-DEC": 0.23562309290129158, "M": 0.19041732638938724, "W-SUN": 0.025351943698138202, "D": 0.3534437856481293, "H": 0.3688302027123801, "15T": 0.22312808413257845, "W-FRI": 0.2396493514491056, "10T": 0.3237622247956604, "W-TUE": 0.5543034150109358, "W-THU": 0.2604484095221261, "W-WED": 0.35736004737028026, "5T": 0.4409641017446271, "10S": 0.3450492950879055}}, "cpu_seconds": 0.7932982260826975, "members": ["/workspace/research/backcast_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast_evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast2: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.36315845377936284, "rel_mase_gmean": 0.7669826024462578, "rel_wql_gmean": 0.5287827307935709, "groups": {"term": {"short": 0.3500710560941004, "medium": 0.39152062222827344, "long": 0.36789234736191556}, "domain": {"Econ/Fin": 0.11764473029610945, "Energy": 0.2411172995160572, "Healthcare": 0.3456990033484809, "Nature": 0.4766227701429041, "Sales": 0.5542499449658524, "Transport": 0.4240681895536792, "Web/CloudOps": 0.43520532523252287}, "freq": {"A-DEC": 0.3426922609629939, "Q-DEC": 0.15231664461723582, "M": 0.15186824306557356, "W-SUN": 0.05088825731569291, "D": 0.4296455306851713, "H": 0.39379373998466227, "15T": 0.10856607437428756, "W-FRI": 0.14720063917754334, "10T": 0.5085351252790775, "W-TUE": 0.07220161720253104, "W-THU": 0.3450882445488662, "W-WED": 0.5601701661454508, "5T": 0.47180636145224786, "10S": 0.2848018841721206}}, "cpu_seconds": 0.8004084089770913, "members": ["/workspace/research/backcast2_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast2_evals/patch8_ema6000"], "selection_only": true} + +E87 cached valid_backcast3: {"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3893067316884232, "rel_mase_gmean": 0.7388677045007551, "rel_wql_gmean": 0.5047537816165226, "groups": {"term": {"short": 0.3954965650939142, "medium": 0.3665319698411411, "long": 0.3951340525388045}, "domain": {"Econ/Fin": 0.18260879016430553, "Energy": 0.31821834617690903, "Healthcare": 0.23007490883688486, "Nature": 0.5085775372702099, "Sales": 0.40095301819850215, "Transport": 0.5083874509785007, "Web/CloudOps": 0.39193111101214995}, "freq": {"A-DEC": 0.3560016768547195, "Q-DEC": 0.2553722438340734, "M": 0.12861913252670398, "W-SUN": 0.15123578049216402, "D": 0.44398634475249976, "H": 0.40571804459976457, "15T": 0.25382261362712966, "W-FRI": 0.03470000993227129, "10T": 0.6063950584074473, "W-TUE": 0.24994144625076442, "W-THU": 0.35649129369337096, "W-WED": 0.3788996637883131, "5T": 0.4648714119960353, "10S": 0.2886025572123534}}, "cpu_seconds": 0.7890921849757433, "members": ["/workspace/research/backcast3_evals/postloss_slow_ar_delta6k", "/workspace/research/backcast3_evals/patch8_ema6000"], "selection_only": true} + +E87 cached equal ensemble improves all four cutoffs over both members:0.383686/0.338971/0.363158/0.389307. Assemble exact per-member model code and start full public-package validation. No coefficient search or new optimization. + +## E88 matched late slow-AR continuation of patch8 — prepared +E71patch8 improves primary validation, while mapping the E61slowAR weight correction onto it lowers the main screen. Test direct training instead: preserve E71 complete model/EMA/AdamW/RNG/prefetched-batch state exactly at8000, then continue to12000 with only the synthetic AR coefficient law changed fromU(.2,.995) toexp(-10**(-U(0,4))). Reuse the already verified E77 data implementation and E71 model. All corpus windows, signs, horizon prefixes, batch64, seed197, original LR2e-5 cosine schedule and optimizer state stay matched. The saved prefetched batch is consumed once unchanged, so the changed generator starts with the following batch. No new random initialization, external data or validation training. Queue after E69 volatility releases its memory. Compare the unchanged E71 final12000 and the candidate; screen9000/12000 and earlier cutoffs for promising results. + +## E85 patch8 slowAR correction evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 32.3618426322937 seconds. +- Overall skill 0.379635; relative MASE 0.743623; relative WQL 0.517537. +- term skill: long=0.4040, medium=0.4057, short=0.3597. +- domain skill: Econ/Fin=0.1422, Energy=0.2420, Healthcare=0.4441, Nature=0.4393, Sales=0.3494, Transport=0.4592, Web/CloudOps=0.5028. +- frequency skill: A=0.3775, D=0.3606, H=0.3953, M=0.0567, Q=0.1914, S=0.4261, T=0.4427, W=0.2368. +- variates skill: multivariate=0.3979, univariate=0.3647. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 32.34789538383484 seconds. +- Overall skill 0.339493; relative MASE 0.792721; relative WQL 0.550345. +- term skill: long=0.4006, medium=0.3577, short=0.3072. +- domain skill: Econ/Fin=0.1745, Energy=0.2254, Healthcare=0.4254, Nature=0.3780, Sales=0.4071, Transport=0.3673, Web/CloudOps=0.4527. +- frequency skill: A=0.3339, D=0.3537, H=0.3634, M=0.2145, Q=0.2368, S=0.3480, T=0.3408, W=0.2893. +- variates skill: multivariate=0.3590, univariate=0.3235. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast2_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 31.240530729293823 seconds. +- Overall skill 0.363604; relative MASE 0.765287; relative WQL 0.529214. +- term skill: long=0.3689, medium=0.3919, short=0.3503. +- domain skill: Econ/Fin=0.1175, Energy=0.2366, Healthcare=0.3619, Nature=0.4770, Sales=0.5513, Transport=0.4209, Web/CloudOps=0.4416. +- frequency skill: A=0.3278, D=0.4365, H=0.3885, M=0.1369, Q=0.1530, S=0.2924, T=0.3673, W=0.2792. +- variates skill: multivariate=0.3657, univariate=0.3619. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E85 patch8 slowAR correction backcast3_evals +- Checkpoint SHA-256: `7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 30.950783491134644 seconds. +- Overall skill 0.384319; relative MASE 0.743701; relative WQL 0.509698. +- term skill: long=0.3926, medium=0.3666, short=0.3878. +- domain skill: Econ/Fin=0.1844, Energy=0.3057, Healthcare=0.2112, Nature=0.5108, Sales=0.3977, Transport=0.5024, Web/CloudOps=0.3936. +- frequency skill: A=0.3446, D=0.4387, H=0.3996, M=0.1104, Q=0.2522, S=0.2976, T=0.4263, W=0.2439. +- variates skill: multivariate=0.3656, univariate=0.3987. +- Outcome: Reject for primary selection: patch8 slowAR transfer main0.379634840 is below patch8 parent0.381178739; earlier1/2 improve to0.339492623/0.363603669, but earlier3 slightly regresses to0.384319115 versus0.384512704. This transfer trades main performance for earlier1/2 and does not dominate. No full replay; E88 tests direct training on slowAR instead. Fixed coefficient1, CPU composition1.039392s, no optimization. + +## E69 stochastic volatility first3000 +- Checkpoint SHA-256: `f68cd2d694ecf03ff038c6a2f49657eb2f211f213d68c7dec3ed5cc0c5592c5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.498825311660767 seconds. +- Overall skill 0.359482; relative MASE 0.763227; relative WQL 0.537539. +- term skill: long=0.3909, medium=0.4022, short=0.3296. +- domain skill: Econ/Fin=0.1126, Energy=0.1841, Healthcare=0.4243, Nature=0.4229, Sales=0.3462, Transport=0.4587, Web/CloudOps=0.5052. +- frequency skill: A=0.3751, D=0.3459, H=0.3825, M=0.1061, Q=0.1992, S=0.4403, T=0.3990, W=0.2102. +- variates skill: multivariate=0.3912, univariate=0.3331. +- Outcome: Main0.359481571 exceeds matched E42partial3000 0.358812323, while E61slowAR3000 was0.360587999. Continue6000 to assess persistence before transfer or earlier-window selection. Seed79/B256/LR5e-5, independent generatorRNG500082, same real windows. + +## E78 multiscale AR at3000 +- Checkpoint SHA-256: `185d1a3d5d32a3cad539fb3a83bf98ae06a56606a35bafaf8deecd75c8b496d1`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.39926815032959 seconds. +- Overall skill 0.378048; relative MASE 0.743609; relative WQL 0.520198. +- term skill: long=0.4028, medium=0.4059, short=0.3572. +- domain skill: Econ/Fin=0.1377, Energy=0.2383, Healthcare=0.4460, Nature=0.4316, Sales=0.3318, Transport=0.4664, Web/CloudOps=0.5035. +- frequency skill: A=0.3675, D=0.3526, H=0.3972, M=0.1004, Q=0.1981, S=0.4242, T=0.4386, W=0.2228. +- variates skill: multivariate=0.3966, univariate=0.3629. +- Outcome: Main0.378048480 is slightly below E77single slowAR3000 0.378238485 and E67original AR3000 0.378318033. Continue planned6000; no publication or evidence of a gain yet. Seed197/B64/LR2e-5, extraRNG700200, main/horizon draws matched. + +E85 exact composition receipt: { + "method": "matched training delta with fixed linear patch conversion", + "formula": "patch8_base + fold16to8(slowAR6000 - partial6000)", + "coefficient": 1.0, + "mapping": "sum input/query/recency halves; take first8 output positions; other tensors unchanged", + "exact_function_preservation": false, + "parent_hashes": { + "/workspace/research/runs/patch8/ema006000.pt": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0393919900525361, + "checkpoint_sha256": "7047bf350ed55e595b47c5f8e0b1712429d049d00967b5b126d1cd039b1c7ba4", + "optimizer_updates": 0 +} + +Measured checkpoint compute through current selection milestones: +```json +{ + "E71 patch8 selected6000": { + "phase_log": "patch8_recovery3.log", + "checkpoint_loop_record": { + "step": 6000, + "loss": 0.27341755777597426, + "seconds": 1302.8, + "lr": 1.2000000000000002e-05, + "grad_norm": 0.12276209145784378, + "context": 2048, + "horizon": 512 + }, + "prior_interrupted_logged_seconds": { + "initial_unsaved_attempt": 63.0, + "recovery2_last_logged2700_resumed_from2000": 770.0 + }, + "total_logged_process_loop_seconds_including_repeated_work": 2135.8 + }, + "E58 recoveredwide24000": { + "phase_log": "wide_capacity_146m_recovery_recovery3.log", + "checkpoint_loop_record": { + "step": 24000, + "loss": 0.3451157429814339, + "seconds": 1117.3, + "lr": 9.51471862576143e-06, + "grad_norm": 0.31578314304351807, + "context": 2048, + "horizon": 1024 + } + }, + "E73 graft4000": { + "phase_log": "wide_graft_recovery3.log", + "checkpoint_loop_record": { + "step": 4000, + "loss": 0.34949749410152436, + "seconds": 1146.4, + "lr": 2.908655439013544e-05, + "grad_norm": 0.47331908345222473, + "context": 1024, + "horizon": 1024 + } + }, + "E69 volatility3000": { + "phase_log": "volatility_synth_recovery3.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.33109228551387787, + "seconds": 977.8, + "lr": 4.4142135623730954e-05, + "grad_norm": 0.13540834188461304, + "context": 2048, + "horizon": 1024 + } + }, + "E77 pairedslowAR3000": { + "phase_log": "paired_long_memory_recovery3.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.31684702143073085, + "seconds": 624.8, + "lr": 1.765685424949238e-05, + "grad_norm": 1.3133997917175293, + "context": 2048, + "horizon": 1024 + } + }, + "E78 multiscale3000": { + "phase_log": "multiscale_ar_train.log", + "checkpoint_loop_record": { + "step": 3000, + "loss": 0.3144953328371048, + "seconds": 637.3, + "lr": 1.765685424949238e-05, + "grad_norm": 1.2501322031021118, + "context": 2048, + "horizon": 1024 + } + }, + "note": "These are concurrent training-process loop measurements on the one H100, not exclusive GPU seconds. Prefix records exclude startup and may exclude unlogged tails before operator interruption. Earlier parent training is recorded separately in the lineage experiments." +} +``` + +E88 launcher correction: naming the launcher queue.py shadowed Python standard-library queue during Torch import, causing a circular-import failure before snapshotting or training. Renamed it launch.py and restarted while E71recovery8000 was still present. Also renamed the E84launcher to avoid the same import hazard in future sampler checks. Existing E84 queued process is unchanged. No optimizer updates or validation results were affected. + +E88 preserved complete exact8000 state: { + "snapshot": "/workspace/research/patch8_recovery008000.pt", + "step": 8000, + "sha256": "2fa4b6f18df4a5f2eed7e1bc153f8f5e3755584305569db42e047f3b1312f5d5", + "snapshot_process_seconds_including_wait": 2.3576558139175177, + "prefetched_batch_preserved": true +} + +## E87 equal patch16/patch8 ensemble complete public-package replay +- Checkpoint SHA-256: `65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.379630; relative MASE 0.741025; relative WQL 0.519360. +- term skill: long=0.3995, medium=0.4072, short=0.3609. +- domain skill: Econ/Fin=0.1168, Energy=0.2399, Healthcare=0.4788, Nature=0.4386, Sales=0.3583, Transport=0.4643, Web/CloudOps=0.4967. +- frequency skill: A=0.2977, D=0.3660, H=0.3960, M=0.1275, Q=0.1843, S=0.4251, T=0.4366, W=0.2280. +- variates skill: multivariate=0.3954, univariate=0.3668. +- Outcome: Publish strongest replayable candidate: full skill0.379629893, relMASE0.741025239, relWQL0.519360272; 97 configurations/151170 instances, zero failures. Both members forecast every instance with fixed .5/.5 weights, total73,466,288 parameters. Full inference229.446591s on the shared H100, relocation22.524727s with bitwise-equal finite ordered forecasts on3 examples. Actual package quantiles are bitwise equal to the independent member average on electricity hourly short, solar minute short and ETT2hourly long. Cached diagnostic skill0.383685557/0.338970782/0.363158454/0.389306732 exceeds each member at all four cutoffs. No additional training or coefficient sweep; member training seeds/compute recorded above. + +E87 composition verification: { + "cpu_seconds": 0.016339811962097883, + "comparisons": [ + { + "config_id": "electricity__H__short", + "shape": [ + 370, + 1, + 9, + 48 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + }, + { + "config_id": "solar__T__short", + "shape": [ + 137, + 1, + 9, + 48 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + }, + { + "config_id": "ett2__H__long", + "shape": [ + 1, + 7, + 9, + 720 + ], + "bitwise_equal_to_fixed_member_average": true, + "max_abs_difference": 0.0, + "max_scaled_difference": 0.0 + } + ], + "no_new_inference_or_training": true +} + +E87 descriptive cluster comparison: {"candidate": "/workspace/research/valid-report-mixed-patch-ensemble.json", "parent": "/workspace/research/valid-report-patch8-6k.json", "candidate_hash": "65e5698c0ee4fe1e9ae0607db6ef56c573aa4b82ec009b63ea1a861e4aec741d", "parent_hash": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "skill_difference": 0.002469622689308837, "n_configs": 97, "n_dataset_clusters": 28, "improved_configs": 53, "bootstrap_seed": 317, "bootstrap_samples": 5000, "dataset_cluster_delta_percentiles": {"p025": 0.0003627411169234291, "p50": 0.002411418344102745, "p975": 0.004671754347801495}, "note": "Descriptive resampling only. Adaptive validation selection and reused windows prevent treating this as a held-out significance test."} + +## E77 paired slowAR at6000 +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.37148094177246 seconds. +- Overall skill 0.378677; relative MASE 0.743065; relative WQL 0.519526. +- term skill: long=0.4020, medium=0.4060, short=0.3586. +- domain skill: Econ/Fin=0.1354, Energy=0.2384, Healthcare=0.4567, Nature=0.4305, Sales=0.3378, Transport=0.4664, Web/CloudOps=0.5036. +- frequency skill: A=0.3690, D=0.3556, H=0.3958, M=0.1000, Q=0.1944, S=0.4250, T=0.4395, W=0.2269. +- variates skill: multivariate=0.3981, univariate=0.3628. +- Outcome: Main0.378677489 modestly exceeds matched E67paired6000 0.378455389, after3000 was slightly behind. Continue planned12000 and check three earlier cutoffs; this remains below selected individual E71 and ensemble E87. Seed197/B64/LR2e-5, same real-window and requested-horizon RNG. + +## E73 independent stream at8000, prune continuation +- Checkpoint SHA-256: `c75d9f9ceae94e22370c2cc8ce4aac6ca83f5474d32e9ca3c571d5aa381d8d4a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.07528495788574 seconds. +- Overall skill 0.373597; relative MASE 0.747769; relative WQL 0.524735. +- term skill: long=0.3982, medium=0.4061, short=0.3509. +- domain skill: Econ/Fin=0.1426, Energy=0.2349, Healthcare=0.4024, Nature=0.4298, Sales=0.3401, Transport=0.4643, Web/CloudOps=0.4998. +- frequency skill: A=0.3809, D=0.3443, H=0.3950, M=0.0990, Q=0.2037, S=0.4221, T=0.4345, W=0.2060. +- variates skill: multivariate=0.3921, univariate=0.3585. +- Outcome: Main0.373596872 recovers from4000 0.372084568 but remains below its function-preserving start0.375792503 and matched original-width parent. Prune after this second negative checkpoint to prioritize E86 frozen-inherited higher-rate training; this does not establish that further E73 training could never recover. Checkpoint8000 training loop2058.7s this recovery plus722.7s logged in the prior interrupted attempt; complete stop receipt follows. Seed113/B96/LR3e-5, compiled static loss; resetseed179 occurred at8001 while waiting for evaluation. + +E86 frozen inherited stream seed113 training started at 2026-10-23T03:23:23Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E73 stop receipt: {"experiment": "E73 stopped after negative8000", "final_loop": {"completed_step": 8683, "training_process_loop_seconds": 2219.4671748820692}, "checkpoint": "/workspace/research/runs/wide_graft/ema008683.pt", "sha256": "36c21e4662c5c6e07cd3c2a34ecba515bc986d29deaef5e1856e6950c30e7db7", "complete_recovery": "/workspace/research/runs/wide_graft/recovery.pt"} + +## E77 paired slowAR6000 backcast_evals +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 24.434251308441162 seconds. +- Overall skill 0.337098; relative MASE 0.795494; relative WQL 0.552410. +- term skill: long=0.3992, medium=0.3581, short=0.3032. +- domain skill: Econ/Fin=0.1599, Energy=0.2277, Healthcare=0.4115, Nature=0.3693, Sales=0.3963, Transport=0.3724, Web/CloudOps=0.4511. +- frequency skill: A=0.3147, D=0.3511, H=0.3673, M=0.1858, Q=0.2368, S=0.3433, T=0.3357, W=0.2891. +- variates skill: multivariate=0.3547, univariate=0.3227. +- Outcome: Earlier0.337098369/0.360407088/0.389754840 each exceeds matched E67paired6000 0.335118632/0.359446144/0.389533029, with main0.378677489 also above0.378455389. Supports slower synthetic AR dynamics in the actual paired objective. Continue12000 and queued E88 patch8 continuation; selected E87ensemble remains stronger on primary validation. + +## E77 paired slowAR6000 backcast2_evals +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 23.03375768661499 seconds. +- Overall skill 0.360407; relative MASE 0.768163; relative WQL 0.532542. +- term skill: long=0.3654, medium=0.3912, short=0.3462. +- domain skill: Econ/Fin=0.1057, Energy=0.2366, Healthcare=0.3597, Nature=0.4721, Sales=0.5486, Transport=0.4198, Web/CloudOps=0.4360. +- frequency skill: A=0.3457, D=0.4251, H=0.3918, M=0.1564, Q=0.1512, S=0.2811, T=0.3637, W=0.2618. +- variates skill: multivariate=0.3657, univariate=0.3561. +- Outcome: Earlier0.337098369/0.360407088/0.389754840 each exceeds matched E67paired6000 0.335118632/0.359446144/0.389533029, with main0.378677489 also above0.378455389. Supports slower synthetic AR dynamics in the actual paired objective. Continue12000 and queued E88 patch8 continuation; selected E87ensemble remains stronger on primary validation. + +## E77 paired slowAR6000 backcast3_evals +- Checkpoint SHA-256: `d471571ef423a63db1ab1b70922d691c31df6099238b1d2e53cb0b48b343a353`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 21.342447519302368 seconds. +- Overall skill 0.389755; relative MASE 0.736028; relative WQL 0.505958. +- term skill: long=0.3958, medium=0.3615, short=0.3978. +- domain skill: Econ/Fin=0.1734, Energy=0.3172, Healthcare=0.2610, Nature=0.5086, Sales=0.3982, Transport=0.5051, Web/CloudOps=0.3947. +- frequency skill: A=0.3572, D=0.4437, H=0.4041, M=0.1316, Q=0.2594, S=0.2895, T=0.4297, W=0.2664. +- variates skill: multivariate=0.3731, univariate=0.4026. +- Outcome: Earlier0.337098369/0.360407088/0.389754840 each exceeds matched E67paired6000 0.335118632/0.359446144/0.389533029, with main0.378677489 also above0.378455389. Supports slower synthetic AR dynamics in the actual paired objective. Continue12000 and queued E88 patch8 continuation; selected E87ensemble remains stronger on primary validation. + +## E89 matched patch4 versus patch8 continuation — prepared +E71 finer patches improved primary full validation. Test another halving of patch length. Both arms initialize from own E71EMA6000, with candidate applying the same fixed linear fold8to4 and first4 output rows. Positions preserve physical time units. Candidate starts functionally different, so record its zero-step screen. Width512/heads8/6encoder/4decoder/context4096/horizon1024 unchanged. New matched sampling seed401, B32 distinct/64signed, paired loss, LR2e-5/12000steps and fresh AdamW/EMA. Both use original synthetic generator and the same source and horizon-prefix streams; horizon truncation remains rounded16 in both to isolate model patch length. Candidate versus control changes patch length, while comparisons against E71 are method selections with a new optimizer/batch/seed. Measure maximum-shape memory before queuing both arms after E78 and E86 release their allocations. Screen1000/3000/6000/12000; earlier windows and full package replay for promising candidates. No external data or weights. + +## E89 patch4 zero-step conversion +- Checkpoint SHA-256: `60a834e264452f3acddfdf191115c6af7ce6e972d959909bf701bac5517420ed`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 52.6757493019104 seconds. +- Overall skill 0.370553; relative MASE 0.752738; relative WQL 0.526349. +- term skill: long=0.3989, medium=0.3945, short=0.3498. +- domain skill: Econ/Fin=0.1324, Energy=0.2289, Healthcare=0.4183, Nature=0.4394, Sales=0.3492, Transport=0.4525, Web/CloudOps=0.4931. +- frequency skill: A=0.3342, D=0.3388, H=0.3842, M=0.1611, Q=0.1857, S=0.4158, T=0.4284, W=0.2377. +- variates skill: multivariate=0.3847, univariate=0.3590. +- Outcome: Initial screen0.370553128 is below source E71patch8_6000 0.381178739, as expected from a non-function-preserving patch fold. This is the baseline before new training, not an improvement. Candidate/control maximum-shape checks are finite and fit: reserved11376/6224MiB including EMA and AdamW moment storage. Both B32/seed401 arms are queued after E78 and E86. + +E89 patch4_initial.json: { + "method": "sum input/query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "checkpoint_sha256": "60a834e264452f3acddfdf191115c6af7ce6e972d959909bf701bac5517420ed", + "parameters": 36597832, + "cpu_seconds": 0.6177915919106454, + "optimizer_updates": 0 +} + +E89 patch4_memory_check.json: { + "seed": 401, + "batch": 32, + "signed_rows": 64, + "patch": 4, + "context": 4096, + "horizon": 1024, + "EMA_and_AdamW_moment_storage_present": true, + "optimizer_updates": 0, + "loss": 0.2863434851169586, + "seconds": 10.160149822942913, + "peak_allocated_mib": 10789.2275390625, + "peak_reserved_mib": 11376.0 +} + +E89 patch4_control_memory_check.json: { + "seed": 401, + "batch": 32, + "signed_rows": 64, + "patch": 8, + "context": 4096, + "horizon": 1024, + "EMA_and_AdamW_moment_storage_present": true, + "optimizer_updates": 0, + "loss": 0.30326029658317566, + "seconds": 10.05252459505573, + "peak_allocated_mib": 5778.71923828125, + "peak_reserved_mib": 6224.0 +} + +E89 candidate and control queued after PIDs2497(E78) and3946(E86), with their complete recovery files required; inferred total memory replaces those two allocations while preserving evaluation headroom. + +## E86 protected inherited stream first1000 +- Checkpoint SHA-256: `048d9f14388ad2409cd2a3f0b352d5fc1b8525f2e1e5e196707a36fe84a193bc`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.35012197494507 seconds. +- Overall skill 0.372364; relative MASE 0.749500; relative WQL 0.525586. +- term skill: long=0.3978, medium=0.4046, short=0.3494. +- domain skill: Econ/Fin=0.1443, Energy=0.2339, Healthcare=0.4085, Nature=0.4257, Sales=0.3367, Transport=0.4639, Web/CloudOps=0.4980. +- frequency skill: A=0.3876, D=0.3511, H=0.3944, M=0.0661, Q=0.1958, S=0.4208, T=0.4323, W=0.2051. +- variates skill: multivariate=0.3906, univariate=0.3575. +- Outcome: Main0.372363971 is below own initialization0.375792503. Higher-rate added/cross-stream learning still changes predictions despite protecting inherited tensors. Continue predeclared3000 comparison before deciding. Seed113/B96/LR2e-4, compiled loss, 36,800,800 inherited parameters protected and109,676,544 new/cross-stream parameters train. + +## E78 multiscale AR at6000 +- Checkpoint SHA-256: `d517ab35a8bdaeb1b0d14d4fb1879a984cedec0663bc09e3a602497facbcf473`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 21.888899564743042 seconds. +- Overall skill 0.378668; relative MASE 0.743166; relative WQL 0.519472. +- term skill: long=0.4027, medium=0.4063, short=0.3582. +- domain skill: Econ/Fin=0.1300, Energy=0.2384, Healthcare=0.4669, Nature=0.4301, Sales=0.3370, Transport=0.4663, Web/CloudOps=0.5026. +- frequency skill: A=0.3680, D=0.3559, H=0.3959, M=0.1037, Q=0.1941, S=0.4255, T=0.4387, W=0.2279. +- variates skill: multivariate=0.3972, univariate=0.3635. +- Outcome: Main0.378667589 is effectively tied with E77single slowAR6000 0.378677489; both slightly exceed original E67paired6000 0.378455389. No demonstrated gain from adding AR components. Continue planned12000 endpoint; no publication. + +## E69 stochastic volatility at6000 +- Checkpoint SHA-256: `1161e76a6d17ace780f0bf63d6961a2ea28a4036ee5a29ee78b9e9897e7661ee`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.00778031349182 seconds. +- Overall skill 0.359792; relative MASE 0.762404; relative WQL 0.537598. +- term skill: long=0.3895, medium=0.4029, short=0.3305. +- domain skill: Econ/Fin=0.1133, Energy=0.1860, Healthcare=0.4240, Nature=0.4263, Sales=0.3419, Transport=0.4578, Web/CloudOps=0.5034. +- frequency skill: A=0.3769, D=0.3446, H=0.3811, M=0.1104, Q=0.1982, S=0.4402, T=0.4011, W=0.2124. +- variates skill: multivariate=0.3908, univariate=0.3340. +- Outcome: Main0.359791528 exceeds matched E42partial6000 0.359221833; E61slowAR6000 remains stronger at0.361281186. Check the first two earlier cutoffs to decide whether the volatility gain generalizes. Seed79/B256/LR5e-5, extraRNG500082; full continuation is planned12000. + +E86 actual GPU-trained EMA1000 preservation audit: { + "checkpoint": "/workspace/research/runs/wide_graft_frozen/ema001000.pt", + "step": 1000, + "cpu_seconds": 1.7478242949582636, + "inherited_parameters": 36800800, + "inherited_bitwise_equal_to_E47": true, + "changed_added_or_cross_stream_parameters": 109676526, + "optimizer_updates": 0 +} + +## E69 volatility6000 backcast_evals +- Checkpoint SHA-256: `1161e76a6d17ace780f0bf63d6961a2ea28a4036ee5a29ee78b9e9897e7661ee`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.790717124938965 seconds. +- Overall skill 0.330896; relative MASE 0.805425; relative WQL 0.555856. +- term skill: long=0.3909, medium=0.3566, short=0.2960. +- domain skill: Econ/Fin=0.1469, Energy=0.2301, Healthcare=0.4125, Nature=0.3497, Sales=0.3988, Transport=0.3637, Web/CloudOps=0.4436. +- frequency skill: A=0.3198, D=0.3550, H=0.3590, M=0.1648, Q=0.2278, S=0.3421, T=0.3294, W=0.2744. +- variates skill: multivariate=0.3479, univariate=0.3170. +- Outcome: Main0.359791528 and earlier1 0.330895782 improve matched E42partial6000 0.359221833/0.330299984; earlier2 0.352505400 is below control0.352900879. Mixed temporal evidence, so no transfer or publication. Finish predeclared12000 before deciding; E88 remains queued after this allocation. + +## E69 volatility6000 backcast2_evals +- Checkpoint SHA-256: `1161e76a6d17ace780f0bf63d6961a2ea28a4036ee5a29ee78b9e9897e7661ee`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 22.497740983963013 seconds. +- Overall skill 0.352505; relative MASE 0.776021; relative WQL 0.540255. +- term skill: long=0.3678, medium=0.3769, short=0.3372. +- domain skill: Econ/Fin=0.0890, Energy=0.2282, Healthcare=0.3738, Nature=0.4582, Sales=0.5585, Transport=0.4133, Web/CloudOps=0.4263. +- frequency skill: A=0.3446, D=0.4275, H=0.3868, M=0.1756, Q=0.1499, S=0.2802, T=0.3442, W=0.2458. +- variates skill: multivariate=0.3580, univariate=0.3481. +- Outcome: Main0.359791528 and earlier1 0.330895782 improve matched E42partial6000 0.359221833/0.330299984; earlier2 0.352505400 is below control0.352900879. Mixed temporal evidence, so no transfer or publication. Finish predeclared12000 before deciding; E88 remains queued after this allocation. + +## E86 protected inherited stream at3000 +- Checkpoint SHA-256: `45ac18a80765f03bca329ccef8d4c81f39fae8cb3f555e4e261b9a38c5fd253f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.0149462223053 seconds. +- Overall skill 0.373573; relative MASE 0.748714; relative WQL 0.524113. +- term skill: long=0.3985, medium=0.4063, short=0.3506. +- domain skill: Econ/Fin=0.1401, Energy=0.2337, Healthcare=0.4215, Nature=0.4251, Sales=0.3422, Transport=0.4636, Web/CloudOps=0.5006. +- frequency skill: A=0.3797, D=0.3460, H=0.3949, M=0.0960, Q=0.1979, S=0.4211, T=0.4348, W=0.2041. +- variates skill: multivariate=0.3931, univariate=0.3576. +- Outcome: Main0.373573070 improves from1000 0.372363971 and reaches roughly E73unrestricted8000 0.373596872 in fewer updates, but still trails the starting model0.375792503. Continue planned6000/8000 to test recovery. This compares different trainable scopes and learning rates together. Actual EMA1000 audit showed all36,800,800 inherited entries bitwise unchanged; added connections can still change the inherited stream activations. + +E84 coarse aggregation seed197 training started at 2026-10-23T03:37:37Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E77 paired slowAR final12000 +- Checkpoint SHA-256: `61cdf64f284aaa5bd97be010a29178d8b6dc796af35898d9b0ea2a76dce7dd0e`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.205326557159424 seconds. +- Overall skill 0.377696; relative MASE 0.743749; relative WQL 0.520690. +- term skill: long=0.4033, medium=0.4049, short=0.3568. +- domain skill: Econ/Fin=0.1435, Energy=0.2349, Healthcare=0.4451, Nature=0.4300, Sales=0.3324, Transport=0.4672, Web/CloudOps=0.5053. +- frequency skill: A=0.3634, D=0.3546, H=0.3953, M=0.0987, Q=0.2009, S=0.4254, T=0.4404, W=0.2126. +- variates skill: multivariate=0.3967, univariate=0.3621. +- Outcome: Final main0.377696007 exceeds matched E67paired12000 0.377427077 but is below its own6000 checkpoint0.378677489; retain6000 for the method comparison. Training completed12000 in2453.330776 process-loop seconds on the shared H100, seed197/B64/LR2e-5. E84coarse aggregation started after this trainer exited. No publication against stronger E87ensemble. + +overflow_control seed197 training started at 2026-10-23T03:43:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E90 training loss scale for daily and weekly windows — prepared +The task metadata confirms daily and weekly MASE uses lag1, while the current training weight uses the first modeled seasonal period,7/52. Hypothesis: matching this scale improves coarse-frequency forecasting. Change only the lag used by the context seasonal-MAE loss weight for exact period pairs[7,365] and[52,1] to1; all other periods, weighting formula, forecasts and inference rules remain unchanged. Match E80overflow-only control: own E62 initialization, seed197/B64/paired loss/LR2e-5/12000steps, same original sampler and horizon RNG, verified float64 overflow fallback in both. Compare against E80, not the older normalization implementation. No generator or training source change. Queue after E84 releases its allocation. + +E79 fresh512 seed307 training started at 2026-10-23T03:43:44Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:43:44Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:43:56Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:43:56Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:43:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:43:57Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:10Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:10Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:11Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:11Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:24Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:24Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:25Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:25Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:26Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:28Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:39Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:39Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:41Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:42Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:46Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:46Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:50Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh1024 seed307 training started at 2026-10-23T03:44:51Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:44:51Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E79 startup failure and clean matched restart +{ + "started_utc": "2026-10-23T03:43:44Z", + "cleanup_utc": "2026-10-23T03:47:40.492921+00:00", + "cause": "legacy random_capacity/queue.py shadowed stdlib queue inside compiler workers and launched recursive duplicate E79 trainers; OOM then closed pool errors", + "saved_checkpoints": 0, + "discarded_partial_optimizer_updates": "not recoverable from interleaved/overwritten logs; no model selected", + "established_trainers_affected": false, + "terminated_related_processes": 50, + "remedy": "rename and guard launchers; exclusive output-directory and receipt locks; clean fresh restart", + "numerical_recipe_correction": "both fresh arms now include previously verified float64 statistics fallback only for nonfinite float32 mean/scale; initial weights/seeds/source streams unchanged" +} +The incident interval is wall time on the sole shared H100; duplicate per-process compute cannot be reconstructed exactly because legacy launchers reused log paths. Original failed logs and receipts are retained. No valid E79 checkpoint exists from this attempt. The updated numerical normalization is shared by both fresh widths; width remains the only difference between their recipes. + +E79 corrected-normalization fixture: {"normalization_overflow_fallback": true, "width": 512, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": {"batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 4521.12451171875, "peak_reserved_mib": 4784.0}, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999952735476323, "max_gradient_difference": 4.57763671875e-05, "compile_comparison_seconds": 43.313792017987, "total_seconds": 50.912394708022475, "source": "allowed packed_sample and own synthetic generator only"} + +E90 fixture and queue: { + "seed": 419, + "cpu_seconds": 1.048940374981612, + "forward_bitwise_unchanged": true, + "hourly_monthly_loss_bitwise_unchanged": true, + "mixed_loss_before": 0.4770006537437439, + "mixed_loss_after": 0.4904267191886902, + "all_gradients_finite": true, + "optimizer_updates": 0, + "diagnostic_input": "four locally generated random/smooth contexts; never used in selected weights" +} +Queued after E84(PID4254), using E80 as the matched control. + +E79 duplicate-output guard fixture: { + "duplicate_rejected_before_model_loading": true, + "optimizer_updates": 0, + "cpu_seconds": 1.6497254162095487 +} +With the training code directory on the import path, queue now resolves to the Python standard library. No queue.py/torch.py/multiprocessing.py/concurrent.py shadow files remain under research. + +E79 corrected-normalization fixture: {"normalization_overflow_fallback": true, "width": 1024, "initialization_seed": 307, "fixture_seed": 313, "optimizer_updates": 0, "maximum_shape_memory": {"batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "loss": 0.6031821966171265, "peak_allocated_mib": 10162.86376953125, "peak_reserved_mib": 10696.0}, "eager_loss": 0.3412420153617859, "compiled_loss": 0.3412419855594635, "gradient_cosine": 0.9999932382274589, "max_gradient_difference": 6.103515625e-05, "compile_comparison_seconds": 40.99431764590554, "total_seconds": 49.15364895504899, "source": "allowed packed_sample and own synthetic generator only"} + +E79 fresh1024 seed307 training started at 2026-10-23T03:50:34Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 fresh512 seed307 training started at 2026-10-23T03:50:34Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E89 patch4_candidate seed401 training started at 2026-10-23T03:50:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E89 patch4_control seed401 training started at 2026-10-23T03:50:45Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E58/E66 widened146M final32000 +- Checkpoint SHA-256: `ecbb1f28a9bced1c7ecc078593908435320a618cde23bf034719b92b14c12b96`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.13470983505249 seconds. +- Overall skill 0.375306; relative MASE 0.746016; relative WQL 0.523103. +- term skill: long=0.3994, medium=0.4059, short=0.3536. +- domain skill: Econ/Fin=0.1403, Energy=0.2325, Healthcare=0.4376, Nature=0.4286, Sales=0.3380, Transport=0.4675, Web/CloudOps=0.5006. +- frequency skill: A=0.3821, D=0.3507, H=0.3942, M=0.0875, Q=0.2028, S=0.4235, T=0.4362, W=0.2179. +- variates skill: multivariate=0.3934, univariate=0.3605. +- Outcome: Final0.375305635 is effectively identical to matched37Mcontrol0.375304864 and below own E47parent0.375792930. The small24000 advantage did not persist. This rejects a benefit from this duplicated-width continuation, not from fresh larger pretraining. Final recovery3 loop3443.875463s; previous phases recorded separately; seed113/reset179/B96/LR3e-5. E79 tests fresh capacity instead. + +## E86 protected inherited stream at6000 +- Checkpoint SHA-256: `73dfe63b77e9f981fec42ceff6b2c9ec8b69e887c6d1d42830629c729c989625`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 30.87101984024048 seconds. +- Overall skill 0.373645; relative MASE 0.748615; relative WQL 0.524061. +- term skill: long=0.3977, medium=0.4063, short=0.3511. +- domain skill: Econ/Fin=0.1394, Energy=0.2337, Healthcare=0.4357, Nature=0.4267, Sales=0.3377, Transport=0.4634, Web/CloudOps=0.4976. +- frequency skill: A=0.3780, D=0.3487, H=0.3934, M=0.1091, Q=0.2016, S=0.4221, T=0.4332, W=0.2062. +- variates skill: multivariate=0.3912, univariate=0.3593. +- Outcome: Main0.373645290 barely improves3000 0.373573070 and remains below starting model0.375792503. Finish planned8000, then release allocation to E89. Seed113/B96/LR2e-4; no publication. + +## E84 coarse-data first1000 +- Checkpoint SHA-256: `207329fa0c16814d1fa72b3683219761f5ca3b692fa7059730f76c3fe0e93712`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.292750597000122 seconds. +- Overall skill 0.377433; relative MASE 0.744088; relative WQL 0.520892. +- term skill: long=0.4001, medium=0.4067, short=0.3569. +- domain skill: Econ/Fin=0.1311, Energy=0.2365, Healthcare=0.4620, Nature=0.4308, Sales=0.3347, Transport=0.4671, Web/CloudOps=0.5002. +- frequency skill: A=0.3669, D=0.3545, H=0.3965, M=0.1063, Q=0.1974, S=0.4228, T=0.4351, W=0.2289. +- variates skill: multivariate=0.3942, univariate=0.3638. +- Outcome: Main0.377433346 exceeds matched E67paired1000 0.376859515. Early evidence only; same seed197/B64/LR2e-5, independent aggregationRNG900200; no inference changes. + +## E84 coarse-data at3000 +- Checkpoint SHA-256: `75b4b41869254617288521d3c0c3539c9d60c6cad6b259b6ff166d1c9fd78c29`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.35591197013855 seconds. +- Overall skill 0.378023; relative MASE 0.743608; relative WQL 0.520241. +- term skill: long=0.4019, medium=0.4064, short=0.3573. +- domain skill: Econ/Fin=0.1364, Energy=0.2363, Healthcare=0.4484, Nature=0.4319, Sales=0.3319, Transport=0.4672, Web/CloudOps=0.5044. +- frequency skill: A=0.3677, D=0.3514, H=0.3990, M=0.1053, Q=0.1979, S=0.4219, T=0.4378, W=0.2193. +- variates skill: multivariate=0.3966, univariate=0.3628. +- Outcome: Main0.378023141 is slightly below matched E67paired3000 0.378318033 after the first1000 gain. Continue6000/12000 and inspect frequency groups; no consistent gain yet. + +## E80 overflow-only control first1000 +- Checkpoint SHA-256: `fb64456ba0c2ebef979b8525274132618fe542f67e7193036e4a013de6629f5c`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.763219356536865 seconds. +- Overall skill 0.376804; relative MASE 0.744768; relative WQL 0.521468. +- term skill: long=0.3990, medium=0.4062, short=0.3563. +- domain skill: Econ/Fin=0.1319, Energy=0.2364, Healthcare=0.4621, Nature=0.4300, Sales=0.3347, Transport=0.4668, Web/CloudOps=0.4982. +- frequency skill: A=0.3657, D=0.3559, H=0.3950, M=0.1061, Q=0.1979, S=0.4228, T=0.4347, W=0.2257. +- variates skill: multivariate=0.3925, univariate=0.3640. +- Outcome: Main0.376804394 is effectively tied with original E67paired1000 0.376859515, and slightly above E75postloss1000 0.376670711. Numerical correction alone has not shown a predictive gain yet. Continue matched3000/6000/12000. + +## E78 multiscale AR final12000 +- Checkpoint SHA-256: `a9b6f03e211513684787db1d518696925351987e524cb969c3d3a184afde6f25`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.768662929534912 seconds. +- Overall skill 0.377173; relative MASE 0.744921; relative WQL 0.520745. +- term skill: long=0.4032, medium=0.4047, short=0.3559. +- domain skill: Econ/Fin=0.1376, Energy=0.2351, Healthcare=0.4499, Nature=0.4288, Sales=0.3321, Transport=0.4667, Web/CloudOps=0.5043. +- frequency skill: A=0.3628, D=0.3520, H=0.3946, M=0.1047, Q=0.2008, S=0.4249, T=0.4400, W=0.2136. +- variates skill: multivariate=0.3959, univariate=0.3619. +- Outcome: Final0.377172928 is below matched E77single slowAR12000 0.377696007 and original E67paired12000 0.377427077. At6000 it nearly tied single slowAR; no gain from extra components. Completed planned endpoint; retain negative result and release this allocation for queued E89 after E86 finishes. + +E88 patch8 late slowAR seed197 training started at 2026-10-23T03:55:05Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E86 protected inherited stream final8000 +- Checkpoint SHA-256: `8c868d08f583249ae38cd9173b7f19c530825dda785fe66011be60d3e1a6b2f4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 30.288848638534546 seconds. +- Overall skill 0.373894; relative MASE 0.748106; relative WQL 0.524001. +- term skill: long=0.3986, medium=0.4065, short=0.3511. +- domain skill: Econ/Fin=0.1434, Energy=0.2349, Healthcare=0.4214, Nature=0.4283, Sales=0.3364, Transport=0.4640, Web/CloudOps=0.4986. +- frequency skill: A=0.3812, D=0.3459, H=0.3944, M=0.1025, Q=0.2000, S=0.4216, T=0.4346, W=0.2079. +- variates skill: multivariate=0.3920, univariate=0.3591. +- Outcome: Final0.373894042 remains below its own initialization0.375792503. Protecting inherited tensors while training additions at a higher rate improved recovery speed but did not improve the forecast model. Completed8000 in1625.057884loopseconds on the shared H100. Effective protected/trainable counts36,800,800/109,676,544; seed113/B96/LR2e-4. Released allocation to E89; retain as negative result. + +## E80 overflow-only control at3000 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.62967348098755 seconds. +- Overall skill 0.378664; relative MASE 0.743020; relative WQL 0.519581. +- term skill: long=0.4024, medium=0.4069, short=0.3581. +- domain skill: Econ/Fin=0.1345, Energy=0.2391, Healthcare=0.4537, Nature=0.4314, Sales=0.3327, Transport=0.4661, Web/CloudOps=0.5041. +- frequency skill: A=0.3682, D=0.3548, H=0.3976, M=0.1042, Q=0.1968, S=0.4234, T=0.4386, W=0.2234. +- variates skill: multivariate=0.3971, univariate=0.3636. +- Outcome: Main0.378663825 exceeds original E67paired3000 0.378318033 and nearly matches E75postloss3000 0.378813891. Most of the earlier raw main gain may come from the numerical correction rather than the postprocessing-aware loss. Check earlier cutoffs using the same overflow-safe runtime before attributing the remaining difference. Same seed197/B64/LR2e-5. + +## E84 coarse data at6000 +- Checkpoint SHA-256: `79cce8767ec35ed8ba6045957f2ef4147adb8fe312b03c50dc20ae635255926f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.568254947662354 seconds. +- Overall skill 0.378304; relative MASE 0.743340; relative WQL 0.519958. +- term skill: long=0.4018, medium=0.4073, short=0.3574. +- domain skill: Econ/Fin=0.1325, Energy=0.2353, Healthcare=0.4579, Nature=0.4332, Sales=0.3368, Transport=0.4657, Web/CloudOps=0.5045. +- frequency skill: A=0.3681, D=0.3543, H=0.3963, M=0.1037, Q=0.1944, S=0.4243, T=0.4385, W=0.2257. +- variates skill: multivariate=0.3970, univariate=0.3630. +- Outcome: Main0.378304411 remains slightly below matched E67paired6000 0.378455389. Continue planned12000, then assess overall/frequency behavior; no consistent aggregate gain yet. Seed197/B64/LR2e-5, same base/source/horizon streams apart from independent coarse aggregation. + +## E89 patch8 matched control first1000 +- Checkpoint SHA-256: `ebf6cd1845311b149118beb13364892445388f124e9f706bffe7a317ab97b762`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.399544715881348 seconds. +- Overall skill 0.380274; relative MASE 0.743092; relative WQL 0.516841. +- term skill: long=0.4036, medium=0.4039, short=0.3617. +- domain skill: Econ/Fin=0.1303, Energy=0.2425, Healthcare=0.4624, Nature=0.4416, Sales=0.3473, Transport=0.4610, Web/CloudOps=0.5001. +- frequency skill: A=0.3689, D=0.3561, H=0.3952, M=0.1038, Q=0.1908, S=0.4222, T=0.4419, W=0.2419. +- variates skill: multivariate=0.3965, univariate=0.3670. +- Outcome: Control0.380274173 is below its shared starting E71patch8_6000 0.381178739. The patch4 candidate is still approaching1000. Fresh AdamW/EMA, seed401/B32/LR2e-5; wait for the matched comparison. + +Completed process loop receipts: E71 recovery3 final12000=3333.747876572s (earlier interrupted prefixes separately logged); E78 final12000=2448.526446433s; E86 final8000=1625.057883863s. All overlapped other training on the one H100 and are not exclusive GPU times. + +## E71 patch8 final12000 +- Checkpoint SHA-256: `313d035b782188253ecd27c0da37030b397b82e4fa596f3a944994be3f1d203f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.39552927017212 seconds. +- Overall skill 0.379468; relative MASE 0.743587; relative WQL 0.517842. +- term skill: long=0.4043, medium=0.4042, short=0.3599. +- domain skill: Econ/Fin=0.1408, Energy=0.2402, Healthcare=0.4302, Nature=0.4416, Sales=0.3430, Transport=0.4619, Web/CloudOps=0.5048. +- frequency skill: A=0.3766, D=0.3605, H=0.3949, M=0.0689, Q=0.1914, S=0.4241, T=0.4445, W=0.2231. +- variates skill: multivariate=0.3987, univariate=0.3637. +- Outcome: Final main0.379467684 is below selected6000 0.381178739. Retain6000 as published ensemble member. Seed197/B64/LR2e-5; recovery3 loop3333.747877s, previous recovery phases recorded separately; no further continuation in this run. + +## E69 volatility final12000 +- Checkpoint SHA-256: `adddab6f07cb65843a1356ee2a3b36985fd56ecacc6fdb7703c465b0cfe21f5a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 18.7578706741333 seconds. +- Overall skill 0.360846; relative MASE 0.761644; relative WQL 0.536363. +- term skill: long=0.3901, medium=0.4048, short=0.3314. +- domain skill: Econ/Fin=0.1094, Energy=0.1887, Healthcare=0.4132, Nature=0.4274, Sales=0.3422, Transport=0.4584, Web/CloudOps=0.5066. +- frequency skill: A=0.3708, D=0.3402, H=0.3826, M=0.1173, Q=0.1994, S=0.4419, T=0.4041, W=0.2107. +- variates skill: multivariate=0.3938, univariate=0.3333. +- Outcome: Final main0.360845700 is below matched E42partial12000 0.361108160. Earlier6000 diagnostics were mixed. The early main gain did not persist; no transfer or publication. Seed79/B256/LR5e-5; final recovery3 loop3542.503298s. Released allocation to E88. + +## E89 patch4 candidate first1000 +- Checkpoint SHA-256: `a0b4f56f9b3bbf26a94ee72a8f3487c1fb42c009c79ccb8fcef8538ffdb96e7f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 47.17473244667053 seconds. +- Overall skill 0.378251; relative MASE 0.744567; relative WQL 0.519191. +- term skill: long=0.4036, medium=0.4019, short=0.3589. +- domain skill: Econ/Fin=0.1342, Energy=0.2339, Healthcare=0.4544, Nature=0.4415, Sales=0.3520, Transport=0.4631, Web/CloudOps=0.5002. +- frequency skill: A=0.3613, D=0.3424, H=0.3929, M=0.1696, Q=0.1890, S=0.4219, T=0.4368, W=0.2442. +- variates skill: multivariate=0.3925, univariate=0.3667. +- Outcome: Main0.378250742 improves folded initialization0.370553128 but trails matched patch8control1000 0.380274173 and shared original patch8parent0.381178739. Continue planned comparison; seed401/B32/LR2e-5. + +## E80 overflow-only3000 earlier cutoff1 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 22.02164888381958 seconds. +- Overall skill 0.336120; relative MASE 0.797369; relative WQL 0.552739. +- term skill: long=0.3981, medium=0.3582, short=0.3019. +- domain skill: Econ/Fin=0.1557, Energy=0.2287, Healthcare=0.4162, Nature=0.3643, Sales=0.3941, Transport=0.3729, Web/CloudOps=0.4489. +- frequency skill: A=0.3135, D=0.3521, H=0.3666, M=0.1852, Q=0.2300, S=0.3411, T=0.3348, W=0.2843. +- variates skill: multivariate=0.3527, univariate=0.3226. +- Outcome: Earlier0.336119626 exceeds E75postloss0.333946620 and original E67paired0.335738788. Numerical fix alone is a better base here; seed197/B64/LR2e-5, no extra optimization. + +## E80 overflow-only3000 earlier cutoff2 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 21.807528972625732 seconds. +- Overall skill 0.358235; relative MASE 0.771665; relative WQL 0.533732. +- term skill: long=0.3635, medium=0.3875, short=0.3446. +- domain skill: Econ/Fin=0.1067, Energy=0.2360, Healthcare=0.3485, Nature=0.4691, Sales=0.5486, Transport=0.4210, Web/CloudOps=0.4314. +- frequency skill: A=0.3545, D=0.4236, H=0.3910, M=0.1500, Q=0.1497, S=0.2812, T=0.3593, W=0.2599. +- variates skill: multivariate=0.3633, univariate=0.3541. +- Outcome: Earlier0.358234785 exceeds E75postloss0.357604589 and essentially ties original E67paired0.358235331. Main and first two earlier cutoffs warrant one fixed slowAR delta composition; no validation gradients. + +## E80 overflow-only3000 earlier cutoff3 +- Checkpoint SHA-256: `2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 21.630401849746704 seconds. +- Overall skill 0.388792; relative MASE 0.737171; relative WQL 0.506769. +- term skill: long=0.3965, medium=0.3607, short=0.3962. +- domain skill: Econ/Fin=0.1707, Energy=0.3203, Healthcare=0.2577, Nature=0.5049, Sales=0.3995, Transport=0.5052, Web/CloudOps=0.3898. +- frequency skill: A=0.3632, D=0.4429, H=0.4039, M=0.1158, Q=0.2578, S=0.2865, T=0.4303, W=0.2614. +- variates skill: multivariate=0.3742, univariate=0.4001. +- Outcome: Earlier0.388791691 is slightly below original E67paired0.389069088. Numerical correction does not improve every cutoff. Keep all outcomes; assess one predeclared fixed composition across all four cutoffs. + +## E91 predeclared overflow-safe base plus slow-AR correction +Hypothesis: the overflow-only E80 paired3000 base retains the useful numerical correction without E75 postprocessing-aware objective regressions, while the independently matched E61 slowAR6000 minus E42partial6000 correction retains its previous benefit. Apply exactly one coefficient1 composition: E80paired3000 + E61slowAR6000 - E42partial6000. No coefficient sweep, no additional optimizer updates, no validation targets used in weight construction. All three parents were trained on allowed corpus/synthetic data from our own scratch lineage. Base seed197/B64/LR2e-5; matched delta parents seed79/B256/LR5e-5. Use the exact postloss_inference overflow-safe model with unchanged fixed inference rules. Evaluate all four established cutoffs, and only then consider equal-weight ensemble replacement with E71patch8_6000 and a full public-contract replay. + +## E80 overflow-only control at6000 +- Checkpoint SHA-256: `b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 22.57701802253723 seconds. +- Overall skill 0.378289; relative MASE 0.743925; relative WQL 0.519575. +- term skill: long=0.4014, medium=0.4069, short=0.3578. +- domain skill: Econ/Fin=0.1256, Energy=0.2394, Healthcare=0.4638, Nature=0.4293, Sales=0.3386, Transport=0.4657, Web/CloudOps=0.5023. +- frequency skill: A=0.3687, D=0.3551, H=0.3958, M=0.1068, Q=0.1918, S=0.4249, T=0.4380, W=0.2268. +- variates skill: multivariate=0.3966, univariate=0.3633. +- Outcome: Main0.378288765 is below its3000 0.378663825 and matched original E67paired6000 0.378455389. The numerical correction is required for rare finite overflows but its forecasting gain is not monotonic. Continue planned12000; seed197/B64/LR2e-5. + +## E89 patch8 matched control at3000 +- Checkpoint SHA-256: `9083c6be954ec65ec6248801e719d6f182cd3d12bf116f8fc5fc4796675141c4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.57180857658386 seconds. +- Overall skill 0.378946; relative MASE 0.744701; relative WQL 0.517938. +- term skill: long=0.4043, medium=0.4024, short=0.3597. +- domain skill: Econ/Fin=0.1384, Energy=0.2401, Healthcare=0.4325, Nature=0.4444, Sales=0.3407, Transport=0.4620, Web/CloudOps=0.5013. +- frequency skill: A=0.3736, D=0.3524, H=0.3933, M=0.0834, Q=0.1970, S=0.4232, T=0.4439, W=0.2376. +- variates skill: multivariate=0.3975, univariate=0.3638. +- Outcome: Control0.378945686 is below first1000 and original selected6000 parent. Continue matched patch4 comparison; seed401/B32/LR2e-5. + +## E88 late slowAR first9000 +- Checkpoint SHA-256: `fbd4b0d4f29fb162929a3cf9cd4bb0ae264a2e15d860519e0fc08fa314b6820d`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 30.04508352279663 seconds. +- Overall skill 0.380434; relative MASE 0.741856; relative WQL 0.517434. +- term skill: long=0.4054, medium=0.4044, short=0.3611. +- domain skill: Econ/Fin=0.1423, Energy=0.2409, Healthcare=0.4434, Nature=0.4404, Sales=0.3436, Transport=0.4625, Web/CloudOps=0.5050. +- frequency skill: A=0.3803, D=0.3586, H=0.3955, M=0.0778, Q=0.1920, S=0.4256, T=0.4443, W=0.2331. +- variates skill: multivariate=0.3993, univariate=0.3650. +- Outcome: Main0.380434469 exceeds original E71final12000 but is below selected E71earlier6000. Evaluate the exact original9000 checkpoint before attributing a gain to the late AR change. Resume8000 preserved optimizer/EMA/allRNG/prefetched batch; seed197/B64/global12kLRschedule. + +## E91 overflow-safe plus slowAR valid_screen +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.561925172805786 seconds. +- Overall skill 0.379922; relative MASE 0.741449; relative WQL 0.518575. +- term skill: long=0.4039, medium=0.4067, short=0.3598. +- domain skill: Econ/Fin=0.1450, Energy=0.2359, Healthcare=0.4601, Nature=0.4339, Sales=0.3351, Transport=0.4657, Web/CloudOps=0.5073. +- frequency skill: A=0.3727, D=0.3616, H=0.3973, M=0.0940, Q=0.1982, S=0.4264, T=0.4400, W=0.2228. +- variates skill: multivariate=0.3984, univariate=0.3648. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E91 overflow-safe plus slowAR valid_backcast +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.259706020355225 seconds. +- Overall skill 0.337178; relative MASE 0.795032; relative WQL 0.552597. +- term skill: long=0.3962, medium=0.3594, short=0.3042. +- domain skill: Econ/Fin=0.1688, Energy=0.2262, Healthcare=0.4114, Nature=0.3695, Sales=0.3929, Transport=0.3721, Web/CloudOps=0.4520. +- frequency skill: A=0.3205, D=0.3501, H=0.3656, M=0.1901, Q=0.2319, S=0.3439, T=0.3378, W=0.2886. +- variates skill: multivariate=0.3544, univariate=0.3232. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E91 overflow-safe plus slowAR valid_backcast2 +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.369709968566895 seconds. +- Overall skill 0.360453; relative MASE 0.769235; relative WQL 0.531723. +- term skill: long=0.3677, medium=0.3870, short=0.3472. +- domain skill: Econ/Fin=0.1196, Energy=0.2351, Healthcare=0.3437, Nature=0.4735, Sales=0.5473, Transport=0.4202, Web/CloudOps=0.4377. +- frequency skill: A=0.3522, D=0.4289, H=0.3897, M=0.1376, Q=0.1497, S=0.2867, T=0.3638, W=0.2656. +- variates skill: multivariate=0.3670, univariate=0.3551. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E91 overflow-safe plus slowAR valid_backcast3 +- Checkpoint SHA-256: `59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.158844232559204 seconds. +- Overall skill 0.389176; relative MASE 0.737055; relative WQL 0.506212. +- term skill: long=0.3949, medium=0.3621, short=0.3969. +- domain skill: Econ/Fin=0.1809, Energy=0.3196, Healthcare=0.2279, Nature=0.5059, Sales=0.4000, Transport=0.5071, Web/CloudOps=0.3940. +- frequency skill: A=0.3624, D=0.4461, H=0.4034, M=0.1001, Q=0.2604, S=0.2871, T=0.4311, W=0.2634. +- variates skill: multivariate=0.3742, univariate=0.4008. +- Outcome: Fixed coefficient1 composition; zero optimizer updates, merge CPU1.173140s. Main0.379921968 is slightly below E83main0.380250568, but all three earlier cutoffs improve E83. Next compare one fixed equal ensemble with selected E71patch8_6000 across all four cutoffs; validation selection only. + +## E92 robust normalization — prepared, not launched +Hypothesis: rare large history observations dominate the current mean/RMS scale and compress typical dynamics. Change only the context normalization to winsorized statistics: center a clipping interval on the finite-value median, radius6 times the mean absolute deviation from that median; estimate mean and standard deviation of the clipped history in float64, retain the existing relative scale floor, and normalize the original history with the existing ±30 bound. This uses a mean absolute deviation, rather than median deviation, to retain scale for intermittent series. All-missing and constant histories use the same safe count/floor conventions. No future observations enter normalization. Initialize own E62 checkpoint; seed197/B64/LR2e-5/12000 paired steps, same original corpus/synthetic/horizon streams as E80overflow-only control. No new parameters, sources, or synthetic generator. A separate runtime will use identical robust statistics. Check finite outputs/gradients, affine and sign behavior, and unchanged loss machinery on locally generated fixtures before launch. Queue only after E80 releases its allocation. + +### E91 fixed ensemble outcome — retain E87 +[ + { + "cutoff": "valid_screen", + "candidate": 0.38295755880742377, + "published": 0.38368555666405846, + "cpu_seconds": 0.7978230791632086, + "groups": { + "term": { + "short": 0.3641412739810047, + "medium": 0.4081748699742944, + "long": 0.4053387686104565 + }, + "domain": { + "Econ/Fin": 0.14196055084083636, + "Energy": 0.2436181245717931, + "Healthcare": 0.47044789997945524, + "Nature": 0.43843771854824554, + "Sales": 0.3435316624897278, + "Transport": 0.4646935796341666, + "Web/CloudOps": 0.50560991569805 + }, + "freq": { + "A-DEC": 0.37806371948108464, + "Q-DEC": 0.1953743898001734, + "M": 0.10835758037283183, + "W-SUN": 0.09200217288388479, + "D": 0.36288028663668526, + "H": 0.39989339265058577, + "15T": 0.21574107475831517, + "W-FRI": 0.00590529614346913, + "10T": 0.6203515795555475, + "W-TUE": 0.5998659430846229, + "W-THU": 0.20928566575491192, + "W-WED": 0.32755565821641586, + "5T": 0.5196292524760446, + "10S": 0.4253796526525012 + } + } + }, + { + "cutoff": "valid_backcast", + "candidate": 0.33965252002132096, + "published": 0.33897078175106665, + "cpu_seconds": 0.8413949671667069, + "groups": { + "term": { + "short": 0.30682882244621934, + "medium": 0.3594584814302525, + "long": 0.4004578178388881 + }, + "domain": { + "Econ/Fin": 0.17015181674919277, + "Energy": 0.23013645693798135, + "Healthcare": 0.4218451623665679, + "Nature": 0.3716837571447873, + "Sales": 0.4016515190787069, + "Transport": 0.3732465934225949, + "Web/CloudOps": 0.450994086374909 + }, + "freq": { + "A-DEC": 0.3282816505284657, + "Q-DEC": 0.23566016127363243, + "M": 0.19914077895872262, + "W-SUN": 0.03865936211094867, + "D": 0.355074708701307, + "H": 0.36721923281513913, + "15T": 0.22292257615547317, + "W-FRI": 0.23702394178468034, + "10T": 0.32706954225689555, + "W-TUE": 0.5531057781818784, + "W-THU": 0.26381006300655674, + "W-WED": 0.35364720411869544, + "5T": 0.44270238618668056, + "10S": 0.34631632390506784 + } + } + }, + { + "cutoff": "valid_backcast2", + "candidate": 0.36318271604290864, + "published": 0.36315845377936284, + "cpu_seconds": 0.7982894480228424, + "groups": { + "term": { + "short": 0.3500873123601329, + "medium": 0.39140163998387134, + "long": 0.3681031208336688 + }, + "domain": { + "Econ/Fin": 0.11631521324076821, + "Energy": 0.23897422330833784, + "Healthcare": 0.3563145060249002, + "Nature": 0.4759919302878802, + "Sales": 0.5526652479550637, + "Transport": 0.42387192299481313, + "Web/CloudOps": 0.436824697056448 + }, + "freq": { + "A-DEC": 0.34293470421447503, + "Q-DEC": 0.15231508648525816, + "M": 0.14735330101758526, + "W-SUN": 0.05191699540908579, + "D": 0.4322785270529358, + "H": 0.39262772604483, + "15T": 0.10591962461225035, + "W-FRI": 0.14794480975291435, + "10T": 0.5077330623307716, + "W-TUE": 0.09268217269468071, + "W-THU": 0.34555097504792365, + "W-WED": 0.5579990641356007, + "5T": 0.4724634827891697, + "10S": 0.2869202644785588 + } + } + }, + { + "cutoff": "valid_backcast3", + "candidate": 0.3889402057921222, + "published": 0.3893067316884232, + "cpu_seconds": 1.0883019380271435, + "groups": { + "term": { + "short": 0.3948070762587602, + "medium": 0.36614080286851436, + "long": 0.3957100819716167 + }, + "domain": { + "Econ/Fin": 0.18258306326920215, + "Energy": 0.3151836976978215, + "Healthcare": 0.23576266671317847, + "Nature": 0.5094192054942891, + "Sales": 0.4006642315236326, + "Transport": 0.5077376839877803, + "Web/CloudOps": 0.39340413209496183 + }, + "freq": { + "A-DEC": 0.3560985343152149, + "Q-DEC": 0.25541091598546395, + "M": 0.11989423475215888, + "W-SUN": 0.15976888148282853, + "D": 0.4460752118885134, + "H": 0.40415283128676627, + "15T": 0.2542013440411708, + "W-FRI": 0.03652589348537405, + "10T": 0.6009630559934178, + "W-TUE": 0.25771359383581927, + "W-THU": 0.35674611651454924, + "W-WED": 0.37808927325032227, + "5T": 0.4654632139858025, + "10S": 0.29366540153879894 + } + } + } +] +The E91/E71 equal ensemble loses main0.382957559 versus E870.383685557 and third earlier0.388940206 versus0.389306732. First earlier improves0.339652520 versus0.338970782; second is effectively tied0.363182716 versus0.363158454. No consistent replacement gain; retain E87 and do not spend a full replay. E91 checkpoint SHA59b90e76823bd4b339c7b5d290c7afbdca9d1ba81848760aa5f80ee941cdd089, coefficient1, no optimization. The postloss-related earlier regressions were real, but removing that objective does not improve the selected equal ensemble overall. + +E92 CPU fixture passed: finite outputs/gradients, ordered quantiles, midpoint-median sign symmetry, affine behavior on nonconstant rows, eight own-generated contexts, seed431, zero updates,1.487883s. GPU autocast fixture queued. + +## E88 exact original patch8 control at9000 +- Checkpoint SHA-256: `342436626bc9219f068c118aefbe6ffb106f91e9f88acb01a9ee704cdfb7aa6b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.10145950317383 seconds. +- Overall skill 0.380329; relative MASE 0.741988; relative WQL 0.517518. +- term skill: long=0.4051, medium=0.4042, short=0.3611. +- domain skill: Econ/Fin=0.1410, Energy=0.2410, Healthcare=0.4471, Nature=0.4399, Sales=0.3435, Transport=0.4623, Web/CloudOps=0.5043. +- frequency skill: A=0.3807, D=0.3585, H=0.3953, M=0.0838, Q=0.1923, S=0.4254, T=0.4436, W=0.2332. +- variates skill: multivariate=0.3986, univariate=0.3654. +- Outcome: Original9000 main0.380329158 versus E88late slowAR9000 0.380434469, a small0.000105310 gain after1000 changed steps. Both below original selected6000 0.381178739; continue exact final12000 comparison. One failed evaluator invocation used a nonexistent path and did no inference; rerun with full_paired_inference succeeded. + +E92 GPU bf16 paired-gradient fixture passed, seed433,8.773601s, zero optimizer updates. Queue behind E80PID4371; unchanged declared12k schedule. + +Provenance hardening for E88: publisher now includes the immutable external recovery008000 snapshot as a lineage parent and records its hash/step, in addition to the original initialization. This preserves the original8000-step recipe before the late slowAR change. Mutable within-run recovery files remain excluded to avoid self-referencing lineage; no training state or weights changed. + +## Permitted-sampler coverage diagnostic, seed449 +Independent E79sampler audit generated48000 windows in4.262272CPU seconds, zero optimizer updates, no validation data read, active training streams untouched. Full source probabilities and finite-history/target summaries are sampler_coverage_audit.json. Monthly[12,1] accounts for5.1104% of rows: medianfinitecontext43, medianfinitetarget57,42.68%histories below32. Quarterly[4,1] accounts for5.2792%: mediancontext33,target46,47.95%histories below32. Weekly[52,1] accounts for3.8188%: mediancontext51,target82,30.44%histories below32. Current synthetic-period list contains no[52,1]weekly case. These are training-distribution diagnostics, not performance evidence; context and target marginal medians do not imply every row has that ratio. Original sampler20%synthetic/randomC-H recipe preserved. + +## E79 fresh37M first4000 +- Checkpoint SHA-256: `dc04a05abefdb903497a3311e7eac289ccdeae75db0ada66d02e05e431ba4f1a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.426799774169922 seconds. +- Overall skill 0.341862; relative MASE 0.775670; relative WQL 0.558415. +- term skill: long=0.3667, medium=0.3845, short=0.3148. +- domain skill: Econ/Fin=0.1118, Energy=0.2099, Healthcare=0.3250, Nature=0.4095, Sales=0.3041, Transport=0.4280, Web/CloudOps=0.4683. +- frequency skill: A=0.3520, D=0.3280, H=0.3608, M=-0.0493, Q=0.1682, S=0.4263, T=0.3918, W=0.2320. +- variates skill: multivariate=0.3630, univariate=0.3246. +- Outcome: Fresh random seed307/B48/LR2e-4/96000 static-compiled paired training, original random initialization hash19da01694123fcb13df815689ca66460d0da596bd31dfabfabb08dda6f7801e4. Main0.341861940 is below the published mature lineage but a promising early learning curve. Wait for the matched146M4000 result and planned8000/16000 checkpoints. Both arms share the corrected float64 overflow fallback and slowAR generator. Startup failures and discarded work were recorded separately; no baseline weights used. + +## E89 patch4 candidate at3000 +- Checkpoint SHA-256: `87fcd88001d63389726ff55885ef09933f912034662816cf2080d2f08a041542`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 58.48912262916565 seconds. +- Overall skill 0.379843; relative MASE 0.742829; relative WQL 0.517743. +- term skill: long=0.4040, medium=0.4031, short=0.3611. +- domain skill: Econ/Fin=0.1466, Energy=0.2356, Healthcare=0.4515, Nature=0.4449, Sales=0.3476, Transport=0.4665, Web/CloudOps=0.4992. +- frequency skill: A=0.3695, D=0.3423, H=0.3937, M=0.1494, Q=0.2020, S=0.4211, T=0.4409, W=0.2524. +- variates skill: multivariate=0.3948, univariate=0.3676. +- Outcome: Candidate main0.379842915 now exceeds matched patch8control3000 0.378945686 by0.000897230, though below selected starting parent0.381178739. Monthly skill0.1494 and weekly0.2524 are encouraging; daily0.3423 remains weak. Continue the declared6000/12000 comparisons before considering ensemble complementarity. Seed401/B32/LR2e-5; same original generator and matched fresh optimizer. + +E90 daily-weekly loss scale seed197 training started at 2026-10-23T04:12:55Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E93 patch8 encoder with patch4 forecast blocks — prepared +Hypothesis: E89patch4 improves monthly/weekly behavior by refining forecast blocks; part of the gain may survive with the cheaper patch8 encoder. Decouple input and output patch sizes, keeping input8 and output4. Initialize exactly from own E71patch8 EMA6000: retain all encoder/input tensors, fold query/recency halves and keep the first4 head rows as in E89. No function-preservation claim for output4; input8/output8 must reproduce the old implementation exactly. All other training settings match E89: seed401/B32/LR2e-5/12000 paired steps, original normalization and synthetic generator, horizonRNG300404, fresh optimizer/EMA. Compare with existing E89patch8control and fullpatch4 at1000/3000/6000/12000. No new data/generator or external weights. Queue after E88 releases its allocation, after equivalence and maximum-shape CUDA checks. + +## E84 coarse aggregation final12000 +- Checkpoint SHA-256: `bb3e1d1ef6b57ad9517e69c5f3c4fd5caac6e4fd0f50fa9273df2cd2b13b8a70`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.56629729270935 seconds. +- Overall skill 0.377144; relative MASE 0.744785; relative WQL 0.520888. +- term skill: long=0.4036, medium=0.4057, short=0.3553. +- domain skill: Econ/Fin=0.1335, Energy=0.2339, Healthcare=0.4474, Nature=0.4322, Sales=0.3330, Transport=0.4658, Web/CloudOps=0.5048. +- frequency skill: A=0.3623, D=0.3529, H=0.3953, M=0.1038, Q=0.1971, S=0.4244, T=0.4404, W=0.2071. +- variates skill: multivariate=0.3962, univariate=0.3616. +- Outcome: Final0.377143853 is below matched E67paired12000 0.377427077. Daily skill improves0.352881088 versus0.350503003, but weekly drops0.207079293 versus0.218111206. Short term loses0.000773 while long/medium gain slightly. The targeted daily/weekly augmentation is mixed and not selected. Seed197/B64/LR2e-5, final training loop2103.526387s. E90loss-scale-only starts in the released allocation. + +## E89 patch8 matched control at6000 +- Checkpoint SHA-256: `9e8f798ceb2e1b49d8bd92ba334c42470e780b8d6b62a14195bb268ae8ba872a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.938090801239014 seconds. +- Overall skill 0.377735; relative MASE 0.746288; relative WQL 0.518853. +- term skill: long=0.4024, medium=0.4020, short=0.3584. +- domain skill: Econ/Fin=0.1414, Energy=0.2382, Healthcare=0.4376, Nature=0.4420, Sales=0.3419, Transport=0.4600, Web/CloudOps=0.4997. +- frequency skill: A=0.3730, D=0.3564, H=0.3927, M=0.0689, Q=0.1989, S=0.4229, T=0.4411, W=0.2355. +- variates skill: multivariate=0.3951, univariate=0.3636. +- Outcome: Main0.377734884 continues below original selected parent0.381178739 and control3000 0.378945686. Preserve this matched reference for fullpatch4 and E93splitpatch; seed401/B32/LR2e-5. Continue planned12000. + +E93 initialization SHA0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114;36,601,928parameters, CPUconversion0.663439s. CPUfixture1.433205s proves equal8/8 implementation bitwise unchanged and all converted tensors exactly match E89full4 except the retained input8 projection. CUDAmaximumshapeB32C4096H1024, EMA/moments present, finite loss/gradients,7082MiB reserved,10.871036s. Zero optimizer updates in fixtures. Queued behind E88PID7349 as declared. + +## E93 input8/output4 zero-step conversion +- Checkpoint SHA-256: `0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 36.244373083114624 seconds. +- Overall skill 0.375817; relative MASE 0.747921; relative WQL 0.520916. +- term skill: long=0.4024, medium=0.4024, short=0.3547. +- domain skill: Econ/Fin=0.1375, Energy=0.2390, Healthcare=0.4236, Nature=0.4343, Sales=0.3477, Transport=0.4607, Web/CloudOps=0.4989. +- frequency skill: A=0.3643, D=0.3468, H=0.3925, M=0.0737, Q=0.1911, S=0.4237, T=0.4382, W=0.2424. +- variates skill: multivariate=0.3939, univariate=0.3610. +- Outcome: Initial main0.375817443 is below shared E71patch8parent0.381178739 but above fullpatch4 conversion0.370553128. Keeping the input projection preserves more initial accuracy; this is initialization behavior, not evidence for trained superiority. Conversion0.663439CPU seconds; no optimizer updates; queued matched seed401/B32/LR2e-5/12000 continuation. + +## E87 validation-only context/error audit +Read the established9473-instance screen, both selected member prediction caches, and the cached SeasonalNaive reference; no optimization or changed inference. Compute fixed context4096/recent512 level shifts, scale ratios, and RMS/mean-absolute-deviation ratios, then macro aggregate conditional median-error ratios over represented configurations. CPU2.732488s, zero optimizer updates; complete bins/counts/per-channel metrics in context_error_audit.json. Median-error ratios across recent-level-shift bins[0,.25),[.25,.75),[.75,1.5),[1.5,inf) are.73083,.71495,.77366,.88600. Last bin has only40rows/eightconfigurations. Outlier-dominance bins do not show a monotonic weakness; the highest ratio bin performs relatively well against SeasonalNaive. These are descriptive validation subsets, with different configurations represented; not benchmark skill, independent evidence, or causal estimates. No inference-rule change follows from this audit. + +## E79 fresh146M first4000 +- Checkpoint SHA-256: `ce1d3cf0e49de7acc168ca818424fef4c58feebc49e35ebccd79e6a7450c810a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.41028594970703 seconds. +- Overall skill 0.328134; relative MASE 0.791714; relative WQL 0.570160. +- term skill: long=0.3561, medium=0.3699, short=0.3002. +- domain skill: Econ/Fin=0.1210, Energy=0.2038, Healthcare=0.2653, Nature=0.3940, Sales=0.2893, Transport=0.4160, Web/CloudOps=0.4518. +- frequency skill: A=0.3724, D=0.3122, H=0.3525, M=-0.0778, Q=0.2007, S=0.4142, T=0.3812, W=0.1775. +- variates skill: multivariate=0.3500, univariate=0.3102. +- Outcome: Main0.328133919 trails matched37M4000 0.341861940. Both use own random seed307, batch48, LR2e-4/96000, identical sampled windows and modern paired/slowAR/horizon recipe. This is early optimization, not evidence that larger capacity cannot improve. Continue planned8000/16000 while inspecting matched training loss. Static-compiler startup/abandoned duplicate launches were recorded separately. + +E93 input8/output4 seed401 training started at 2026-10-23T04:18:59Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E79 matched training-loss diagnostic at first4000: mean50-step-block losses37M/146M over steps1..400=.434227/.430111,401..1000=.397594/.402231,1001..2000=.381371/.386349,2001..3000=.374289/.377926,3001..4000=.361665/.366583. The larger model starts slightly better during warmup but trails after reachingLR2e-4. This is consistent with an optimization mismatch, not proof of its cause. First4000 training-loop times including static compilation:37M1106.1s,146M1563.7s; both share the sole H100. + +## E94 fresh146M with half learning rate — prepared +Hypothesis: the commonLR2e-4 is too aggressive at width1024, obscuring capacity benefits. Add one matched fresh146M arm withLR1e-4 only; same original random initialization SHA c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90, seed307, B48,96000-step cosine horizon,400 warmup, static compiled paired loss, allowed packed_sample/source weights, slowAR synthetic generator, requested-horizon augmentation, overflow fallback, optimizer/EMA, save/checkpoint cadence. All original E79 arms continue unchanged. Reuse the exact code and already verified width1024 maximum-shape/compiled-gradient fixtures; no architecture or memory change warrants rerunning them. Screen4000/8000/16000/24000, continuing longer only if supported. Queue after E89patch8control releases its allocation. No pretrained assets, new sources or generators. + +## E79 fresh37M at8000 +- Checkpoint SHA-256: `5e821b81ac42babdc67ed0f5368da07941be075784d1ded6ab6c65539458faf0`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.999473094940186 seconds. +- Overall skill 0.353509; relative MASE 0.763149; relative WQL 0.547666. +- term skill: long=0.3727, medium=0.3917, short=0.3307. +- domain skill: Econ/Fin=0.1196, Energy=0.2092, Healthcare=0.3930, Nature=0.4203, Sales=0.3250, Transport=0.4394, Web/CloudOps=0.4807. +- frequency skill: A=0.3577, D=0.3366, H=0.3677, M=0.0393, Q=0.1747, S=0.4203, T=0.4060, W=0.2420. +- variates skill: multivariate=0.3701, univariate=0.3400. +- Outcome: Main0.353508836 improves4000 0.341861940, still below the mature published model. Continue declared16k/24k/48k; own random seed307/B48/LR2e-4/96k, no pretrained assets. Fresh146M is still before its matched8k. + +## E90 daily-weekly loss scale first1000 +- Checkpoint SHA-256: `e0e1e3967da656eaa8184317b080a5f2064081d0d53e969c4f8a4894fa92d4f2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.965925931930542 seconds. +- Overall skill 0.376961; relative MASE 0.744602; relative WQL 0.521322. +- term skill: long=0.3990, medium=0.4061, short=0.3567. +- domain skill: Econ/Fin=0.1300, Energy=0.2364, Healthcare=0.4663, Nature=0.4300, Sales=0.3344, Transport=0.4667, Web/CloudOps=0.4984. +- frequency skill: A=0.3661, D=0.3567, H=0.3951, M=0.1038, Q=0.1981, S=0.4227, T=0.4348, W=0.2267. +- variates skill: multivariate=0.3927, univariate=0.3641. +- Outcome: Main0.376961315 slightly exceeds matched overflow-only E801000 0.376804394. Too early for a method-selection claim; inspect3k/6k and frequency groups. Seed197/B64/LR2e-5, only exactdaily/weeklyseasonallosslag changes. + +## E88 late patch8 slowAR final12000 +- Checkpoint SHA-256: `81e020113b23e84d1df64458e7c1b4a4f6ad6ee24f7cdb601aeb3fbe5d20251f`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 33.93403601646423 seconds. +- Overall skill 0.379111; relative MASE 0.744397; relative WQL 0.517873. +- term skill: long=0.4044, medium=0.4045, short=0.3590. +- domain skill: Econ/Fin=0.1445, Energy=0.2396, Healthcare=0.4185, Nature=0.4414, Sales=0.3428, Transport=0.4624, Web/CloudOps=0.5058. +- frequency skill: A=0.3764, D=0.3621, H=0.3953, M=0.0393, Q=0.1919, S=0.4250, T=0.4450, W=0.2233. +- variates skill: multivariate=0.3996, univariate=0.3623. +- Outcome: Final0.379111337 is below exact original E71final12000 0.379467684. Its small9k gain did not persist, and neither checkpoint exceeds selected6k parent0.381178739. Reject the late slowAR continuation; no new package or earlier-cutoff selection. Resumed8000->12000 completed in1415.491672loopseconds, preserving original optimizer/EMA/RNG/prefetched batch; seed197/B64/same globalcosine. E93 starts in the released allocation. + +E92 robust normalization seed197 training started at 2026-10-23T04:21:37Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E95 broader source coverage at fixed packed volume — preparation +Hypothesis: restricting each large source to eight shards and early record batches limits the useful diversity, especially for buildings (127shards) and each climate source (96shards). Prepare packed_stratified with the same95allowlisted directories,24Mpoint/source soft cap, min16, maxcrop131072 as packed_sample. Select a uniform shuffled order of flattened series across every shard and record batch; take the first finite crops until the cap. Keep exact per-row frequency, exclude all-missing crops, and use independent deterministic per-series crop RNG. Thus coverage, row-frequency handling and empty-crop filtering are declared changes; this is not a claim that each can be isolated if actual mixed-frequency cases occur. Source mixture probabilities will remain those from packed_sample in any training comparison. No external data or validation values enter packing. + +Packer fixtures cover scalar, variable-channel and fixed-channel Arrow targets, null parents/variates, all-missing series, differing row frequencies and long crops:44retained series replay exactly, two fresh outputs have identical hashes,0.240463CPU seconds, zero updates. Initial fixture caught Arrow boolean conversion requiring zero_copy_only=False; fixed before any real-data packing. Per-directory receipts record selected source coordinates, shard coverage, binary hashes and elapsed time; output-wide lock and final atomic meta.json prevent reading an incomplete pack. + +Planned first training comparison, contingent on the completed real-data audit: own E62 parent, seed197/B64/LR2e-5/12000 paired steps with the exact E80overflow-control model/data code, changing only the packed corpus while retaining source probabilities from packed_sample. Screen1k/3k/6k/12k. No fresh training is launched yet; prefer the E90allocation after it finishes. A later fresh-capacity/data comparison remains a separate decision. + +## E80 overflow-only final12000 +- Checkpoint SHA-256: `f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.899142265319824 seconds. +- Overall skill 0.377424; relative MASE 0.744802; relative WQL 0.520408. +- term skill: long=0.4025, medium=0.4056, short=0.3563. +- domain skill: Econ/Fin=0.1303, Energy=0.2363, Healthcare=0.4508, Nature=0.4285, Sales=0.3332, Transport=0.4665, Web/CloudOps=0.5051. +- frequency skill: A=0.3608, D=0.3513, H=0.3946, M=0.1037, Q=0.1974, S=0.4251, T=0.4405, W=0.2175. +- variates skill: multivariate=0.3963, univariate=0.3620. +- Outcome: Final0.377423946 effectively ties original E67paired12000 0.377427077; strongest main checkpoint remained3000. Numerical correction is still required for rare overflow but does not cause a consistent predictive gain by itself. Completed2264.013627training-loop seconds on sharedH100, seed197/B64/LR2e-5. E92robust normalization starts in its allocation. + +## E90 daily-weekly loss scale at3000 +- Checkpoint SHA-256: `a985b1af082ccd6e23a9ec3fd6d6bdd8e8f9ae44900d2c0e1f8d3737cd9fd8d3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.59094786643982 seconds. +- Overall skill 0.378417; relative MASE 0.743144; relative WQL 0.519906. +- term skill: long=0.4018, medium=0.4067, short=0.3579. +- domain skill: Econ/Fin=0.1345, Energy=0.2395, Healthcare=0.4551, Nature=0.4311, Sales=0.3328, Transport=0.4655, Web/CloudOps=0.5031. +- frequency skill: A=0.3691, D=0.3557, H=0.3972, M=0.1020, Q=0.1974, S=0.4233, T=0.4378, W=0.2245. +- variates skill: multivariate=0.3966, univariate=0.3635. +- Outcome: Main0.378417277 trails matched E803000 0.378663825 after a small first1000 gain. Continue6000/12000 and inspect targeted frequency groups; no publication. Seed197/B64/LR2e-5. + +## E92 robust normalization first1000 +- Checkpoint SHA-256: `0067828e667139743a9908ff3a6d68f704197a1609935c64ae6f7a15c84884fa`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 27.180058240890503 seconds. +- Overall skill 0.377596; relative MASE 0.742948; relative WQL 0.521418. +- term skill: long=0.3986, medium=0.4060, short=0.3580. +- domain skill: Econ/Fin=0.1327, Energy=0.2358, Healthcare=0.4628, Nature=0.4326, Sales=0.3487, Transport=0.4670, Web/CloudOps=0.4977. +- frequency skill: A=0.3673, D=0.3569, H=0.3949, M=0.1225, Q=0.1981, S=0.4216, T=0.4346, W=0.2284. +- variates skill: multivariate=0.3923, univariate=0.3656. +- Outcome: Main0.377596201 exceeds matched E801000 0.376804394 by0.000791807. Early evidence only; changes fixed context mean/RMS estimation to median-centered winsorized statistics, retaining original history normalization bounds. Continue3000/6000 and earlier cutoffs if the gain persists. Seed197/B64/LR2e-5. + +## E93 input8/output4 first1000 +- Checkpoint SHA-256: `0aecc5af0ac9b0caf9949bd6601f2fe4ad96c5fdc9e1287c1ff2237439367b7a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.963313579559326 seconds. +- Overall skill 0.379099; relative MASE 0.744060; relative WQL 0.518128. +- term skill: long=0.4046, medium=0.4041, short=0.3591. +- domain skill: Econ/Fin=0.1359, Energy=0.2378, Healthcare=0.4437, Nature=0.4406, Sales=0.3497, Transport=0.4667, Web/CloudOps=0.5000. +- frequency skill: A=0.3584, D=0.3472, H=0.3946, M=0.1244, Q=0.1932, S=0.4224, T=0.4398, W=0.2474. +- variates skill: multivariate=0.3943, univariate=0.3667. +- Outcome: Main0.379098968 exceeds fullpatch4 E891000 0.378250742 but trails matched patch8control1000 0.380274173. Keeping input8 retains initial accuracy; assess later recovery against both existing arms before an architectural conclusion. Seed401/B32/LR2e-5. + +E95 pack completed in109.068074s on two CPUworkers:95directories,342661series,952527771points (3.810GB), versus original357789series/958745103points. Identical softcaps, actualpointcount0.65%lower because overshoot/serieslengths differ. Building127/127shards, borg31/31, eachlargeclimate96/96 are represented. No selected candidate row differed from its shardfirst frequency;103all-missing crops excluded. Exact real-data audit replayed260series acrossall95dirs against independent Arrow row/var access, including frequencies and cropstarts; source probabilities bitwise equal to original. Seed461,7.897138CPU seconds, no validationdata/optimizerupdates. Training nowqueued afterE90PID8949 under the predeclared E80matched recipe. + +## E89 fullpatch4 at6000 +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 58.3371467590332 seconds. +- Overall skill 0.380541; relative MASE 0.742008; relative WQL 0.517151. +- term skill: long=0.4046, medium=0.4023, short=0.3625. +- domain skill: Econ/Fin=0.1470, Energy=0.2361, Healthcare=0.4746, Nature=0.4451, Sales=0.3448, Transport=0.4655, Web/CloudOps=0.4969. +- frequency skill: A=0.3637, D=0.3535, H=0.3958, M=0.1449, Q=0.2068, S=0.4213, T=0.4378, W=0.2471. +- variates skill: multivariate=0.3932, univariate=0.3703. +- Outcome: Main0.380540506 improves3000 0.379842915 and beats matched patch8control6000 0.377734884, but remains below selected starting E71patch8parent0.381178739. Check all three earlier cutoffs to assess stability and possible ensemble complementarity. Seed401/B32/LR2e-5; same original generator and fresh optimizer. + +## E93 input8/output4 at3000 +- Checkpoint SHA-256: `1b82ca84aca9aaa2b8b6b1f944a865b6aad7560257f88b053ea5f62bf63a4eb8`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.112743854522705 seconds. +- Overall skill 0.379808; relative MASE 0.743342; relative WQL 0.517444. +- term skill: long=0.4052, medium=0.4025, short=0.3608. +- domain skill: Econ/Fin=0.1447, Energy=0.2358, Healthcare=0.4455, Nature=0.4421, Sales=0.3442, Transport=0.4692, Web/CloudOps=0.5011. +- frequency skill: A=0.3652, D=0.3489, H=0.3934, M=0.1161, Q=0.2001, S=0.4227, T=0.4417, W=0.2532. +- variates skill: multivariate=0.3949, univariate=0.3675. +- Outcome: Main0.379808189 nearly matches fullpatch4_3000 0.379842915 and exceeds matched patch8control3000 0.378945686. Much of the early finer-patch gain may be retained by output blocks alone, with7082MiB max-shape reserve versus11376MiB fullpatch4. Continue6000/12000; seed401/B32/LR2e-5. + +## E92 robust normalization at3000 +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.601238489151 seconds. +- Overall skill 0.378938; relative MASE 0.741788; relative WQL 0.519985. +- term skill: long=0.4019, medium=0.4060, short=0.3591. +- domain skill: Econ/Fin=0.1339, Energy=0.2386, Healthcare=0.4552, Nature=0.4314, Sales=0.3481, Transport=0.4662, Web/CloudOps=0.5030. +- frequency skill: A=0.3665, D=0.3532, H=0.3965, M=0.1254, Q=0.1981, S=0.4218, T=0.4381, W=0.2295. +- variates skill: multivariate=0.3961, univariate=0.3649. +- Outcome: Main0.378937598 exceeds matched overflow-only E803000 0.378663825 by0.000273773 and postlossE753000 0.378813891 by0.000123707. Small primary gain persists; check all three earlier cutoffs before any composition or selection. Same seed197/B64/LR2e-5. Float64 robust statistics replace the old normalization throughout both network and context loss-scale calculation. + +## E96 equal three-resolution ensemble — predeclared selection probe +Hypothesis: fullpatch4 E89EMA6000 adds complementary monthly/weekly behavior to the published E87patch16/patch8 pair. Test exactly equal1/3 quantile averaging after each member applies its own unchanged rules, ordered E83postloss+slowAR, E71patch8_6000, E89patch4_6000. No coefficient sweep, no additional optimization, no dataset/frequency selection. Every member must forecast every instance if packaged. Compare all four established cached cutoffs; require a complete public-contract replay and relocation/composition checks before any publication. E89patch4_6000 hash e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727; earlier cutoffs currently running. + +E94 fresh146M halfLR seed307 training started at 2026-10-23T04:36:27Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E96 main cached probe: skill0.384594982171353,relMASE0.737391433574142,relWQL0.513598773629635,CPU1.411123s; currentE87main0.383685556664058. Promising0.000909426 main improvement with fixed1/3 weights; assemble a separate candidate while the remaining earlier-cutoff predictions finish. No publication before full public-contract replay/checks. + +## E89 patch4_6000 backcast_evals +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 57.45131206512451 seconds. +- Overall skill 0.336072; relative MASE 0.796655; relative WQL 0.553314. +- term skill: long=0.4016, medium=0.3589, short=0.2999. +- domain skill: Econ/Fin=0.1775, Energy=0.2230, Healthcare=0.4006, Nature=0.3706, Sales=0.4131, Transport=0.3680, Web/CloudOps=0.4502. +- frequency skill: A=0.3160, D=0.3472, H=0.3715, M=0.2107, Q=0.2381, S=0.3496, T=0.3318, W=0.2614. +- variates skill: multivariate=0.3526, univariate=0.3226. +- Outcome: All three earlier cutoffs trail selected E71patch8_6000, so no standalone replacement. The predeclared equal three-model ensemble gains on main/earlier1/earlier2 and nearly ties earlier3; assess exact package replay. + +## E89 patch4_6000 backcast2_evals +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 50.43167591094971 seconds. +- Overall skill 0.360368; relative MASE 0.769660; relative WQL 0.531571. +- term skill: long=0.3665, medium=0.3905, short=0.3460. +- domain skill: Econ/Fin=0.1116, Energy=0.2401, Healthcare=0.3295, Nature=0.4708, Sales=0.5563, Transport=0.4201, Web/CloudOps=0.4365. +- frequency skill: A=0.2963, D=0.4200, H=0.3926, M=0.1575, Q=0.1533, S=0.2829, T=0.3608, W=0.2868. +- variates skill: multivariate=0.3615, univariate=0.3594. +- Outcome: All three earlier cutoffs trail selected E71patch8_6000, so no standalone replacement. The predeclared equal three-model ensemble gains on main/earlier1/earlier2 and nearly ties earlier3; assess exact package replay. + +## E89 patch4_6000 backcast3_evals +- Checkpoint SHA-256: `e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 55.502692461013794 seconds. +- Overall skill 0.383331; relative MASE 0.748104; relative WQL 0.508326. +- term skill: long=0.3963, medium=0.3680, short=0.3844. +- domain skill: Econ/Fin=0.1767, Energy=0.3066, Healthcare=0.2424, Nature=0.4983, Sales=0.3975, Transport=0.5047, Web/CloudOps=0.3929. +- frequency skill: A=0.3000, D=0.4228, H=0.4042, M=0.1613, Q=0.2599, S=0.3033, T=0.4260, W=0.2276. +- variates skill: multivariate=0.3668, univariate=0.3960. +- Outcome: All three earlier cutoffs trail selected E71patch8_6000, so no standalone replacement. The predeclared equal three-model ensemble gains on main/earlier1/earlier2 and nearly ties earlier3; assess exact package replay. + +## E92 robust_3000 backcast_evals +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.711654901504517 seconds. +- Overall skill 0.335781; relative MASE 0.797334; relative WQL 0.553328. +- term skill: long=0.3997, medium=0.3581, short=0.3006. +- domain skill: Econ/Fin=0.1550, Energy=0.2286, Healthcare=0.4082, Nature=0.3646, Sales=0.3970, Transport=0.3731, Web/CloudOps=0.4489. +- frequency skill: A=0.3150, D=0.3499, H=0.3669, M=0.1858, Q=0.2309, S=0.3411, T=0.3343, W=0.2844. +- variates skill: multivariate=0.3520, univariate=0.3226. +- Outcome: Earlier cutoff is below matched E80overflow-only3000. The main gain does not repeat temporally; continue the declared6k/12k training but do not select or transfer this3k checkpoint. + +## E92 robust_3000 backcast2_evals +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 25.730652570724487 seconds. +- Overall skill 0.358075; relative MASE 0.771535; relative WQL 0.534088. +- term skill: long=0.3627, medium=0.3886, short=0.3441. +- domain skill: Econ/Fin=0.1063, Energy=0.2373, Healthcare=0.3471, Nature=0.4675, Sales=0.5490, Transport=0.4200, Web/CloudOps=0.4314. +- frequency skill: A=0.3543, D=0.4241, H=0.3906, M=0.1525, Q=0.1489, S=0.2804, T=0.3600, W=0.2550. +- variates skill: multivariate=0.3640, univariate=0.3532. +- Outcome: Earlier cutoff is below matched E80overflow-only3000. The main gain does not repeat temporally; continue the declared6k/12k training but do not select or transfer this3k checkpoint. + +## E92 robust_3000 backcast3_evals +- Checkpoint SHA-256: `348934d9fbcc8f2a8c45f7ebdc6cd971678d190bcf6ec0c0bd1cf80a12334bbc`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.396876335144043 seconds. +- Overall skill 0.387946; relative MASE 0.738909; relative WQL 0.506977. +- term skill: long=0.3950, medium=0.3615, short=0.3950. +- domain skill: Econ/Fin=0.1698, Energy=0.3214, Healthcare=0.2587, Nature=0.5024, Sales=0.3958, Transport=0.5033, Web/CloudOps=0.3888. +- frequency skill: A=0.3650, D=0.4381, H=0.4044, M=0.1203, Q=0.2538, S=0.2862, T=0.4293, W=0.2622. +- variates skill: multivariate=0.3739, univariate=0.3988. +- Outcome: Earlier cutoff is below matched E80overflow-only3000. The main gain does not repeat temporally; continue the declared6k/12k training but do not select or transfer this3k checkpoint. + +### E96 four-cutoff equal ensemble selection +{ + "valid_screen": { + "candidate": 0.384594982171353, + "E87": 0.38368555666405846, + "cpu_seconds": 1.4111226599197835, + "groups": { + "term": { + "short": 0.3668858469093572, + "medium": 0.4077230710992221, + "long": 0.40635338876251526 + }, + "domain": { + "Econ/Fin": 0.14395536397825648, + "Energy": 0.24582427470581425, + "Healthcare": 0.4767476122577817, + "Nature": 0.44212246483547213, + "Sales": 0.34646504369353526, + "Transport": 0.46693421316839256, + "Web/CloudOps": 0.5034023313828211 + }, + "freq": { + "A-DEC": 0.37656040036707195, + "Q-DEC": 0.20077338922637145, + "M": 0.1185115893357509, + "W-SUN": 0.10525031522270123, + "D": 0.36189985298754856, + "H": 0.40144834519193306, + "15T": 0.21610876368843102, + "W-FRI": 0.015068318308339101, + "10T": 0.6264434570332911, + "W-TUE": 0.6245141515082602, + "W-THU": 0.20878118292775294, + "W-WED": 0.32985721333447826, + "5T": 0.5176096384720621, + "10S": 0.4242433666861485 + } + } + }, + "valid_backcast": { + "candidate": 0.33975008510701665, + "E87": 0.33897078175106665, + "cpu_seconds": 1.2138579529710114, + "groups": { + "term": { + "short": 0.30570414138317814, + "medium": 0.3609015682591047, + "long": 0.4020582836765434 + }, + "domain": { + "Econ/Fin": 0.1743856017696448, + "Energy": 0.23046498734519416, + "Healthcare": 0.4113970603320174, + "Nature": 0.3716618234366038, + "Sales": 0.408030987603086, + "Transport": 0.3731794302285525, + "Web/CloudOps": 0.451509629697311 + }, + "freq": { + "A-DEC": 0.3279717662601809, + "Q-DEC": 0.2380599535136222, + "M": 0.19905386528004188, + "W-SUN": 0.04880471728272662, + "D": 0.35315023295661196, + "H": 0.3711978117933119, + "15T": 0.22358807419379623, + "W-FRI": 0.22824822674434042, + "10T": 0.322600023714811, + "W-TUE": 0.547413555209586, + "W-THU": 0.24438059706818105, + "W-WED": 0.3628856336883284, + "5T": 0.4412301876136191, + "10S": 0.3475276102698931 + } + } + }, + "valid_backcast2": { + "candidate": 0.36472017597795625, + "E87": 0.36315845377936284, + "cpu_seconds": 1.3266870640218258, + "groups": { + "term": { + "short": 0.35192307261410094, + "medium": 0.39289736169887557, + "long": 0.36886086281920194 + }, + "domain": { + "Econ/Fin": 0.11936723839740782, + "Energy": 0.24270008941522314, + "Healthcare": 0.34837441457268725, + "Nature": 0.4771559710187644, + "Sales": 0.556902251507494, + "Transport": 0.4248139750422676, + "Web/CloudOps": 0.43759149119826346 + }, + "freq": { + "A-DEC": 0.3311026308933668, + "Q-DEC": 0.15378540101465998, + "M": 0.16020062601089513, + "W-SUN": 0.06801117727416384, + "D": 0.4305843857907744, + "H": 0.3953546731641614, + "15T": 0.10577250483830014, + "W-FRI": 0.15138877778445536, + "10T": 0.5095975609862264, + "W-TUE": 0.10847360375070303, + "W-THU": 0.3459885667095576, + "W-WED": 0.5660655173116367, + "5T": 0.4731902812063754, + "10S": 0.28592028110498247 + } + } + }, + "valid_backcast3": { + "candidate": 0.389238119545644, + "E87": 0.3893067316884232, + "cpu_seconds": 1.2415199128445238, + "groups": { + "term": { + "short": 0.39417395687284207, + "medium": 0.36821605147108216, + "long": 0.396861173789945 + }, + "domain": { + "Econ/Fin": 0.18370373648624572, + "Energy": 0.31629238352886546, + "Healthcare": 0.2377535675450031, + "Nature": 0.5072143926034133, + "Sales": 0.40117499834543047, + "Transport": 0.5090476109622039, + "Web/CloudOps": 0.39339169169310506 + }, + "freq": { + "A-DEC": 0.3399962169002898, + "Q-DEC": 0.25825750036173534, + "M": 0.14131510737146213, + "W-SUN": 0.1672885644844745, + "D": 0.4408980632536098, + "H": 0.4067494659465881, + "15T": 0.2551059021117046, + "W-FRI": 0.016583036267497464, + "10T": 0.6063638743127748, + "W-TUE": 0.2532467022883038, + "W-THU": 0.3464821396686204, + "W-WED": 0.3777825141129817, + "5T": 0.46382868467749705, + "10S": 0.29461185618122454 + } + } + } +} +Three gains and effectively tied third cutoff justify full public-interface replay. Candidate descriptor1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b,110064120parameters. Every member retains its exact model code; shared postprocessing hashes checked during assembly. E87 remains published pending complete replay and checks. + +Fresh37M state preservation: wait for its complete recovery024000 state and archive model/EMA/Adam/allRNG/prefetchedbatch to random_capacity_512_recovery024000.pt. This is a zero-update checkpoint snapshot, not a new experiment or a changed active schedule. It preserves the option of a later controlled annealing comparison without repeating pretraining. No continuation is queued. + +Data preparation extension, no training scheduled: create packed_stratified_large with192Mpoint/source softcaps using the identical E95all-shard code/min16/maxcrop131072 and directory/per-series RNGs. Because global series order and crops are cap-independent, the24Mpack should be an exact per-source binary/record prefix of the192Mpack. Check that invariant before any future data-scaling experiment. This artifact is separate from E95training, which remains queued on the24Mpack. No new source directories/generators or validation data. Two CPUworkers; GPUtraining schedules unchanged. + +## E79 fresh146M at8000 +- Checkpoint SHA-256: `12ad3e4b1be6b38b31a3dee057805e2a532f48fe3723f6bcefb15ba63ca8ee97`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 39.91020727157593 seconds. +- Overall skill 0.343979; relative MASE 0.773251; relative WQL 0.556563. +- term skill: long=0.3755, medium=0.3854, short=0.3146. +- domain skill: Econ/Fin=0.1160, Energy=0.1969, Healthcare=0.3682, Nature=0.4144, Sales=0.3129, Transport=0.4343, Web/CloudOps=0.4719. +- frequency skill: A=0.3662, D=0.3440, H=0.3640, M=-0.0514, Q=0.1891, S=0.4174, T=0.3968, W=0.1930. +- variates skill: multivariate=0.3619, univariate=0.3293. +- Outcome: Main0.343979357 improves4000 0.328133919; still below matched37M8000 0.353508836, with a narrowing gap. Continue declared16k/24k; seed307/B48/LR2e-4/96k. E94halfLR is a separate matched optimization arm. + +## E79 fresh37M at16000 +- Checkpoint SHA-256: `a83c2bee0b284ab22ebb5107d79e2ff2ecd29a7de9a384d46d175dbffcf2c5b4`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.48415732383728 seconds. +- Overall skill 0.355318; relative MASE 0.763624; relative WQL 0.544266. +- term skill: long=0.3802, medium=0.3960, short=0.3290. +- domain skill: Econ/Fin=0.1292, Energy=0.2122, Healthcare=0.3475, Nature=0.4103, Sales=0.3304, Transport=0.4455, Web/CloudOps=0.4937. +- frequency skill: A=0.3719, D=0.3210, H=0.3755, M=0.0179, Q=0.1815, S=0.4231, T=0.4098, W=0.2504. +- variates skill: multivariate=0.3787, univariate=0.3361. +- Outcome: Main0.355318072 improves8000 0.353508836 only modestly. Continue original96k schedule unchanged and preserve complete24kstate for a possible later annealing comparison. Seed307/B48/LR2e-4, own scratch initialization. + +## E90 daily-weekly loss scale at6000 +- Checkpoint SHA-256: `d6b3d3e30290a9360789d236565ecb0acf410d4605bb50821f30b7886ed2d349`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 23.801913261413574 seconds. +- Overall skill 0.378435; relative MASE 0.743624; relative WQL 0.519542. +- term skill: long=0.4018, medium=0.4074, short=0.3577. +- domain skill: Econ/Fin=0.1254, Energy=0.2397, Healthcare=0.4663, Nature=0.4297, Sales=0.3355, Transport=0.4644, Web/CloudOps=0.5032. +- frequency skill: A=0.3677, D=0.3561, H=0.3960, M=0.0989, Q=0.1934, S=0.4243, T=0.4382, W=0.2295. +- variates skill: multivariate=0.3971, univariate=0.3632. +- Outcome: Main0.378434765 slightly exceeds matched E806000 0.378288765, reversing its small3k deficit. Effect is inconsistent and small; finish12k, then assess targeted frequency groups. Seed197/B64/LR2e-5. + +## E89 patch8 control final12000 +- Checkpoint SHA-256: `80519b37e670050b23c231718210bf49aaa64b5396e301a44975140d8075a85a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.017725229263306 seconds. +- Overall skill 0.380847; relative MASE 0.742398; relative WQL 0.516367. +- term skill: long=0.4032, medium=0.4046, short=0.3626. +- domain skill: Econ/Fin=0.1449, Energy=0.2438, Healthcare=0.4363, Nature=0.4433, Sales=0.3387, Transport=0.4634, Web/CloudOps=0.5028. +- frequency skill: A=0.3691, D=0.3616, H=0.3940, M=0.0837, Q=0.1978, S=0.4249, T=0.4461, W=0.2290. +- variates skill: multivariate=0.3988, univariate=0.3662. +- Outcome: Final0.380847096 rebounds from6000 0.377734884 as the learning rate falls; still below initial selected E71parent0.381178739. Preserve as the final matched reference for fullpatch4 and input8/output4, which are still training. Seed401/B32/LR2e-5; do not infer final architectural superiority from the6k comparison alone. Released allocation to E94fresh146M halfLR. + +## Larger all-shard data preparation, no optimizer updates +Same fixed global-series order and crop rules as E95, raising only the per-directory cap from24M to192M points. Packed5,354,822,975points in1,059,868series across95allowed directories;125.173232s with2CPU workers. Independent260series Arrow replay plus binary/record-prefix checks for all95directories passed in19.984999s, seed461; source probabilities bitwise match the original source mixture. The24M pack is exactly a prefix within every source. Audit stratified_large_audit.json; no validation read and no training on this larger pack scheduled yet. + +E89patch8control final12000 training loop2729.052105s on shared singleH100; validation/hash/group results recorded above. No continuation of completed control. + +## E92 robust normalization at6000 +- Checkpoint SHA-256: `3c76ff01356bdf0de6219a0937fe43c25175caef19d4324b4e73c39310659fce`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.452584981918335 seconds. +- Overall skill 0.377780; relative MASE 0.743560; relative WQL 0.520681. +- term skill: long=0.4010, medium=0.4074, short=0.3568. +- domain skill: Econ/Fin=0.1250, Energy=0.2380, Healthcare=0.4626, Nature=0.4291, Sales=0.3516, Transport=0.4654, Web/CloudOps=0.5006. +- frequency skill: A=0.3659, D=0.3537, H=0.3957, M=0.1211, Q=0.1920, S=0.4237, T=0.4359, W=0.2278. +- variates skill: multivariate=0.3949, univariate=0.3638. +- Outcome: Main0.377780381 is below matched overflow-only E80at6000 0.378288765; earlier3k already regressed at all three cutoffs. Continue the predeclared final12k but no6k selection or composition. Seed197/B64/LR2e-5; normalization is the only changed factor. + +## E96 three-patch equal ensemble full public replay — selected +- Checkpoint SHA-256: `1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.380721; relative MASE 0.740204; relative WQL 0.518109. +- term skill: long=0.4003, medium=0.4066, short=0.3628. +- domain skill: Econ/Fin=0.1244, Energy=0.2393, Healthcare=0.4812, Nature=0.4421, Sales=0.3603, Transport=0.4671, Web/CloudOps=0.4951. +- frequency skill: A=0.2988, D=0.3660, H=0.3960, M=0.1437, Q=0.1866, S=0.4242, T=0.4364, W=0.2370. +- variates skill: multivariate=0.3947, univariate=0.3694. +- Outcome: Full validation skill0.380721445 improves E87by0.001091552; relativeMASE0.740203875 andrelativeWQL0.518108512 both improve. All97configs/151170instances,0failures,441.765573 inference seconds on shared singleH100. Every member forecasts every instance, equal1/3 weights fixed before replay; no extra training. Relocation bitwise/finite/ordered checks passed in33.315708s; independent third-member public replay10.848689s and bitwise three-member composition0.027575CPU s passed. Three of four selection cutoffs improve; third earlier loss0.0000686. Full55/97configs improve; descriptive dataset-bootstrap interval spans zero, so the small adaptive-validation gain is not a held-out significance claim. Publish the strongest complete replayable candidate; continue research. + +## E97 explicit weekly synthetic coverage — preparation +Hypothesis: the existing20% synthetic mixture omits[52,1]weekly seasonality, contributing to weak weekly transfer. Replace exactly a Bernoulli1/11 share of synthetic windows with the same own Fourier/trend/AR/intermittency/changepoint generator atperiods[52,1]. The total synthetic fraction remains20%; all ten original period families retain expected weight1/11 and the new weekly family gains1/11. Always consume the original generator first; independent RNGseed1000200 chooses/re-generates weekly windows, preserving every real row and non-replaced synthetic row and the original sampler/horizon streams bitwise. No other history/target-length change. Match E80overflow-only: ownE62 initialization,seed197/B64/LR2e-5/12000paired steps,original packed_sample/source probabilities/model/loss/runtime. Screen1/3/6/12k; require sampler stream/recovery checks before queueing after E92 completes. No validation used for generation or optimization; declare the new local generator if published. + +E97sampler check: {"seed": 467, "rows": 7680, "original_synthetic_rows": 1543, "replaced_weekly_rows": 134, "probability": 0.09090909090909091, "original_and_horizon_rng_bitwise_preserved": true, "unmodified_rows_bitwise_preserved": true, "finite_masks_unchanged": true, "all_numpy_rng_recovery_exact": true, "model_sha256": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", "model_bitwise_unchanged": true, "seconds": 3.6882259079720825, "optimizer_updates": 0, "validation_data_read": false} +Queue declared after E92PID9354, requiring its final recovery. Existing model code is byte-identical to E80, so no new GPU arithmetic fixture is needed for this data-only change. Full command is weekly_synth_queue.json; launcher weekly_synth/launch.py. + +## E93 input8/output4 at6000 +- Checkpoint SHA-256: `8afbf4d2008aa7d5dab4ecbdcd1685f1a59b8fcb739a39f65fa8ba4b8cb4be9d`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 36.958359479904175 seconds. +- Overall skill 0.380224; relative MASE 0.742564; relative WQL 0.517292. +- term skill: long=0.4044, medium=0.4022, short=0.3620. +- domain skill: Econ/Fin=0.1461, Energy=0.2357, Healthcare=0.4662, Nature=0.4406, Sales=0.3432, Transport=0.4673, Web/CloudOps=0.5003. +- frequency skill: A=0.3656, D=0.3580, H=0.3941, M=0.1089, Q=0.2009, S=0.4225, T=0.4400, W=0.2482. +- variates skill: multivariate=0.3938, univariate=0.3692. +- Outcome: Main0.380224037 is between matched fullpatch4at6000 0.380540506 and patch8control0.377734884, below selected starting E71parent0.381178739. The decoder-only refinement recovers most of the full-resolution gain at lower encoder cost; continue final12k before any ensemble replacement. Seed401/B32/LR2e-5, same original generator. + +## E98 completion of deliberately pruned E75 schedule — declared revisit +E75 was intentionally stopped at3653 after earlier-cutoff regressions; that decision and its stopfile remain intact. E89patch8control subsequently recovered from0.377734884 at6k to0.380847096 at12k as learning rate decayed, showing that an intermediate trough can conceal a late recovery. Revisit the incomplete E75 schedule under a separate output, postloss_completion, by preserving and restoring its exact3653 model/EMA/Adam/allRNG/prefetched state. Continue original steps3654..12000 with the unchanged12k cosine schedule,seed197/B64/LR2e-5,original data/generator and postprocessing-aware objective. No new recipe factor and no reset; this is a completion of a previously pruned experiment, not an independent replication. Model/data/torch_post code byte-match the original archived provenance. Compare6k/12k against E80overflow-only, and examine earlier cutoffs before any composition. Queue only after E93 releases its allocation; retain original postloss.stop and all negative results. + +E98exact restart snapshot: {"source": "/workspace/research/runs/postloss/recovery.pt", "output": "/workspace/research/postloss_recovery003653.pt", "step": 3653, "sha256": "7d81547596356906fbac3a9aa3d47f84c27eabf845ba26e2c3c74ec369923c01", "seconds": 1.7649966378230602, "preserves": "model, EMA, optimizer, all RNG states and prefetched batch", "optimizer_updates": 0} +Queued after E93PID9274; launcher postloss/launch_completion.py, completecommand postloss_completion_queue.json. No GPU fixture repeated because model/loss/data code is identical to already verified E75, and no new optimizer update occurred during preparation. + +## E79 fresh37M at24000 +- Checkpoint SHA-256: `fbdb51213b3cf165273c4ea83c2386ec0bd496b182e31d57f421eee29c0da28a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.551169872283936 seconds. +- Overall skill 0.357902; relative MASE 0.763517; relative WQL 0.539988. +- term skill: long=0.3831, medium=0.3912, short=0.3346. +- domain skill: Econ/Fin=0.1259, Energy=0.2164, Healthcare=0.3681, Nature=0.4073, Sales=0.3362, Transport=0.4526, Web/CloudOps=0.4919. +- frequency skill: A=0.3818, D=0.3384, H=0.3762, M=0.0189, Q=0.1970, S=0.4195, T=0.4130, W=0.2313. +- variates skill: multivariate=0.3766, univariate=0.3426. +- Outcome: Main0.357901602 improves16k0.355318072 but still trails the mature scratch lineage. Continue original96k schedule unchanged. Exact24k model/EMA/Adam/allRNG/prefetch snapshot preserved for a separately declared cooldown comparison; no continuation launched yet. Seed307/B48/LR2e-4/static compiled paired loss/slowAR original source mixture. + +E79small immutable24k snapshot: {"source": "/workspace/research/runs/random_capacity_512/recovery.pt", "output": "/workspace/research/random_capacity_512_recovery024000.pt", "step": 24000, "sha256": "32de72f3d09f8eee785c1d19a279541348de7ba129f79d62e5824e1223e19322", "seconds": 2.042371174087748, "preserves": "model, EMA, optimizer, all RNG states and prefetched batch", "optimizer_updates": 0} + +## E99 matched early cooldown of fresh37M model — declared +Hypothesis: E79fresh37M is held back by the still-high96k-schedule learning rate, rather than only a lack of capacity. Branch from the exact immutable24000 training state (SHA32de72f3d09f8eee785c1d19a279541348de7ba129f79d62e5824e1223e19322), preserving model/EMA/Adam/allRNG/prefetched batch. Change only the next12000-step learning-rate schedule: smoothly cosine-decay from the original step24000 rate0.00017656854249492381 to0.00001 at36000, with no optimizer reset or rewarmup. Original E79continues its96k schedule unchanged. Same seed307/B48/static compiled paired objective/slowAR generator/original pack and source probabilities. Compare candidate and original at global30000/36000; earlier windows only for a promising candidate. Queue after E89fullpatch4 releases its allocation. Default schedule arithmetic was verified bitwise at140000steps across three existing recipes; cooldown joins exactly and decreases monotonically. No GPU arithmetic or model change; reuse existing compiled/eager-gradient fixtures. +E99schedule checks: {"default_steps_bitwise_equal": 140000, "join_step": 24000, "join_lr": 0.00017656854249492381, "end_step": 36000, "end_lr": 1e-05, "schedule": "cosine from original step24000 rate to1e-5 by36000, no warmup/reset", "optimizer_updates": 0, "validation_data_read": false, "seconds": 0.14022667310200632} + +## E94 fresh146M halfLR first4000 +- Checkpoint SHA-256: `62c59ba50647d301fd5afd846b25c03271fe35b7d97fe63f5b2f7b931957090b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 41.465235233306885 seconds. +- Overall skill 0.336895; relative MASE 0.784082; relative WQL 0.560794. +- term skill: long=0.3621, medium=0.3772, short=0.3107. +- domain skill: Econ/Fin=0.1179, Energy=0.2132, Healthcare=0.2861, Nature=0.4034, Sales=0.2941, Transport=0.4230, Web/CloudOps=0.4607. +- frequency skill: A=0.3563, D=0.3278, H=0.3600, M=-0.0301, Q=0.1751, S=0.4173, T=0.3872, W=0.1853. +- variates skill: multivariate=0.3571, univariate=0.3204. +- Outcome: Lower LR1e-4 improves matched146M4k main0.328133919 to0.336895196, still below37Mcontrol0.341861940. All three terms improve over high-LR146M; large capacity is not yet better than the smaller model. Afterwarmup its matched training loss beats high-LR146M consistently and slightly beats37M by steps2001..4000. Continue8k/16k before selecting a larger-corpus fresh recipe. Same initial weights/seed307/B48/data/objective; only learning rate changed. + +E79/E94matched first4k loss/compute: {"random_capacity_512": {"1-400": 0.4342267720028758, "401-1000": 0.3975941499322653, "1001-2000": 0.381371116399765, "2001-3000": 0.37428912545740606, "3001-4000": 0.3616653003469109, "through4000_loop_seconds": 1106.1}, "random_capacity_1024": {"1-400": 0.4301105997338891, "401-1000": 0.40223139939208824, "1001-2000": 0.3863489354848862, "2001-3000": 0.3779264837577939, "3001-4000": 0.36658306304365396, "through4000_loop_seconds": 1563.7}, "random_capacity_1024_halflr": {"1-400": 0.4339301012828946, "401-1000": 0.39748335411151253, "1001-2000": 0.3812341860383749, "2001-3000": 0.3728542738109827, "3001-4000": 0.36091782905161385, "through4000_loop_seconds": 1064.5}}. Shared-H100 process times include differing compiler-cache warm-up and are not exclusiveGPU efficiency measurements. + +E95 all-shard corpus seed197 training started at 2026-10-23T04:58:12Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E90 daily-weekly loss scale final12000 +- Checkpoint SHA-256: `4c5641b649529f9ac36c8679289c64bacf0b30e11dae8428620a0d59e56ffabc`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 24.18997550010681 seconds. +- Overall skill 0.377373; relative MASE 0.744776; relative WQL 0.520511. +- term skill: long=0.4024, medium=0.4060, short=0.3561. +- domain skill: Econ/Fin=0.1328, Energy=0.2359, Healthcare=0.4455, Nature=0.4306, Sales=0.3355, Transport=0.4657, Web/CloudOps=0.5050. +- frequency skill: A=0.3617, D=0.3526, H=0.3946, M=0.1059, Q=0.1975, S=0.4251, T=0.4399, W=0.2154. +- variates skill: multivariate=0.3960, univariate=0.3621. +- Outcome: Final main0.377373344 is effectively tied but slightly below matched E80overflow-only0.377423946. The isolated seasonal-loss-lag change has no sustained overall gain across1k/3k/6k/12k. Seed197/B64/LR2e-5; completed2702.166704 shared-H100 training-loop seconds. No candidate publication; E95broader-source-coverage starts in the released allocation. + +## E100 equal probability-distribution pool — predeclared cached comparison +Hypothesis: E96quantile averaging omits dispersion due to disagreement among its three members. Keep exactly the E83/E71/E89fixed models and equalweights, but average their CDFs and invert for the nine deciles. Each member distribution is piecewise-linear through its predicted deciles, extended to probabilities0/1 by one adjacent endpoint spacing; repeated quantiles retain atoms. Evaluate all four cached cutoffs, with no coefficient/tail-setting sweep and zero optimizer updates. Every member still forecasts every instance. Initial local fixture found only5.55e-17roundoff around exactzero; enforcing the mathematical bound between member quantiles at each level corrected it before any validation read. Identical-member, uniform-mixture, sign/affine, finite/ordered and chunk-size checks passed: {"seed": 479, "identical_members_bitwise_identity": true, "uniform_mixture_exact_within_float32": true, "atoms_at_zero_preserved": true, "ordered_finite": true, "chunk_size_bitwise_independent": true, "sign_reflection_and_affine_equivariance": true, "optimizer_updates": 0, "seconds": 0.09868191904388368} + +## E95 all-shard source coverage first1000 +- Checkpoint SHA-256: `17b2a03d282c141dbd68ac7f68df4626802f1a0323fff313f1a28192c5068b5b`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.06695008277893 seconds. +- Overall skill 0.377028; relative MASE 0.744820; relative WQL 0.521057. +- term skill: long=0.3997, medium=0.4068, short=0.3562. +- domain skill: Econ/Fin=0.1378, Energy=0.2376, Healthcare=0.4487, Nature=0.4311, Sales=0.3344, Transport=0.4669, Web/CloudOps=0.4993. +- frequency skill: A=0.3724, D=0.3543, H=0.3951, M=0.1080, Q=0.1986, S=0.4218, T=0.4370, W=0.2193. +- variates skill: multivariate=0.3940, univariate=0.3632. +- Outcome: Main0.377028371 exceeds matched E80at1000 0.376804394 by0.000223977. Medium/long improve while short is nearly unchanged; still below E62initialization0.377343216, so no selection claim yet. Continue3k/6k/12k. Seed197/B64/LR2e-5; pack coverage changes at nearly identical volume, same original source probabilities/model/loss/generator. + +E97 weekly synthetic coverage seed197 training started at 2026-10-23T05:06:47Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +### E100 probability-pool outcome — rejected +{"cutoff": "valid_screen", "skill_score": 0.38447708223972143, "rel_mase_gmean": 0.7377458188534619, "rel_wql_gmean": 0.5135487760227904, "groups": {"term": {"short": 0.36645074748329265, "medium": 0.40785519113120783, "long": 0.4067636672388967}, "domain": {"Econ/Fin": 0.14348007471775803, "Energy": 0.2450499585597603, "Healthcare": 0.4778661939355727, "Nature": 0.44167938695480613, "Sales": 0.34589247896287667, "Transport": 0.46735333815132574, "Web/CloudOps": 0.5036629603237621}, "freq": {"A-DEC": 0.37569899250005157, "Q-DEC": 0.20013922343000312, "M": 0.12148678908575261, "W-SUN": 0.10281895779812733, "D": 0.3613770705448509, "H": 0.40132102430667216, "15T": 0.21622161251725824, "W-FRI": 0.010849753325401168, "10T": 0.6253364743600922, "W-TUE": 0.6270406616896087, "W-THU": 0.2100424900094875, "W-WED": 0.3297769734384489, "5T": 0.5175830091172531, "10S": 0.424444633099896}}, "cpu_seconds": 59.980443592881784, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.384594982171353, "skill_difference": -0.00011789993163158208} +{"cutoff": "valid_backcast", "skill_score": 0.3396884750452879, "rel_mase_gmean": 0.7937686109009007, "rel_wql_gmean": 0.5492927082278539, "groups": {"term": {"short": 0.305359424616949, "medium": 0.3615421761351466, "long": 0.4019782542502155}, "domain": {"Econ/Fin": 0.17397857577775933, "Energy": 0.23077587806776068, "Healthcare": 0.4105170158829923, "Nature": 0.37090555838048966, "Sales": 0.40754241032517846, "Transport": 0.3735854351257373, "Web/CloudOps": 0.4515115490492597}, "freq": {"A-DEC": 0.3285015352119629, "Q-DEC": 0.23809442338781928, "M": 0.19846718923537676, "W-SUN": 0.044551228029835244, "D": 0.3527581961201992, "H": 0.37195542467805676, "15T": 0.22380832764902536, "W-FRI": 0.22713834170412128, "10T": 0.3209843494303689, "W-TUE": 0.5471337430335201, "W-THU": 0.24671528715780322, "W-WED": 0.36065042452889085, "5T": 0.440176624512733, "10S": 0.34765351732372307}}, "cpu_seconds": 57.84474289207719, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.33975008510701665, "skill_difference": -6.161006172877848e-05} +{"cutoff": "valid_backcast2", "skill_score": 0.3643569364713283, "rel_mase_gmean": 0.7656814703595871, "rel_wql_gmean": 0.5276895417390272, "groups": {"term": {"short": 0.35141014761082046, "medium": 0.3925477275360366, "long": 0.36889675295988844}, "domain": {"Econ/Fin": 0.11837724372992486, "Energy": 0.24257682706622608, "Healthcare": 0.3484957338430069, "Nature": 0.4765403493474547, "Sales": 0.5563991023520016, "Transport": 0.425156500116473, "Web/CloudOps": 0.43670286593915697}, "freq": {"A-DEC": 0.32966975290636025, "Q-DEC": 0.15381819951222442, "M": 0.15901923467685497, "W-SUN": 0.06330956349285344, "D": 0.43027727492156853, "H": 0.39548623856812215, "15T": 0.10618336189249866, "W-FRI": 0.14996401232455647, "10T": 0.5090292906528928, "W-TUE": 0.11021265661815505, "W-THU": 0.34484214889524656, "W-WED": 0.565895835912684, "5T": 0.47197167812560914, "10S": 0.2855930392816969}}, "cpu_seconds": 55.48255044897087, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.36472017597795625, "skill_difference": -0.000363239506627977} +{"cutoff": "valid_backcast3", "skill_score": 0.3894908456851319, "rel_mase_gmean": 0.7395191359520792, "rel_wql_gmean": 0.5040051154624993, "groups": {"term": {"short": 0.3944986218711739, "medium": 0.3683905810196345, "long": 0.3969887061132117}, "domain": {"Econ/Fin": 0.18408496490995196, "Energy": 0.3168114104271367, "Healthcare": 0.23983131130227353, "Nature": 0.5064220935312094, "Sales": 0.40140535360155616, "Transport": 0.5096985006120188, "Web/CloudOps": 0.393462743970424}, "freq": {"A-DEC": 0.34218212975771833, "Q-DEC": 0.25834447555512075, "M": 0.14460929216407215, "W-SUN": 0.16537651572223833, "D": 0.4408650435087358, "H": 0.40698403946159434, "15T": 0.25514902945862916, "W-FRI": 0.019067740904430974, "10T": 0.6070205489033722, "W-TUE": 0.25089200168813297, "W-THU": 0.3450365084609506, "W-WED": 0.378097845878244, "5T": 0.46374932773306954, "10S": 0.2954018250276097}}, "cpu_seconds": 54.93674235115759, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "e50a2d43bb3b6b66a94a6a2d9d62f0cb3e404310352e0357cfe0f2a874a21727"], "quantile_mean_skill": 0.389238119545644, "skill_difference": 0.0002527261394879021} +Probability pooling loses main and the first two earlier cutoffs, improving only the third. Retain E96 equal quantile averaging; no full replay or runtime publication. Zero optimizer updates; full CPU comparison time228.244479s, local fixture seed479. + +## E101 own-ensemble distillation — prepared, not queued + + +Prepared design, not yet queued. Complete the listed checks and record the exact experiment before launch. No external models, weights or data. + +Hypothesis: the larger fresh model can learn useful conditional forecasts faster when its proper real-target objective is supplemented by dense quantile targets from our own mature scratch-trained ensemble. This differs from the failed direct width conversions and protected random feature grafts: all student parameters begin at the same random initialization as E94. + +Match E94 exactly: own random_capacity_1024_initial.pt, seed307, batch48 distinct windows/96 signed rows, learning rate1e-4,96000-step schedule,400warmup, compiled paired-sign loss, original packed_sample/source probabilities,20% own slow-AR synthetic generator, original requested-horizon stream. Only the additional teacher loss changes. E94 remains the real-target-only control. + +Teacher: frozen E96 three members, descriptor1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b. Use each member's sign-averaged normalized neural quantiles BEFORE fixed postprocessing, then equal averaging. All members share the same ordinary-row normalization at training shapes (contexts are multiples of512); verify that. Pass the same per-row available forecast lengths to each member's partial-target mask. Mask teacher loss on rows with any nonfinite member normalization/output; retain the original real-target objective on those rows. The student loss and runtime remain the original E94 neural objective and fixed inference rules, so there is no simultaneous postprocessing-aware-loss change. + +Add coefficient0.5 times a teacher L1 objective: per valid target step,0.5*mean(abs(student_quantiles-teacher_quantiles)) +0.25*abs(student_median-teacher_median); average over the same valid target positions and apply the same context seasonal-error weight, normalized over teacher-valid rows. No coefficient sweep. The real-target objective is unchanged and retains weight1. Teacher targets are constants, with no gradients or updates to teacher weights. All teacher windows come only from the allowed sampler; no validation inputs or labels enter training. + +Compute teacher targets outside the compiled student objective. Student model state/config must retain exactly E94 keys and parameter count; teacher modules must not be registered on the student or enter its optimizer/EMA/checkpoints. Record teacher descriptor and all three checkpoint hashes in training args/lineage, and automatically declare own-teacher pseudo-target generation in sources_used on publication. Archive teacher code and generation code in provenance; deployed inference loads only the student. + +Required checks: zero teacher coefficient reproduces original loss/gradients on identical own-generated fixtures; teacher sign averaging/normalization matches independent raw-member forward passes; teacher parameters remain unchanged and have no gradients; student gradients finite; complete sampler/RNG recovery unchanged; eager/compiled gradient comparison; maximum-shape memory including student EMA/Adam and teacher weights. Initial fixture has zero optimizer updates. Runtime is unchanged random_capacity_inference. + +Potential allocation: queue only after both E99cooldown and E97weekly training finish, using their queue processes/checkpoint dependencies rather than unknown future trainer PIDs. Their released combined memory is sufficient for146M student plus frozen teacher. Watch4/8/16/24k before deciding longer allocation. Do not launch until code, checks, exact recipe declaration and source-lineage handling are complete. + +CPUfixture: {"seed": 487, "seconds": 5.1773834731429815, "teacher_descriptor_sha256": "1503d92ce031ec0c0e0533ece20d0516a0eceb134802d51746e24a44c4b5ee9b", "teacher_parameters": 110064120, "teacher_weights_frozen_bitwise": true, "teacher_gradients_absent": true, "independent_raw_member_average_bitwise": true, "ordinary_normalization_bitwise_same": true, "overflow_teacher_row_excluded_only_from_auxiliary": true, "sign_reflection_equivariant": true, "zero_coefficient_loss_and_gradients_bitwise_control": true, "student_state_keys_unchanged": true, "sampler_code_bitwise_control": true, "all_student_gradients_finite": true, "real_loss": 7.174529552459717, "combined_loss": 7.284832954406738, "optimizer_updates": 0, "validation_data_read": false} +Frozen teacher assets copied to distill_teacher_E96; descriptor unchanged. No student optimizer updates yet. + +## E92 robust normalization final12000 — rejected +- Checkpoint SHA-256: `25be8396d4a8c6ea98c67bca79060c4979a2829661016f0ed51b4e98c897c688`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.238795042037964 seconds. +- Overall skill 0.377099; relative MASE 0.744448; relative WQL 0.521199. +- term skill: long=0.4035, medium=0.4066, short=0.3549. +- domain skill: Econ/Fin=0.1295, Energy=0.2365, Healthcare=0.4448, Nature=0.4270, Sales=0.3471, Transport=0.4672, Web/CloudOps=0.5036. +- frequency skill: A=0.3570, D=0.3466, H=0.3946, M=0.1215, Q=0.1971, S=0.4235, T=0.4392, W=0.2223. +- variates skill: multivariate=0.3955, univariate=0.3620. +- Outcome: Final main0.377099312 is below matched overflow-only E80final0.377423946. The3k main gain did not transfer to any earlier cutoff, and6k/final main also regress. Reject this normalization change; retain ordinary statistics with the overflow-only fallback. Seed197/B64/LR2e-5, no new sources/generator. E97weekly-synthetic run has started in the released allocation. + +E92finalcompute: {"completed_step": 12000, "training_process_loop_seconds": 2692.7444765449036} + +## E79 fresh37M at30000, E99 future matched control +- Checkpoint SHA-256: `7965d1fe4b831143de6280ae873ec61a8024dbb6a14da5dfae1ef58098c33a59`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.895771265029907 seconds. +- Overall skill 0.358564; relative MASE 0.761438; relative WQL 0.540346. +- term skill: long=0.3844, medium=0.3900, short=0.3358. +- domain skill: Econ/Fin=0.1162, Energy=0.2193, Healthcare=0.3709, Nature=0.4110, Sales=0.3395, Transport=0.4511, Web/CloudOps=0.4907. +- frequency skill: A=0.3754, D=0.3312, H=0.3793, M=0.0636, Q=0.1845, S=0.4178, T=0.4155, W=0.2110. +- variates skill: multivariate=0.3768, univariate=0.3436. +- Outcome: Main0.358563990 improves24k0.357901602 by0.000662387 under the original96k schedule. This is the exact global30k control for the separately queued E99cooldown; no E99outcome yet. Seed307/B48/LR2e-4; continue unchanged original schedule. + +## E79 fresh146M at16000 +- Checkpoint SHA-256: `959ff6c885777e971d4ee25729d3406485404a69a0bbfe320959506b180e9e35`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 39.40332913398743 seconds. +- Overall skill 0.349499; relative MASE 0.768924; relative WQL 0.550316. +- term skill: long=0.3865, medium=0.3939, short=0.3166. +- domain skill: Econ/Fin=0.1199, Energy=0.2111, Healthcare=0.2664, Nature=0.4047, Sales=0.3301, Transport=0.4402, Web/CloudOps=0.4965. +- frequency skill: A=0.3766, D=0.3221, H=0.3700, M=-0.0589, Q=0.1818, S=0.4218, T=0.4156, W=0.1984. +- variates skill: multivariate=0.3768, univariate=0.3269. +- Outcome: Main0.349499286 improves8k0.343979357 but still trails matched37M16k0.355318072. Gap narrows to0.005818787; no capacity advantage established. Same seed307/B48/LR2e-4; continue24k while E94halfLR comparison matures. + +## E95 all-shard source coverage at3000 +- Checkpoint SHA-256: `ed98a18948ae0ad7cc18f1e2eb653f9af6bd6545ad81daa897b167b5ccf529ce`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.239446878433228 seconds. +- Overall skill 0.376742; relative MASE 0.745627; relative WQL 0.520972. +- term skill: long=0.4002, medium=0.4075, short=0.3552. +- domain skill: Econ/Fin=0.1328, Energy=0.2374, Healthcare=0.4444, Nature=0.4331, Sales=0.3350, Transport=0.4645, Web/CloudOps=0.5005. +- frequency skill: A=0.3721, D=0.3540, H=0.3968, M=0.0980, Q=0.1953, S=0.4214, T=0.4362, W=0.2177. +- variates skill: multivariate=0.3948, univariate=0.3620. +- Outcome: Main0.376741687 falls below matched E80at3000 0.378663825, reversing the small1k advantage. Broader uniform source coverage has not shown a sustained benefit in this mature-model continuation. Continue declared6k/12k before any data-mixture conclusion. Seed197/B64/LR2e-5, nearly matched packed volume and identical source probabilities. + +E98 complete original E75 schedule training started at 2026-10-23T05:11:48Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +E101GPUfixture: {"initialization_seed": 307, "fixture_seed": 491, "optimizer_updates": 0, "maximum_shape_memory": {"batch": 48, "signed_rows": 96, "context": 4096, "horizon": 1024, "student_parameters": 146477344, "teacher_parameters": 110064120, "loss": 0.7845079898834229, "teacher_valid_fraction": 1.0, "peak_allocated_mib": 10583.0390625, "peak_reserved_mib": 11116.0}, "eager_loss": 0.3347933888435364, "compiled_loss": 0.3347933888435364, "gradient_cosine": 0.9999896108063672, "max_gradient_difference": 6.866455078125e-05, "teacher_gradients_absent": true, "compile_comparison_seconds": 54.64838738180697, "total_seconds": 79.89753107703291, "source": "allowed packed_sample and own slowAR generator only; frozen scratch-trained E96 neural teacher"} +Checks passed, zero optimizer updates. E101nowqueued after E99queuePID10701 and E97queuePID10513 both end, requiring their saved recovery checkpoints. These are dependency-launcher PIDs, not unknown future trainer PIDs. Exact recipe/command in distill_ensemble_queue.json; immutable teacher package distill_teacher_E96. Compare E94real-target-only at matching checkpoints. Student inference uses unchanged random_capacity_inference and contains no teacher dependency. + +## E93 input8/output4 final12000 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 35.806113958358765 seconds. +- Overall skill 0.381712; relative MASE 0.740742; relative WQL 0.516077. +- term skill: long=0.4058, medium=0.4052, short=0.3629. +- domain skill: Econ/Fin=0.1468, Energy=0.2396, Healthcare=0.4600, Nature=0.4409, Sales=0.3373, Transport=0.4706, Web/CloudOps=0.5017. +- frequency skill: A=0.3633, D=0.3624, H=0.3942, M=0.1027, Q=0.1968, S=0.4248, T=0.4434, W=0.2445. +- variates skill: multivariate=0.3961, univariate=0.3700. +- Outcome: Final main0.381711986 exceeds matched E89patch8control12k0.380847096 and starting selected E71parent0.381178739. The smaller output blocks help at the final schedule; check all three earlier cutoffs and matched fullpatch4 final before any selection or architectural conclusion. Training loop3153.565149s, sharedH100; seed401/B32/LR2e-5, unchanged generator. E98exactpostloss completion started in the released allocation. + +## E97 weekly synthetic coverage first1000 +- Checkpoint SHA-256: `abd335075c429adc73f20e1e291146903a767a3e5c5a52669768863d5585031a`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.452547311782837 seconds. +- Overall skill 0.378319; relative MASE 0.743092; relative WQL 0.520107. +- term skill: long=0.3993, medium=0.4061, short=0.3590. +- domain skill: Econ/Fin=0.1270, Energy=0.2360, Healthcare=0.4896, Nature=0.4309, Sales=0.3352, Transport=0.4671, Web/CloudOps=0.4981. +- frequency skill: A=0.3664, D=0.3562, H=0.3957, M=0.1213, Q=0.1976, S=0.4232, T=0.4346, W=0.2365. +- variates skill: multivariate=0.3927, univariate=0.3666. +- Outcome: Main0.378319040 exceeds matched E80at1000 0.376804394 by0.001514645. Monthly skill rises0.10610to0.12127 and weekly0.22573to0.23646; most overall gain is short-term. Original real and unchanged synthetic windows/RNG remain bitwise matched. Continue3k/6k/12k before selection. Seed197/B64/LR2e-5, independentweeklyseed1000200, total20%synthetic unchanged. + +## E94 fresh146M halfLR at8000 +- Checkpoint SHA-256: `650a1a4177cae63f3ceab8a2255fbd2f9d281a7e83e8d380a34bb956bd690884`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 38.053096294403076 seconds. +- Overall skill 0.347153; relative MASE 0.771841; relative WQL 0.552198. +- term skill: long=0.3712, medium=0.3767, short=0.3259. +- domain skill: Econ/Fin=0.1161, Energy=0.2093, Healthcare=0.3516, Nature=0.4137, Sales=0.3243, Transport=0.4423, Web/CloudOps=0.4676. +- frequency skill: A=0.3714, D=0.3436, H=0.3637, M=0.0157, Q=0.1571, S=0.4182, T=0.3966, W=0.2130. +- variates skill: multivariate=0.3599, univariate=0.3368. +- Outcome: Main0.347153427 beats matched high-LR146M8k0.343979357, but remains below37M8k0.353508836. The rate benefit persists but shrinks versus4k; continue16k/24k before choosing a larger-corpus fresh recipe. Same owninit/seed307/B48/96k, only LR differs from E79wide. + +## E102 fixed E96 third-member replacement with E93final — predeclared +Replace only the fullpatch4 EMA6000 member with split input8/output4 EMA12000. Retain E83patch16 and E71patch8_6000, ordered equal1/3 quantile averaging after each unchanged member rule. Every member forecasts every instance. No new optimization, no coefficient sweep or configuration-specific selection. Compare all four established cached cutoffs, requiring full public replay and relocation/composition checks before publication. E93final individual main0.381711986 exceeds its control and parent; earlier cutoffs are currently running. The E101teacher remains the immutable E96 ensemble regardless of this selection result. + +E99 fresh37M early cooldown training started at 2026-10-23T05:15:29Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E89 fullpatch4 final12000 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 51.19871735572815 seconds. +- Overall skill 0.381640; relative MASE 0.741276; relative WQL 0.515825. +- term skill: long=0.4055, medium=0.4047, short=0.3631. +- domain skill: Econ/Fin=0.1486, Energy=0.2408, Healthcare=0.4740, Nature=0.4424, Sales=0.3396, Transport=0.4680, Web/CloudOps=0.4971. +- frequency skill: A=0.3603, D=0.3552, H=0.3960, M=0.1392, Q=0.2025, S=0.4227, T=0.4401, W=0.2492. +- variates skill: multivariate=0.3948, univariate=0.3709. +- Outcome: Final main0.381640078 exceeds matched patch8control0.380847096, essentially ties the cheaper E93input8/output4 final0.381711986, and exceeds selected starting E71parent0.381178739. Training loop5066.016522s on sharedH100, seed401/B32/LR2e-5; actual memory advantage of E93 is supported by maximum-shape checks, while process timings are concurrent rather than exclusive. Evaluate all three earlier cutoffs before choosing a replacement for E96thirdmember. E99cooldown starts in the released allocation. + +## E103 fixed E96 third-member replacement with E89final — predeclared +Test the completed fullpatch4 EMA12000 as the third member, retaining E83patch16/E71patch8 and equal1/3 quantile averaging with unchanged per-member rules. This is the counterpart to E102splitpatch-final replacement, motivated by the near-tie of the matched architecture continuations at12k. No coefficient or per-config choice; every member forecasts every instance. Compare all four cached cutoffs against E96/E102 before selecting the next full replay. No additional optimizer updates. + +Recovery-provenance maintenance: trainer now carries immutable external resume snapshots in parent_checkpoints across subsequent restarts from a run's own mutable recovery.pt. This preserves E98/E99prefix ancestry after another operator recovery and avoids linking mutable source-run recovery files. Metadata only, no training arithmetic changed. CURRENT snapshots now explicitly record the known compiler environment for compiled jobs, including those whose launchers passed it via subprocess environment rather than an env command prefix. No credentials were read. + +### E102 four-cutoff replacement results +{"cutoff": "valid_screen", "skill_score": 0.38490788212550675, "rel_mase_gmean": 0.7369849187976256, "rel_wql_gmean": 0.5133596411831329, "groups": {"term": {"short": 0.3670856470642414, "medium": 0.4084718855262034, "long": 0.40650615955402314}, "domain": {"Econ/Fin": 0.1435289463184154, "Energy": 0.2468980568665663, "Healthcare": 0.4746000842796365, "Nature": 0.44061471938672714, "Sales": 0.3438839562187085, "Transport": 0.4681588575437192, "Web/CloudOps": 0.5046164356104859}, "freq": {"A-DEC": 0.37543835684208393, "Q-DEC": 0.19718024023430158, "M": 0.10850755704828396, "W-SUN": 0.10914931929038174, "D": 0.364713649661322, "H": 0.40088295006065944, "15T": 0.21696396975859744, "W-FRI": 0.016303274872958684, "10T": 0.6274098133659913, "W-TUE": 0.6163821514248893, "W-THU": 0.20854279501175432, "W-WED": 0.32935722968495507, "5T": 0.5196886329209323, "10S": 0.42527389349857736}}, "cpu_seconds": 1.1513165449723601, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.384594982171353, "difference": 0.0003128999541537336} +{"cutoff": "valid_backcast", "skill_score": 0.3397943577904946, "rel_mase_gmean": 0.7942938342926791, "rel_wql_gmean": 0.5487534602272348, "groups": {"term": {"short": 0.3060609208737005, "medium": 0.36022438378162913, "long": 0.40207177797998805}, "domain": {"Econ/Fin": 0.17314936720715002, "Energy": 0.2319064310330724, "Healthcare": 0.40898749701599635, "Nature": 0.3714427052655884, "Sales": 0.4054545766888219, "Transport": 0.37346761267845907, "Web/CloudOps": 0.4512796397157435}, "freq": {"A-DEC": 0.32636255116793356, "Q-DEC": 0.2369053047170233, "M": 0.1881408754401731, "W-SUN": 0.05514520346862939, "D": 0.35254747200062386, "H": 0.37162220001802326, "15T": 0.2225810499701737, "W-FRI": 0.23076747912755158, "10T": 0.32531767521178967, "W-TUE": 0.5449536336522042, "W-THU": 0.2550583257373391, "W-WED": 0.36148774693113794, "5T": 0.441771392840713, "10S": 0.34781169339869}}, "cpu_seconds": 0.9792960570193827, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.33975008510701665, "difference": 4.427268347795277e-05} +{"cutoff": "valid_backcast2", "skill_score": 0.3650870167535245, "rel_mase_gmean": 0.7649173761305604, "rel_wql_gmean": 0.527003973075039, "groups": {"term": {"short": 0.3525196178413804, "medium": 0.3930479998451024, "long": 0.3688394487554716}, "domain": {"Econ/Fin": 0.12187550267974279, "Energy": 0.24171273109616453, "Healthcare": 0.3558210371956918, "Nature": 0.4786187053429537, "Sales": 0.5559745534466993, "Transport": 0.42514365668969034, "Web/CloudOps": 0.4369290048270271}, "freq": {"A-DEC": 0.3369941826448156, "Q-DEC": 0.15634597829751584, "M": 0.16659776433783968, "W-SUN": 0.07034227201826782, "D": 0.4307838193118658, "H": 0.3947195332904091, "15T": 0.10843788342786231, "W-FRI": 0.15292520112219465, "10T": 0.5097026958567001, "W-TUE": 0.1163232645897253, "W-THU": 0.349832844039044, "W-WED": 0.5634413265331784, "5T": 0.4725475721543746, "10S": 0.2849619587969022}}, "cpu_seconds": 1.3131735338829458, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.36472017597795625, "difference": 0.00036684077556825567} +{"cutoff": "valid_backcast3", "skill_score": 0.38962589808404846, "rel_mase_gmean": 0.7393031561148107, "rel_wql_gmean": 0.5039293302189662, "groups": {"term": {"short": 0.3950146881429296, "medium": 0.3683351816334438, "long": 0.3962356024661119}, "domain": {"Econ/Fin": 0.1866323514229733, "Energy": 0.31708138786412254, "Healthcare": 0.2340457735690984, "Nature": 0.5075633858787092, "Sales": 0.3999844088004907, "Transport": 0.5091845709202749, "Web/CloudOps": 0.3939387141464573}, "freq": {"A-DEC": 0.35740138324250814, "Q-DEC": 0.2545638826926907, "M": 0.14196420345262517, "W-SUN": 0.1692422167486961, "D": 0.44092551174968075, "H": 0.4060276831713958, "15T": 0.2544847257167575, "W-FRI": 0.03945021050804143, "10T": 0.6073743483329828, "W-TUE": 0.25124832856283164, "W-THU": 0.3470992258549631, "W-WED": 0.3775958266712779, "5T": 0.46513388285277635, "10S": 0.29273333259972834}}, "cpu_seconds": 0.9749888752121478, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "E96skill": 0.389238119545644, "difference": 0.00038777853840443743} + +### E103 four-cutoff replacement results +{"cutoff": "valid_screen", "skill_score": 0.38500541763348517, "rel_mase_gmean": 0.7370491942191689, "rel_wql_gmean": 0.5131520925694101, "groups": {"term": {"short": 0.36722493789915567, "medium": 0.40845783827201154, "long": 0.4066128546537624}, "domain": {"Econ/Fin": 0.14488968734284446, "Energy": 0.2473756772173874, "Healthcare": 0.4777300437443104, "Nature": 0.4411115514129288, "Sales": 0.3448077959265311, "Transport": 0.46774095296357987, "Web/CloudOps": 0.5033387584756153}, "freq": {"A-DEC": 0.37541665630455645, "Q-DEC": 0.19911678292032942, "M": 0.11881300866622979, "W-SUN": 0.1096477052731838, "D": 0.362528588146091, "H": 0.4015705047657928, "15T": 0.21804762920144782, "W-FRI": 0.016363727924622262, "10T": 0.6271485862780906, "W-TUE": 0.6209733756670539, "W-THU": 0.20999017480896343, "W-WED": 0.3297749874361884, "5T": 0.5175349566789766, "10S": 0.42462313787098094}}, "cpu_seconds": 1.0732698428910226, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.384594982171353, "difference": 0.00041043546213215265} +{"cutoff": "valid_backcast", "skill_score": 0.3398214546118604, "rel_mase_gmean": 0.7942044163673427, "rel_wql_gmean": 0.5487701941828703, "groups": {"term": {"short": 0.305847769661334, "medium": 0.3615040967825627, "long": 0.40146856729517433}, "domain": {"Econ/Fin": 0.17464373027255042, "Energy": 0.23108171914379005, "Healthcare": 0.41082426569988595, "Nature": 0.3718443434112704, "Sales": 0.40646820364012926, "Transport": 0.3728762819285243, "Web/CloudOps": 0.4515441161888809}, "freq": {"A-DEC": 0.32427594695442885, "Q-DEC": 0.23945276396724646, "M": 0.19719617479508833, "W-SUN": 0.052844558516275786, "D": 0.35260466772957, "H": 0.3721367040211806, "15T": 0.2223065777034271, "W-FRI": 0.22845992938029724, "10T": 0.3234396022330981, "W-TUE": 0.5459245154169383, "W-THU": 0.24711082469129164, "W-WED": 0.36312061525273154, "5T": 0.4404099962380955, "10S": 0.3485327044406994}}, "cpu_seconds": 0.9945498188026249, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.33975008510701665, "difference": 7.13695048437657e-05} +{"cutoff": "valid_backcast2", "skill_score": 0.3647180336171173, "rel_mase_gmean": 0.7654029032858002, "rel_wql_gmean": 0.5272820041297973, "groups": {"term": {"short": 0.3518878749308295, "medium": 0.3927580540668256, "long": 0.3691077522689188}, "domain": {"Econ/Fin": 0.12218990276622621, "Energy": 0.24251138907504843, "Healthcare": 0.34933847363414383, "Nature": 0.4781212829897, "Sales": 0.55694372735719, "Transport": 0.4243899770061409, "Web/CloudOps": 0.43650428576145894}, "freq": {"A-DEC": 0.33629748314335295, "Q-DEC": 0.1560373253956937, "M": 0.16237816345656342, "W-SUN": 0.07189010798504825, "D": 0.43022756178029165, "H": 0.39543965655443114, "15T": 0.10619855263453626, "W-FRI": 0.15256288862137302, "10T": 0.5099262713842705, "W-TUE": 0.11275167806759523, "W-THU": 0.3476561865337633, "W-WED": 0.565409644514056, "5T": 0.4712731877671763, "10S": 0.2859728774327921}}, "cpu_seconds": 0.9891702111344784, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.36472017597795625, "difference": -2.142360838952584e-06} +{"cutoff": "valid_backcast3", "skill_score": 0.38952531921448574, "rel_mase_gmean": 0.7397344287798532, "rel_wql_gmean": 0.5038015284686523, "groups": {"term": {"short": 0.39470492326109163, "medium": 0.3679378045902095, "long": 0.39702622151428124}, "domain": {"Econ/Fin": 0.18635232828843817, "Energy": 0.3167555032477224, "Healthcare": 0.2321529881554648, "Nature": 0.5080109601079104, "Sales": 0.40020731613048277, "Transport": 0.5096409724474877, "Web/CloudOps": 0.3934863582665823}, "freq": {"A-DEC": 0.34966366686932726, "Q-DEC": 0.25774901005566275, "M": 0.13921842550571784, "W-SUN": 0.1678888068666432, "D": 0.4412824281729495, "H": 0.40605210717475726, "15T": 0.2556303886920226, "W-FRI": 0.03145225561173515, "10T": 0.6068260917454812, "W-TUE": 0.2595682801406983, "W-THU": 0.3474528636749996, "W-WED": 0.3763281957599267, "5T": 0.4644139584813969, "10S": 0.29384233335279064}}, "cpu_seconds": 1.3381098771933466, "member_checkpoint_hashes": ["0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3"], "E96skill": 0.389238119545644, "difference": 0.00028719966884172} +Next full replay: E102 improves all four cutoffs and has the cheaper input8 encoder. E103 is slightly stronger on main/first earlier but weaker thanE102 onsecond/third; secondearlier effectivelyties E96. E103is retained as a cached alternative, without a claimed full-suite result. No new optimizer updates in either ensemble composition. + +## E97 weekly synthetic coverage at3000 +- Checkpoint SHA-256: `a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.279794216156006 seconds. +- Overall skill 0.380663; relative MASE 0.740647; relative WQL 0.517896. +- term skill: long=0.4025, medium=0.4068, short=0.3617. +- domain skill: Econ/Fin=0.1317, Energy=0.2379, Healthcare=0.4904, Nature=0.4332, Sales=0.3335, Transport=0.4661, Web/CloudOps=0.5036. +- frequency skill: A=0.3690, D=0.3546, H=0.3977, M=0.1269, Q=0.1964, S=0.4224, T=0.4386, W=0.2419. +- variates skill: multivariate=0.3970, univariate=0.3674. +- Outcome: Main0.380663183 exceeds matched E80at3000 0.378663825 by0.001999358, sustaining the1k gain. Earlier cutoffs are now running; no independent-model publication yet. Seed197/B64/LR2e-5, exact original real/non-replaced synthetic streams preserved, weekly replacement1/11 of20%synthetic. + +## E104 transfer the matched weekly-synthesis correction — predeclared +Hypothesis: E97weekly3000 minus E80overflow-control3000 isolates the new weekly synthetic coverage and can improve E83, while retaining E83postprocessing-aware and slowAR contributions. Apply exactly coefficient1: E83postloss_slow_ar_delta6k + E97weekly_synthEMA3000 - E80overflow_controlEMA3000. All model keys/configurations align; all weights were trained here on allowed data, with the delta pair sharing seed197/B64/LR2e-5 and original sampler/horizon streams. No coefficient sweep or optimizer updates. E97earlier results are not yet available at declaration. Evaluate the fixed composition at all four cutoffs and then its fixed equal1/3 ensemble with E71patch8_6000 and E93splitpatch_12000, replacing only E102firstmember. Use unchanged postloss_inference numerical fallback and fixed rules. This is a predictive composition test, with full public replay/checks required for any publication. E101teacher remains frozen E96. + +## E93 split patch final earlier cutoff1 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 35.36992645263672 seconds. +- Overall skill 0.336872; relative MASE 0.797481; relative WQL 0.551410. +- term skill: long=0.4020, medium=0.3579, short=0.3016. +- domain skill: Econ/Fin=0.1748, Energy=0.2280, Healthcare=0.3931, Nature=0.3699, Sales=0.4068, Transport=0.3691, Web/CloudOps=0.4509. +- frequency skill: A=0.3160, D=0.3464, H=0.3726, M=0.1800, Q=0.2360, S=0.3514, T=0.3341, W=0.2756. +- variates skill: multivariate=0.3569, univariate=0.3205. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E93 split patch final earlier cutoff2 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 31.873882293701172 seconds. +- Overall skill 0.361104; relative MASE 0.770556; relative WQL 0.529731. +- term skill: long=0.3665, medium=0.3913, short=0.3470. +- domain skill: Econ/Fin=0.1207, Energy=0.2377, Healthcare=0.3430, Nature=0.4729, Sales=0.5545, Transport=0.4214, Web/CloudOps=0.4356. +- frequency skill: A=0.3185, D=0.4195, H=0.3908, M=0.1553, Q=0.1616, S=0.2820, T=0.3625, W=0.2958. +- variates skill: multivariate=0.3609, univariate=0.3613. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E93 split patch final earlier cutoff3 +- Checkpoint SHA-256: `1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 33.14549136161804 seconds. +- Overall skill 0.385555; relative MASE 0.745119; relative WQL 0.506687. +- term skill: long=0.3946, medium=0.3685, short=0.3886. +- domain skill: Econ/Fin=0.1861, Energy=0.3097, Healthcare=0.2354, Nature=0.5014, Sales=0.3950, Transport=0.5057, Web/CloudOps=0.3950. +- frequency skill: A=0.3543, D=0.4270, H=0.4025, M=0.1610, Q=0.2496, S=0.2977, T=0.4286, W=0.2436. +- variates skill: multivariate=0.3696, univariate=0.3979. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E89 full patch4 final earlier cutoff1 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 55.011173486709595 seconds. +- Overall skill 0.336345; relative MASE 0.797972; relative WQL 0.551947. +- term skill: long=0.3997, medium=0.3611, short=0.3004. +- domain skill: Econ/Fin=0.1781, Energy=0.2248, Healthcare=0.3992, Nature=0.3709, Sales=0.4088, Transport=0.3668, Web/CloudOps=0.4509. +- frequency skill: A=0.3067, D=0.3457, H=0.3740, M=0.2061, Q=0.2429, S=0.3533, T=0.3298, W=0.2654. +- variates skill: multivariate=0.3532, univariate=0.3226. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E89 full patch4 final earlier cutoff2 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 54.35282373428345 seconds. +- Overall skill 0.359845; relative MASE 0.771620; relative WQL 0.531089. +- term skill: long=0.3668, medium=0.3902, short=0.3451. +- domain skill: Econ/Fin=0.1192, Energy=0.2393, Healthcare=0.3219, Nature=0.4739, Sales=0.5564, Transport=0.4186, Web/CloudOps=0.4338. +- frequency skill: A=0.3129, D=0.4161, H=0.3924, M=0.1622, Q=0.1597, S=0.2850, T=0.3585, W=0.2927. +- variates skill: multivariate=0.3606, univariate=0.3592. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E89 full patch4 final earlier cutoff3 +- Checkpoint SHA-256: `a263e545cafb309e8b22dde151e6a8bd37166e1db346170ad7bd33f4a11cd6a3`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 54.33600902557373 seconds. +- Overall skill 0.384241; relative MASE 0.747472; relative WQL 0.507256. +- term skill: long=0.3960, medium=0.3667, short=0.3865. +- domain skill: Econ/Fin=0.1847, Energy=0.3079, Healthcare=0.2301, Nature=0.5006, Sales=0.3948, Transport=0.5062, Web/CloudOps=0.3930. +- frequency skill: A=0.3322, D=0.4254, H=0.4016, M=0.1568, Q=0.2587, S=0.3002, T=0.4273, W=0.2401. +- variates skill: multivariate=0.3670, univariate=0.3975. +- Outcome: Fixed final12000 checkpoint, seed401/B32/LR2e-5. Used for the predeclared equal-member replacement comparison E102/E103; validation only, no further optimizer updates. + +## E95 all-shard coverage at6000 +- Checkpoint SHA-256: `78a3c47718545643662029245141e6d39e64cf0853d2502f20222123ce3cd5c7`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.874247789382935 seconds. +- Overall skill 0.376043; relative MASE 0.746531; relative WQL 0.521508. +- term skill: long=0.4012, medium=0.4068, short=0.3538. +- domain skill: Econ/Fin=0.1318, Energy=0.2380, Healthcare=0.4414, Nature=0.4294, Sales=0.3318, Transport=0.4670, Web/CloudOps=0.4991. +- frequency skill: A=0.3714, D=0.3507, H=0.3948, M=0.0936, Q=0.1963, S=0.4213, T=0.4386, W=0.2145. +- variates skill: multivariate=0.3939, univariate=0.3614. +- Outcome: Skill0.376043220 falls below matched E80control6000 0.378288765. Continue the declared12000 schedule; broader coverage at fixed volume has not improved the mature model. + +## E98 original postloss schedule at6000 +- Checkpoint SHA-256: `7f1a2200b0f6a2cd63a378b001010e4a4a9776eba76c800ee1d61c23fc8bf9cb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 25.866560697555542 seconds. +- Overall skill 0.377594; relative MASE 0.744160; relative WQL 0.520572. +- term skill: long=0.4019, medium=0.4066, short=0.3564. +- domain skill: Econ/Fin=0.1081, Energy=0.2440, Healthcare=0.4585, Nature=0.4289, Sales=0.3383, Transport=0.4638, Web/CloudOps=0.5007. +- frequency skill: A=0.3681, D=0.3493, H=0.3983, M=0.0713, Q=0.1895, S=0.4227, T=0.4403, W=0.2264. +- variates skill: multivariate=0.3955, univariate=0.3630. +- Outcome: Exact optimizer/RNG continuation from originalE75step3653; no reset. Skill0.377594313 is below E75at3000 0.378813891 and E80at6000 0.378288765. Continue to predeclared12000; no checkpoint replacement. + +## E79 fresh37M original schedule at36000 +- Checkpoint SHA-256: `06778302f2e405ecd30fd00407523d03be8756c7a6029c38a26360cbeb98becf`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 29.79560947418213 seconds. +- Overall skill 0.364859; relative MASE 0.756433; relative WQL 0.533298. +- term skill: long=0.3873, medium=0.3910, short=0.3457. +- domain skill: Econ/Fin=0.1266, Energy=0.2248, Healthcare=0.4265, Nature=0.4125, Sales=0.3402, Transport=0.4559, Web/CloudOps=0.4912. +- frequency skill: A=0.3896, D=0.3497, H=0.3830, M=0.0639, Q=0.1985, S=0.4187, T=0.4195, W=0.2201. +- variates skill: multivariate=0.3809, univariate=0.3518. +- Outcome: Original96k schedule control, seed307/B48/LR2e-4. Skill0.364859034 improves on30k0.358563990; compare E99cooldown at the same step when available. + +## E105 nested corpus volume at fixed source probabilities — predeclared +Hypothesis: the mature model may benefit from more distinct allowed series beyond the all-shard coverage change. Compare against E95 using the exactly nested packed_stratified_large instead of packed_stratified. Source probabilities stay bitwise those of packed_sample, all95directories, all model/optimizer/EMA/horizon settings unchanged: ownE62initial SHA22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, seed197/B64/LR2e-5/12000steps, paired loss, overflow_control code, postloss_inference runtime. Per-directory softcap192M versus24M points; total5,354,822,975points/1,059,868series versus952,527,771points/342,661series. Same global series order and per-series crop rules, exact binary/record prefix checked for all95dirs. stratified_large_audit.json replays260actualseries and verifies source probabilities, seed461,19.984999CPU seconds,0optimizerupdates/no validationreads. More series changes the sampler trajectory; this is a single-seed volume comparison, not identical sampled rows. E95at6000 currently trails E80; E105 tests whether volume recovers that deficit. Queue after E95 in its allocation. Screens1000/3000/6000/12000; earlier cutoffs and full replay required before publication. No added training data sources or new generator. + +## E106 spectral smoothness prior in synthetic residuals — preparation +Hypothesis: the original white/AR1 synthetic residuals underrepresent smooth stochastic changes. Replace only the noise residual in half of synthetic windows (total synthetic share unchanged20%) with a unit-marginal-variance stationary Gaussian draw generated here by FFT. Equal kernel-family prior: Matérn nu0.5/1.5/2.5 or squared-exponential; length scale10**U(0,4) steps. Generate a periodic FFT field of next-power-of-two length at least4times the window and keep its prefix; normalize by theoretical spectral variance, never by realized future values. Keep the original Fourier components, trend, changepoint, intermittent and positivity transforms, periods and observed masks. Always consume the original residual RNG before replacement; independent spectral seed1100200 preserves the full original sampler/horizon streams and all non-replaced rows. This differs from E14's multi-family whole-series replacement and E78's four-AR-component sum. Comparator E80: ownE62initial SHA22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c, seed197/B64/LR2e-5/12000steps, paired loss, oldpacked_sample/sourceweights, overflow-safe model unchanged. CPU distribution/RNG checks required before launch; no validation in generator or training. Queue after E98 when checks pass. Screen1000/3000/6000/12000 and earlier cutoffs for promising checkpoints; no coefficient sweep. +E106 CPU audit passed: seed499,7680paired candidate/control windows,1535synthetic rows,743spectral replacements. All non-replaced rows, period labels, finite masks and original/horizon RNG states are bitwise unchanged; saving/restoring all NumPy states replays the next batch exactly. Model file byte-identical toE80 SHA44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499. Four kernel-family empirical variances/autocovariances over1024draws each match their declared discrete spectral covariances within0.005 (tolerance0.045); extreme length scales1/10000 and window lengths8/40/5120 remain finite. Sampler comparison4.179206CPU seconds,total4.517388seconds,0optimizerupdates/no validationread. Receipt spectral_synth_checks.json. Queued after E98queue10664; full training metadata and publisher generator provenance added. + +## E102 split-patch replacement full public replay +- Checkpoint SHA-256: `2dedb7fd1052bf72a38fc005cc8c89f65d42a50260830de0f0efbb5f16a30b4f`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.381163; relative MASE 0.739673; relative WQL 0.517741. +- term skill: long=0.4007, medium=0.4074, short=0.3631. +- domain skill: Econ/Fin=0.1245, Energy=0.2404, Healthcare=0.4799, Nature=0.4407, Sales=0.3581, Transport=0.4683, Web/CloudOps=0.4964. +- frequency skill: A=0.2968, D=0.3691, H=0.3956, M=0.1343, Q=0.1868, S=0.4253, T=0.4379, W=0.2354. +- variates skill: multivariate=0.3952, univariate=0.3698. +- Outcome: Fixed equal1/3 ensemble E83patch16/E71patch8_6000/E93input8output4_12000. Full skill0.38116304998662165 exceeds E96full0.3807214453622526 by0.00044160462436904; zero failures across97configurations/151170instances. Inference358.197612shared-H100 seconds. Relocation already bitwise; independent component/composition checks pending before atomic publication. Validation selection only; no held-out reward claim. + +E102 final checks all passed before publication: split_ensemble_validation_receipt.json completes allfive steps in510.069582wall seconds including lock waits. Public inference358.197612seconds. Relocated three-example inference is bitwise identical/finite/ordered,31.745146seconds. Independent public third-member replay plus orderedfloat32 component mean exactly match bundled output for three complete actual configurations; see split_patch_composition_replay.json and split_ensemble_composition_checks.json. Descriptor2dedb7fd1052bf72a38fc005cc8c89f65d42a50260830de0f0efbb5f16a30b4f;110,068,216parameters. Selected for atomic publication over E96. Allfour diagnostic cutoffs improve; full-term skills long0.400651,medium0.407396,short0.363109. Descriptive group/config comparison and cluster bootstrap saved in split_ensemble_comparison.json; no held-out significance claim. E101teacher remains immutable E96. + +## E107 learned use of sixteen-cycle centered seasonal summaries — preparation +Hypothesis: within the existing4096-point context, averaging more observed cycles can reduce phase-pattern noise, while centering each cycle prevents old levels from biasing the forecast. Add fixed context features for each of the two existing frequency periods: the16cycle-minus4cycle mean of cycle-centered phase observations and the16cycle support fraction. Enable a phase only with at least8observed cycles, at least2recent cycles and period>=2. A zero-initialized linear query projection exposes these four features to the existing decoder; a separate zero-initialized two-gate head adds tanh-bounded multiples of the two template differences to the median. All quantiles shift together; original interval widths are unchanged initially. The initial function must be exactly preserved and all parameters train. No increased context, raw-memory encoder or fitted seasonal parameters; this differs from E29/E54 older-history experiments. Comparator E80uses the same ownE62initial, seed197/B64/LR2e-5/12000steps, paired loss, original corpus/generator/horizon streams and overflow fallback. New weights start exactlyzero, conversion seed503; no external weights. Audit independent feature arithmetic, initialization equivalence, gradient flow and max-shape GPU memory before launch. Screen1000/3000/6000/12000, earlier/fullreplay for selection. Queue after E105 when ready; no launch yet. + +## E97 weekly synthetic coverage at6000 +- Checkpoint SHA-256: `de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.010923624038696 seconds. +- Overall skill 0.380716; relative MASE 0.741210; relative WQL 0.517415. +- term skill: long=0.4022, medium=0.4073, short=0.3617. +- domain skill: Econ/Fin=0.1254, Energy=0.2389, Healthcare=0.4994, Nature=0.4301, Sales=0.3392, Transport=0.4658, Web/CloudOps=0.5031. +- frequency skill: A=0.3704, D=0.3555, H=0.3964, M=0.1253, Q=0.1936, S=0.4249, T=0.4385, W=0.2461. +- variates skill: multivariate=0.3971, univariate=0.3673. +- Outcome: Main0.380715730 exceeds matched E80at6000 0.378288765 by0.002426965; nearly ties E97at3000. Continue declared12000 schedule. + +## E99 early cooldown at30000 +- Checkpoint SHA-256: `ffa1f38d24165a7167a319a609bc03fa14cbe471ea7785659f10d7c953889661`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 28.24539875984192 seconds. +- Overall skill 0.363004; relative MASE 0.756412; relative WQL 0.536432. +- term skill: long=0.3857, medium=0.3920, short=0.3425. +- domain skill: Econ/Fin=0.1135, Energy=0.2193, Healthcare=0.4094, Nature=0.4163, Sales=0.3443, Transport=0.4551, Web/CloudOps=0.4933. +- frequency skill: A=0.3737, D=0.3414, H=0.3797, M=0.0903, Q=0.1811, S=0.4171, T=0.4196, W=0.2193. +- variates skill: multivariate=0.3812, univariate=0.3481. +- Outcome: Skill0.363004205 exceeds original E79at30000 0.358563990 by0.004440216. Same immutable24000optimizer/EMA/RNG state, only the declared LR cooldown differs. Continue to36000 before schedule selection. + +## E97 weekly3000 earlier cutoff1 +- Checkpoint SHA-256: `a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 26.978241682052612 seconds. +- Overall skill 0.336324; relative MASE 0.797606; relative WQL 0.552235. +- term skill: long=0.3979, medium=0.3586, short=0.3021. +- domain skill: Econ/Fin=0.1518, Energy=0.2284, Healthcare=0.4155, Nature=0.3672, Sales=0.3939, Transport=0.3733, Web/CloudOps=0.4489. +- frequency skill: A=0.3129, D=0.3516, H=0.3666, M=0.1788, Q=0.2305, S=0.3410, T=0.3350, W=0.2907. +- variates skill: multivariate=0.3530, univariate=0.3227. +- Outcome: Fixed3000checkpoint, seed197/B64/LR2e-5. Matched E80earlier scores0.336119626/0.358234785/0.388791691. Candidate first/third improve slightly and second regresses; mixed standalone evidence. E104 matched-delta composition evaluated separately. + +## E97 weekly3000 earlier cutoff2 +- Checkpoint SHA-256: `a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 26.026545524597168 seconds. +- Overall skill 0.357608; relative MASE 0.772348; relative WQL 0.534302. +- term skill: long=0.3634, medium=0.3874, short=0.3435. +- domain skill: Econ/Fin=0.1055, Energy=0.2359, Healthcare=0.3296, Nature=0.4704, Sales=0.5497, Transport=0.4211, Web/CloudOps=0.4319. +- frequency skill: A=0.3536, D=0.4229, H=0.3913, M=0.1492, Q=0.1501, S=0.2808, T=0.3592, W=0.2527. +- variates skill: multivariate=0.3632, univariate=0.3530. +- Outcome: Fixed3000checkpoint, seed197/B64/LR2e-5. Matched E80earlier scores0.336119626/0.358234785/0.388791691. Candidate first/third improve slightly and second regresses; mixed standalone evidence. E104 matched-delta composition evaluated separately. + +## E97 weekly3000 earlier cutoff3 +- Checkpoint SHA-256: `a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 25.23224711418152 seconds. +- Overall skill 0.389288; relative MASE 0.737704; relative WQL 0.505581. +- term skill: long=0.3960, medium=0.3604, short=0.3973. +- domain skill: Econ/Fin=0.1690, Energy=0.3192, Healthcare=0.2786, Nature=0.5046, Sales=0.3991, Transport=0.5056, Web/CloudOps=0.3897. +- frequency skill: A=0.3644, D=0.4424, H=0.4032, M=0.1383, Q=0.2578, S=0.2856, T=0.4308, W=0.2610. +- variates skill: multivariate=0.3738, univariate=0.4012. +- Outcome: Fixed3000checkpoint, seed197/B64/LR2e-5. Matched E80earlier scores0.336119626/0.358234785/0.388791691. Candidate first/third improve slightly and second regresses; mixed standalone evidence. E104 matched-delta composition evaluated separately. + +## E104 weekly matched-delta standalone valid_screen +- Checkpoint SHA-256: `094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.348880529403687 seconds. +- Overall skill 0.381830; relative MASE 0.739086; relative WQL 0.517036. +- term skill: long=0.4034, medium=0.4069, short=0.3634. +- domain skill: Econ/Fin=0.1309, Energy=0.2397, Healthcare=0.4832, Nature=0.4388, Sales=0.3386, Transport=0.4639, Web/CloudOps=0.5053. +- frequency skill: A=0.3743, D=0.3550, H=0.4003, M=0.1128, Q=0.1977, S=0.4242, T=0.4413, W=0.2371. +- variates skill: multivariate=0.3976, univariate=0.3690. +- Outcome: Fixed E83 + E97weekly3000 - E80overflow3000, coefficient1. Merge1.392576CPU seconds, no optimizer updates. Standalone improves main/first earlier versus E83 and declines at second/third; fixed equal ensemble assessed separately. + +## E104 weekly matched-delta standalone valid_backcast +- Checkpoint SHA-256: `094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2`. +- Evaluation: 97 configurations, 9330 instances, 0 failed configurations; 31.152572631835938 seconds. +- Overall skill 0.336131; relative MASE 0.797469; relative WQL 0.552651. +- term skill: long=0.3953, medium=0.3602, short=0.3023. +- domain skill: Econ/Fin=0.1601, Energy=0.2285, Healthcare=0.3995, Nature=0.3691, Sales=0.3960, Transport=0.3717, Web/CloudOps=0.4496. +- frequency skill: A=0.3204, D=0.3464, H=0.3692, M=0.1755, Q=0.2317, S=0.3401, T=0.3348, W=0.2897. +- variates skill: multivariate=0.3531, univariate=0.3223. +- Outcome: Fixed E83 + E97weekly3000 - E80overflow3000, coefficient1. Merge1.392576CPU seconds, no optimizer updates. Standalone improves main/first earlier versus E83 and declines at second/third; fixed equal ensemble assessed separately. + +## E104 weekly matched-delta standalone valid_backcast2 +- Checkpoint SHA-256: `094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2`. +- Evaluation: 94 configurations, 8934 instances, 0 failed configurations; 24.71313166618347 seconds. +- Overall skill 0.359266; relative MASE 0.771102; relative WQL 0.532407. +- term skill: long=0.3665, medium=0.3870, short=0.3455. +- domain skill: Econ/Fin=0.1182, Energy=0.2385, Healthcare=0.3103, Nature=0.4745, Sales=0.5516, Transport=0.4204, Web/CloudOps=0.4341. +- frequency skill: A=0.3507, D=0.4222, H=0.3921, M=0.1412, Q=0.1508, S=0.2801, T=0.3641, W=0.2573. +- variates skill: multivariate=0.3652, univariate=0.3544. +- Outcome: Fixed E83 + E97weekly3000 - E80overflow3000, coefficient1. Merge1.392576CPU seconds, no optimizer updates. Standalone improves main/first earlier versus E83 and declines at second/third; fixed equal ensemble assessed separately. + +## E104 weekly matched-delta standalone valid_backcast3 +- Checkpoint SHA-256: `094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2`. +- Evaluation: 93 configurations, 8812 instances, 0 failed configurations; 27.16672372817993 seconds. +- Overall skill 0.388450; relative MASE 0.741068; relative WQL 0.504669. +- term skill: long=0.3933, medium=0.3623, short=0.3962. +- domain skill: Econ/Fin=0.1766, Energy=0.3223, Healthcare=0.2292, Nature=0.5006, Sales=0.4004, Transport=0.5087, Web/CloudOps=0.3907. +- frequency skill: A=0.3616, D=0.4377, H=0.4053, M=0.1372, Q=0.2595, S=0.2755, T=0.4323, W=0.2534. +- variates skill: multivariate=0.3728, univariate=0.4005. +- Outcome: Fixed E83 + E97weekly3000 - E80overflow3000, coefficient1. Merge1.392576CPU seconds, no optimizer updates. Standalone improves main/first earlier versus E83 and declines at second/third; fixed equal ensemble assessed separately. + +## E104 fixed equal ensemble four-cutoff result +{"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3854686334562757, "rel_mase_gmean": 0.736317060829138, "rel_wql_gmean": 0.5128888362858817, "groups": {"term": {"short": 0.36816414362245353, "medium": 0.408440542958879, "long": 0.40638695737391495}, "domain": {"Econ/Fin": 0.1425263103369776, "Energy": 0.24632269833233222, "Healthcare": 0.4841127370370696, "Nature": 0.4419832586228435, "Sales": 0.34402063532792737, "Transport": 0.46813360862898734, "Web/CloudOps": 0.5044110005980553}, "freq": {"A-DEC": 0.3754462639697367, "Q-DEC": 0.19683288984300373, "M": 0.12041158797480767, "W-SUN": 0.10445402624428435, "D": 0.36437209338558496, "H": 0.40083310684490536, "15T": 0.21665767736788544, "W-FRI": 0.012382553366723226, "10T": 0.627237041718931, "W-TUE": 0.6419405160293805, "W-THU": 0.2063343746335743, "W-WED": 0.3296903939083894, "5T": 0.5194953263110145, "10S": 0.42496228760958743}}, "configs": [{"config_id": "m4_yearly__A__short", "leaderboard_key": "m4_yearly/A/short", "dataset": "m4_yearly", "term": "short", "freq": "A-DEC", "prediction_length": 6, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 3, "skipped_series": 235, "dropped_containers": 11, "metrics": {"mase": 2.795416976588694, "wql": 0.08756880337104156, "wsql_by_level": [0.05252887822448462, 0.07932989461227326, 0.0959700106880147, 0.10455763068237416, 0.1063572505530461, 0.10658406951368415, 0.09915145380020426, 0.08468878326621433, 0.05895125899907835], "n_valid_labels": 1152, "n_masked_labels": 0, "mae_median": 549.2148649295171, "n_mase_elements": 1152, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6126392994384536, "wql": 0.6366998812301077}}, {"config_id": "m4_quarterly__Q__short", "leaderboard_key": "m4_quarterly/Q/short", "dataset": "m4_quarterly", "term": "short", "freq": "Q-DEC", "prediction_length": 8, "seasonality": 4, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 95, "metrics": {"mase": 1.268227388475534, "wql": 0.07681830668494384, "wsql_by_level": [0.04042083458880533, 0.06359275473978293, 0.08000831523251448, 0.09091168162013274, 0.09651369946150555, 0.09673283523414461, 0.09151898821247428, 0.0778237643192909, 0.05384188675584369], "n_valid_labels": 1536, "n_masked_labels": 0, "mae_median": 519.8114858369032, "n_mase_elements": 1536, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7767149083028737, "wql": 0.8305201817838648}}, {"config_id": "m4_monthly__M__short", "leaderboard_key": "m4_monthly/M/short", "dataset": "m4_monthly", "term": "short", "freq": "M", "prediction_length": 18, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 499, "metrics": {"mase": 0.9387358782206154, "wql": 0.11285109298383048, "wsql_by_level": [0.06134478839940721, 0.09485179214060362, 0.11540523935164874, 0.12890946874409262, 0.136647556715382, 0.13749452198589188, 0.13098699298148542, 0.11774639704301346, 0.0922730794929493], "n_valid_labels": 3456, "n_masked_labels": 0, "mae_median": 646.7568616337246, "n_mase_elements": 3456, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.816335853241079, "wql": 0.8288358266707591}}, {"config_id": "m4_weekly__W__short", "leaderboard_key": "m4_weekly/W/short", "dataset": "m4_weekly", "term": "short", "freq": "W-SUN", "prediction_length": 13, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 4, "metrics": {"mase": 2.8867052151722588, "wql": 0.05404656893968851, "wsql_by_level": [0.029807414872656677, 0.04605890529290171, 0.05673686200647567, 0.06333934400212216, 0.06718069790237324, 0.0684244799429442, 0.06408761552005404, 0.053931994669479406, 0.036851806248189484], "n_valid_labels": 2496, "n_masked_labels": 0, "mae_median": 333.4642290518834, "n_mase_elements": 2496, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.098295162106453, "wql": 0.7302250057916019}}, {"config_id": "m4_daily__D__short", "leaderboard_key": "m4_daily/D/short", "dataset": "m4_daily", "term": "short", "freq": "D", "prediction_length": 14, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 23, "metrics": {"mase": 3.1936882256260537, "wql": 0.019256542436877896, "wsql_by_level": [0.011530887742870673, 0.016857927154135987, 0.020548250829197437, 0.022889113930561356, 0.02395622004597089, 0.023773593914345643, 0.022079570197996758, 0.01863521994753962, 0.013038098169282733], "n_valid_labels": 2688, "n_masked_labels": 0, "mae_median": 172.77467766262237, "n_mase_elements": 2688, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.023209338914692, "wql": 1.0250642421255833}}, {"config_id": "m4_hourly__H__short", "leaderboard_key": "m4_hourly/H/short", "dataset": "m4_hourly", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 1, "metrics": {"mase": 1.2094391645761666, "wql": 0.038116260503183425, "wsql_by_level": [0.019263175762145472, 0.03230955303590387, 0.04137014097843697, 0.046555300547802186, 0.048861706646772, 0.04826905847853227, 0.04460205648239837, 0.03699396057937847, 0.024821392017281237], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 391.8570696660835, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0001696160920521, "wql": 1.1030515057204093}}, {"config_id": "electricity__T__short", "leaderboard_key": "electricity/15T/short", "dataset": "electricity/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9824612882781023, "wql": 0.04899481001536353, "wsql_by_level": [0.028395811361843548, 0.044092878604357774, 0.05412045723259588, 0.05992756900431569, 0.06226886608424658, 0.0607567109377272, 0.055284712749889435, 0.0456100312892153, 0.03049625287408038], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 35.737774749823274, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9154363074357945, "wql": 0.870276133011924}}, {"config_id": "electricity__T__medium", "leaderboard_key": "electricity/15T/medium", "dataset": "electricity/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9138171992921842, "wql": 0.06777267665914909, "wsql_by_level": [0.03736362960213149, 0.05831936817269399, 0.07212694659974693, 0.08075107449309941, 0.08507402474802193, 0.0848937494604228, 0.07937858123492646, 0.06702806179388453, 0.04501865382741436], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 50.67895454541528, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6101086438088109, "wql": 0.5783935026933213}}, {"config_id": "electricity__T__long", "leaderboard_key": "electricity/15T/long", "dataset": "electricity/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8447145538964363, "wql": 0.06827385263696915, "wsql_by_level": [0.034366406591681255, 0.054758756540683524, 0.06867134398777669, 0.07815171621716906, 0.08360791483416628, 0.08514868000485296, 0.08210597264875295, 0.07291497326855305, 0.05473890963908665], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 58.010600292991874, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.793087238785798, "wql": 0.6830225886678682}}, {"config_id": "electricity__H__short", "leaderboard_key": "electricity/H/short", "dataset": "electricity/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0541225658397144, "wql": 0.08072226170236818, "wsql_by_level": [0.052059029989780965, 0.07381706780740498, 0.08940650364012412, 0.09766545900035152, 0.10082063296922232, 0.09910661858775432, 0.09154474356341316, 0.07554767215719776, 0.046532627606064456], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 390.0401897939802, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0354875111412227, "wql": 1.135230642035518}}, {"config_id": "electricity__H__medium", "leaderboard_key": "electricity/H/medium", "dataset": "electricity/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.987906550246096, "wql": 0.05831413221480887, "wsql_by_level": [0.035281333139195646, 0.05204886496969009, 0.06226172565504222, 0.06849759857719877, 0.07160528468705928, 0.07136948746888597, 0.06706557636024374, 0.05729945878038814, 0.03939786029557599], "n_valid_labels": 91680, "n_masked_labels": 480, "mae_median": 123.75324168954644, "n_mase_elements": 91680, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 1}, "relative": {"mase": 0.8019251745922997, "wql": 0.5430069851629276}}, {"config_id": "electricity__H__long", "leaderboard_key": "electricity/H/long", "dataset": "electricity/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1658983357361172, "wql": 0.07357137105462702, "wsql_by_level": [0.03806675818908281, 0.059142989437638696, 0.07342462305723155, 0.08285541620257916, 0.08838165621663885, 0.09018932974142142, 0.08792010941992093, 0.07996623752695645, 0.06219521970017341], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 186.11038970290943, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8774867972029426, "wql": 0.5455441107583858}}, {"config_id": "electricity__D__short", "leaderboard_key": "electricity/D/short", "dataset": "electricity/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.5099228588256168, "wql": 0.07527743513872845, "wsql_by_level": [0.028622408054189894, 0.04768450605964861, 0.06725250904152086, 0.08213824752270928, 0.09297724078143454, 0.09881426714227798, 0.09865420796317632, 0.09083260698582611, 0.07052092269777245], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 7288.701407634384, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8926983627507425, "wql": 0.79849359571092}}, {"config_id": "electricity__W__short", "leaderboard_key": "electricity/W/short", "dataset": "electricity/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.4392953288002797, "wql": 0.07420910508641608, "wsql_by_level": [0.028263841036851898, 0.04947998113827854, 0.07029779814024846, 0.08377757347254892, 0.09415267782839486, 0.09698646132937698, 0.09468528173713849, 0.08549470200807237, 0.06474362908683412], "n_valid_labels": 1528, "n_masked_labels": 8, "mae_median": 51115.92140796921, "n_mase_elements": 1528, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 1}, "relative": {"mase": 1.0668448666538084, "wql": 1.0087383094433606}}, {"config_id": "solar__T__short", "leaderboard_key": "solar/10T/short", "dataset": "solar/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.01781347502043181, "wql": 0.42143977766900104, "wsql_by_level": [0.17504993687835133, 0.3294048479026965, 0.42535470871197667, 0.47927406289283053, 0.5120761379588328, 0.5104829060919627, 0.5115224252725261, 0.4839584145927364, 0.36583455871909654], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 0.04948667653070405, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1120657611865516, "wql": 0.03477638127025891}}, {"config_id": "solar__T__medium", "leaderboard_key": "solar/10T/medium", "dataset": "solar/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.6985151810314955, "wql": 0.2855006101463456, "wsql_by_level": [0.2169575653904273, 0.3172811042774564, 0.3523149180545522, 0.35215603486356883, 0.3379716322295703, 0.318100703509344, 0.28609829522194585, 0.2334167585437219, 0.15520847922652367], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 1.6148956313713991, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8384101144161774, "wql": 0.5052721781327353}}, {"config_id": "solar__T__long", "leaderboard_key": "solar/10T/long", "dataset": "solar/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.6978424350693991, "wql": 0.22233494197166248, "wsql_by_level": [0.166332992574431, 0.2595059797989555, 0.29659837268966455, 0.29931074035142674, 0.27858571503504526, 0.24242162336894557, 0.19627915034004179, 0.1502371646644031, 0.11174273892204904], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 1.6368925869296436, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.32577257090458905, "wql": 0.24615579268877133}}, {"config_id": "solar__H__short", "leaderboard_key": "solar/H/short", "dataset": "solar/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8617467091885954, "wql": 0.3293434646453593, "wsql_by_level": [0.21653214324107156, 0.3608860084185891, 0.4238913877404794, 0.4319325450630538, 0.4078626713071489, 0.3677051265706955, 0.31726362737950115, 0.25946595473130807, 0.1785517173563864], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 11.249563878051452, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8153283079097247, "wql": 0.546812071142352}}, {"config_id": "solar__H__medium", "leaderboard_key": "solar/H/medium", "dataset": "solar/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2022744177567275, "wql": 0.4450076691075868, "wsql_by_level": [0.45330812773553775, 0.5680630656352184, 0.5907064246201226, 0.5694126752918893, 0.523723531935585, 0.46059598495992393, 0.38173554779181534, 0.28563632923846516, 0.1718873347597239], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 15.694438455592719, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8723069938406994, "wql": 0.45972699007357887}}, {"config_id": "solar__H__long", "leaderboard_key": "solar/H/long", "dataset": "solar/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0399757532265896, "wql": 0.3554566364255842, "wsql_by_level": [0.4236411108275793, 0.4641399602000191, 0.4632445721303884, 0.44104649567727083, 0.40539762952064134, 0.35730628180110435, 0.2962660494071995, 0.2203389636641255, 0.12772866460192975], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 13.666343091270907, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9698189740538452, "wql": 0.3937320083199028}}, {"config_id": "solar__D__short", "leaderboard_key": "solar/D/short", "dataset": "solar/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1393415951992427, "wql": 0.28779881110159267, "wsql_by_level": [0.246847555738178, 0.35144868180361505, 0.3848117555811675, 0.3828138817256278, 0.3563405183132376, 0.3142248147378668, 0.25713374018742813, 0.18831075367532824, 0.1082575981518845], "n_valid_labels": 4110, "n_masked_labels": 0, "mae_median": 288.3019393257271, "n_mase_elements": 4110, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9762506655223895, "wql": 0.6104917515406019}}, {"config_id": "solar__W__short", "leaderboard_key": "solar/W/short", "dataset": "solar/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0268852032580833, "wql": 0.12052706700107489, "wsql_by_level": [0.05818950699285998, 0.11595881963990586, 0.14642893441175975, 0.15527060942685042, 0.15356069013241036, 0.14427571098979933, 0.12882774565443475, 0.1071060410364652, 0.0751255447251884], "n_valid_labels": 1096, "n_masked_labels": 0, "mae_median": 942.9758961252923, "n_mase_elements": 1096, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0188790216573897, "wql": 0.8676660533162098}}, {"config_id": "hospital__M__short", "leaderboard_key": "hospital/M/short", "dataset": "hospital", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.7847733130457222, "wql": 0.053420509620148826, "wsql_by_level": [0.027790076786016814, 0.04430160082100439, 0.05484753898873574, 0.06334639970768964, 0.06797641550890926, 0.06789033535039125, 0.06360322310563211, 0.05369613414971308, 0.03733286216324714], "n_valid_labels": 2304, "n_masked_labels": 0, "mae_median": 24.31328149450322, "n_mase_elements": 2304, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8685161977502073, "wql": 0.9428099884765189}}, {"config_id": "covid_deaths__D__short", "leaderboard_key": "covid_deaths/D/short", "dataset": "covid_deaths", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 38.23095597530944, "wql": 0.07565835856235899, "wsql_by_level": [0.06488312664714146, 0.09355169771892499, 0.10868264832032903, 0.10597437880207744, 0.09027346424775537, 0.056965212817616045, 0.04246456866517384, 0.053367319049436694, 0.06476281079277596], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 119.48539306917745, "n_mase_elements": 4980, "n_seasonal_error_zero": 26, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8523760722942941, "wql": 0.601940457311472}}, {"config_id": "us_births__D__short", "leaderboard_key": "us_births/D/short", "dataset": "us_births/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.4683471073212719, "wql": 0.02690163787960409, "wsql_by_level": [0.012519404448211847, 0.018547585448283086, 0.024551840767867615, 0.02741222552467023, 0.030394372626209108, 0.03538051003031574, 0.037291790440225105, 0.03347683644816188, 0.022540175182492208], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 309.30022786458335, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.2011708799119241, "wql": 0.20603760414131309}}, {"config_id": "us_births__M__short", "leaderboard_key": "us_births/M/short", "dataset": "us_births/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.2632496713784672, "wql": 0.007624636894155283, "wsql_by_level": [0.005740636266914142, 0.00669562959867952, 0.006415264111996609, 0.007365210476773466, 0.007865769392696903, 0.007709336643382707, 0.009020174329738895, 0.009829421143081944, 0.007980290084133368], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 2469.2708333333335, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8707902315739978, "wql": 0.686792676525858}}, {"config_id": "us_births__W__short", "leaderboard_key": "us_births/W/short", "dataset": "us_births/W", "term": "short", "freq": "W-TUE", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 1.3439668302592565, "wql": 0.015538928857283843, "wsql_by_level": [0.008149730706929493, 0.015485149708547646, 0.018908646300848733, 0.01980101172362688, 0.019660444668581117, 0.0187701796519375, 0.016784749749211507, 0.013938410631079623, 0.0083520365747921], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 1462.5478515625, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3483189786698818, "wql": 0.3680723759322161}}, {"config_id": "saugeenday__D__short", "leaderboard_key": "saugeen/D/short", "dataset": "saugeenday/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 3.2379394826019117, "wql": 0.32258585175584387, "wsql_by_level": [0.15009877492359122, 0.2699071963054936, 0.36480964084176287, 0.429573899167784, 0.45823803356515874, 0.42717553516290857, 0.3351583385200374, 0.2215160947494623, 0.24679515256639606], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 14.235928344726563, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8305675631954952, "wql": 0.5953264411491401}}, {"config_id": "saugeenday__M__short", "leaderboard_key": "saugeen/M/short", "dataset": "saugeenday/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.447265017966201, "wql": 0.2307741278381414, "wsql_by_level": [0.11948748410211966, 0.20558068850434347, 0.25366673650790045, 0.2711589268222958, 0.2666016298699337, 0.25080164410889916, 0.2536812298869933, 0.2631835026219238, 0.19280530811886343], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 7.753377676010132, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.346044379035233, "wql": 0.882496776385616}}, {"config_id": "saugeenday__W__short", "leaderboard_key": "saugeen/W/short", "dataset": "saugeenday/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.7330330272586232, "wql": 0.24147546142758547, "wsql_by_level": [0.10751263398587159, 0.18331227585741458, 0.2502510695301909, 0.3133840201557028, 0.3592666151397, 0.36245011569972874, 0.2884292388494765, 0.13843016727866211, 0.1702430163515221], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 8.785351753234863, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.2892549439821193, "wql": 0.4028557997401655}}, {"config_id": "temperature_rain_with_missing__D__short", "leaderboard_key": "temperature_rain/D/short", "dataset": "temperature_rain_with_missing", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.9559930019720881, "wql": 0.4947299668702683, "wsql_by_level": [0.1802116378075862, 0.33158236937698643, 0.4579114859648925, 0.5564406030720168, 0.6162810537447235, 0.6492325225743822, 0.6515226891383746, 0.5857612147562478, 0.42362612539720557], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 6.430995614538632, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6695614586247304, "wql": 0.4691966328995636}}, {"config_id": "kdd_cup_2018_with_missing__H__short", "leaderboard_key": "kdd_cup_2018/H/short", "dataset": "kdd_cup_2018_with_missing/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.5205984182413413, "wql": 0.37434376546657755, "wsql_by_level": [0.14874802649519717, 0.249307214916932, 0.33521712975229895, 0.410567172978763, 0.4656408160355961, 0.490297506901656, 0.48628563319462764, 0.44844947895039156, 0.3345809099737359], "n_valid_labels": 8214, "n_masked_labels": 1002, "mae_median": 11.944559938516282, "n_mase_elements": 8214, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7847300683952065, "wql": 0.5948636206793396}}, {"config_id": "kdd_cup_2018_with_missing__H__medium", "leaderboard_key": "kdd_cup_2018/H/medium", "dataset": "kdd_cup_2018_with_missing/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.9403458002900037, "wql": 0.46836186898669285, "wsql_by_level": [0.18146211048472, 0.33377540218943186, 0.4570456131597061, 0.5504150893516991, 0.6088735954505923, 0.6247770468735193, 0.5930208842717021, 0.5088418252502578, 0.35704525384860764], "n_valid_labels": 83394, "n_masked_labels": 8766, "mae_median": 20.235989950861445, "n_mase_elements": 83394, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.730416022325679, "wql": 0.4444610118863832}}, {"config_id": "kdd_cup_2018_with_missing__H__long", "leaderboard_key": "kdd_cup_2018/H/long", "dataset": "kdd_cup_2018_with_missing/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.8626181081013944, "wql": 0.48346631841404303, "wsql_by_level": [0.1879849503192842, 0.33672916352113014, 0.46084527271172426, 0.5559294727548728, 0.6193657068681274, 0.6438925278545381, 0.6255484892201704, 0.5490170982348758, 0.37188418424166453], "n_valid_labels": 125466, "n_masked_labels": 12774, "mae_median": 18.72813091088498, "n_mase_elements": 125466, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8894528621182541, "wql": 0.3782618005091297}}, {"config_id": "kdd_cup_2018_with_missing__D__short", "leaderboard_key": "kdd_cup_2018/D/short", "dataset": "kdd_cup_2018_with_missing/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 1.0411937701254517, "wql": 0.4017401138759986, "wsql_by_level": [0.17039599861666724, 0.30036137669036833, 0.3951034986671659, 0.4626857576284326, 0.5043410347516797, 0.5198680964731249, 0.5064294526635623, 0.4485036332408756, 0.3079721761521109], "n_valid_labels": 5469, "n_masked_labels": 291, "mae_median": 14.86369142490634, "n_mase_elements": 5469, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8448323206680709, "wql": 0.4519564588216427}}, {"config_id": "car_parts_with_missing__M__short", "leaderboard_key": "car_parts/M/short", "dataset": "car_parts_with_missing", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 1.4856197613408295, "wql": 1.1765739846415382, "wsql_by_level": [0.347378921593696, 0.6162032901660557, 0.8861393399177081, 1.163433632451788, 1.3996605600026089, 1.579024745281525, 1.6780076107891573, 1.620651945864646, 1.2986658157066575], "n_valid_labels": 2244, "n_masked_labels": 60, "mae_median": 0.6567925889851814, "n_mase_elements": 2088, "n_seasonal_error_zero": 14, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9767913606049345, "wql": 0.7210111618390951}}, {"config_id": "restaurant__D__short", "leaderboard_key": "restaurant/D/short", "dataset": "restaurant", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Sales", "n_cohorts": 13, "skipped_series": 1, "metrics": {"mase": 0.699855230782104, "wql": 0.27002494185730236, "wsql_by_level": [0.14043272840861099, 0.2258430954556171, 0.28520270278041004, 0.3234761507573261, 0.34280856791706654, 0.3415619693520698, 0.31838648863722496, 0.2699097244944028, 0.1826030489129928], "n_valid_labels": 5052, "n_masked_labels": 708, "mae_median": 7.281492835717454, "n_mase_elements": 5052, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.709182128880753, "wql": 0.40231357659350614}}, {"config_id": "hierarchical_sales__D__short", "leaderboard_key": "hierarchical_sales/D/short", "dataset": "hierarchical_sales/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.9601874654243095, "wql": 0.6321255477753337, "wsql_by_level": [0.19862388530516814, 0.3730169278374515, 0.5264879563294177, 0.6595736148618315, 0.7652012576813627, 0.8399677859584039, 0.8725574744659007, 0.8262736512102663, 0.6274273763282014], "n_valid_labels": 3304, "n_masked_labels": 236, "mae_median": 3.000821033830937, "n_mase_elements": 3304, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8763760759910977, "wql": 0.4333250079859994}}, {"config_id": "hierarchical_sales__W__short", "leaderboard_key": "hierarchical_sales/W/short", "dataset": "hierarchical_sales/W", "term": "short", "freq": "W-WED", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.8202442974975183, "wql": 0.40248813326840344, "wsql_by_level": [0.1461635361113414, 0.2613576072043297, 0.3528116270399404, 0.4256032260565851, 0.4830573802552875, 0.5212339277970817, 0.5351582677907385, 0.5065778532959115, 0.3904297738644151], "n_valid_labels": 944, "n_masked_labels": 0, "mae_median": 11.794992176784298, "n_mase_elements": 944, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8241952573447494, "wql": 0.5451559736781498}}, {"config_id": "LOOP_SEATTLE__T__short", "leaderboard_key": "loop_seattle/5T/short", "dataset": "LOOP_SEATTLE/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.42519817427238726, "wql": 0.031181385576846916, "wsql_by_level": [0.019991528972427054, 0.02862708174718625, 0.034158205344288976, 0.037402554486037624, 0.0387730100623944, 0.038081308079914646, 0.035126824198851936, 0.02929620986760633, 0.019175747432914985], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 2.516321830658449, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6679218720728912, "wql": 0.5267364609894027}}, {"config_id": "LOOP_SEATTLE__T__medium", "leaderboard_key": "loop_seattle/5T/medium", "dataset": "LOOP_SEATTLE/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6153700402510184, "wql": 0.05035107470783137, "wsql_by_level": [0.03952728883626551, 0.05328890428855708, 0.060342494227199305, 0.0630604828177886, 0.062388730693246866, 0.05825063883612515, 0.05095447011576748, 0.04017562129751607, 0.025171041258016308], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 3.792207310537601, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3930037647961648, "wql": 0.3676395081796952}}, {"config_id": "LOOP_SEATTLE__T__long", "leaderboard_key": "loop_seattle/5T/long", "dataset": "LOOP_SEATTLE/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6761649990417691, "wql": 0.0572653168383857, "wsql_by_level": [0.04464085282520972, 0.06137228261772506, 0.06953601879031288, 0.07232146505861785, 0.07082666909956455, 0.06575204178086193, 0.057327744747106474, 0.04516514571291398, 0.028445630913158826], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 4.172172207085209, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.42402706126430506, "wql": 0.38779650693166234}}, {"config_id": "LOOP_SEATTLE__H__short", "leaderboard_key": "loop_seattle/H/short", "dataset": "LOOP_SEATTLE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6765087096621438, "wql": 0.043084712418972035, "wsql_by_level": [0.03528189165819572, 0.04652347491581842, 0.05148850420576167, 0.05320583232573008, 0.05219769809306395, 0.04947828167100879, 0.04395338924341385, 0.03450724079183582, 0.021126098865920005], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 3.1703119290889137, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3365815681101067, "wql": 0.3199350052903054}}, {"config_id": "LOOP_SEATTLE__H__medium", "leaderboard_key": "loop_seattle/H/medium", "dataset": "LOOP_SEATTLE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7292184192203195, "wql": 0.05217279238334474, "wsql_by_level": [0.04425665343251407, 0.05828015503094614, 0.0639051096731201, 0.06473293891349434, 0.062383728766628496, 0.05750692334672778, 0.05049835212803286, 0.04099334550485246, 0.026997924653786365], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 3.477931014522134, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6389119611838323, "wql": 0.3503693234376778}}, {"config_id": "LOOP_SEATTLE__H__long", "leaderboard_key": "loop_seattle/H/long", "dataset": "LOOP_SEATTLE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.716336874401693, "wql": 0.05060183047334479, "wsql_by_level": [0.042326896443685355, 0.05512505028509922, 0.06045247252338499, 0.06163221696794006, 0.06009255595339377, 0.056268611642367385, 0.05016698696722147, 0.041354068187107, 0.027997615289903844], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 3.373641640123808, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5728641867081193, "wql": 0.2878770265416452}}, {"config_id": "LOOP_SEATTLE__D__short", "leaderboard_key": "loop_seattle/D/short", "dataset": "LOOP_SEATTLE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6223643606000772, "wql": 0.027812585959345843, "wsql_by_level": [0.020193561936795393, 0.028768861819276254, 0.03316673265530382, 0.03484293197107184, 0.03434676837941751, 0.032068569956341296, 0.028439043963701557, 0.023200065216247664, 0.015286737735957246], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 1.9391787310441335, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5152328993290893, "wql": 0.3111097947854181}}, {"config_id": "SZ_TAXI__T__short", "leaderboard_key": "sz_taxi/15T/short", "dataset": "SZ_TAXI/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5228579784923939, "wql": 0.1970768936004838, "wsql_by_level": [0.10235310180573008, 0.16716537193245276, 0.21124872256221705, 0.2388910729780476, 0.2508754203710049, 0.24788375961668113, 0.22992413632960368, 0.19350285463576386, 0.13184760217285352], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 2.807908297890408, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.721074961455623, "wql": 0.6518174809201931}}, {"config_id": "SZ_TAXI__T__medium", "leaderboard_key": "sz_taxi/15T/medium", "dataset": "SZ_TAXI/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.4667788179289419, "wql": 0.19457245178550936, "wsql_by_level": [0.10116326516600097, 0.16112263364312396, 0.20181353850447256, 0.22790857986297222, 0.24114373914778028, 0.24148401288875812, 0.22849603678209912, 0.20024771765220972, 0.14777254242216753], "n_valid_labels": 74880, "n_masked_labels": 0, "mae_median": 2.6688034212137905, "n_mase_elements": 74880, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7350787932775339, "wql": 0.49685998962622685}}, {"config_id": "SZ_TAXI__T__long", "leaderboard_key": "sz_taxi/15T/long", "dataset": "SZ_TAXI/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.4980129818863368, "wql": 0.21872471124890402, "wsql_by_level": [0.115304589447597, 0.1808413247621152, 0.2239024911223661, 0.25036149025498944, 0.2633789287653999, 0.26498570979372804, 0.2558955406474298, 0.23366484942790997, 0.18018747701860072], "n_valid_labels": 112320, "n_masked_labels": 0, "mae_median": 2.92501272927982, "n_mase_elements": 112320, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.818532286161662, "wql": 0.4804784573972439}}, {"config_id": "SZ_TAXI__H__short", "leaderboard_key": "sz_taxi/H/short", "dataset": "SZ_TAXI/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.4818650986186548, "wql": 0.13137636241942816, "wsql_by_level": [0.07027531157556749, 0.10955661008410027, 0.13567807139460025, 0.15209392037294905, 0.15971802754840733, 0.15941767608567592, 0.15145593641185795, 0.13686964832319354, 0.10732205997850143], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 1.7657058466388544, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7916113352519928, "wql": 0.6361103130073918}}, {"config_id": "M_DENSE__H__short", "leaderboard_key": "m_dense/H/short", "dataset": "M_DENSE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.70816880088421, "wql": 0.12777595583992035, "wsql_by_level": [0.0940416557167201, 0.12730103163408915, 0.14547232558437032, 0.15496933303481944, 0.15639081556034648, 0.14938035993420723, 0.13527714716477465, 0.11226154476456596, 0.07488938916538992], "n_valid_labels": 1440, "n_masked_labels": 0, "mae_median": 98.50395038790172, "n_mase_elements": 1440, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8098302153525787, "wql": 0.6730978396901373}}, {"config_id": "M_DENSE__H__medium", "leaderboard_key": "m_dense/H/medium", "dataset": "M_DENSE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7813052589383122, "wql": 0.13916150958667817, "wsql_by_level": [0.0839468237473706, 0.12200603082797291, 0.1442479668226164, 0.1581304855238339, 0.16666886566377695, 0.16843687032708576, 0.1611353821990735, 0.14238774187967418, 0.10549341928869949], "n_valid_labels": 14400, "n_masked_labels": 0, "mae_median": 97.8280440486802, "n_mase_elements": 14400, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6668565885084394, "wql": 0.39789275746283403}}, {"config_id": "M_DENSE__H__long", "leaderboard_key": "m_dense/H/long", "dataset": "M_DENSE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 1.0764692554309299, "wql": 0.17809570501739747, "wsql_by_level": [0.08815323250629209, 0.1410735540862456, 0.17854143324240113, 0.20517321300852073, 0.22310047192928828, 0.2285954304677697, 0.2190965517658008, 0.18834030598237086, 0.13078715216788814], "n_valid_labels": 21600, "n_masked_labels": 0, "mae_median": 130.75150047112393, "n_mase_elements": 21600, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9962526555087059, "wql": 0.4636470652582325}}, {"config_id": "M_DENSE__D__short", "leaderboard_key": "m_dense/D/short", "dataset": "M_DENSE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 1.033643950960055, "wql": 0.09542454774756803, "wsql_by_level": [0.06347547236550455, 0.09393188407318352, 0.11335914009161366, 0.12391438627455373, 0.12531051830391837, 0.1169795823579093, 0.10132838913546541, 0.07562780002886973, 0.04489375709709404], "n_valid_labels": 900, "n_masked_labels": 0, "mae_median": 73.44017768436008, "n_mase_elements": 900, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.025757335852437, "wql": 0.47901057475682746}}, {"config_id": "ett1__T__short", "leaderboard_key": "ett1/15T/short", "dataset": "ett1/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7877373638727412, "wql": 0.27766561273673457, "wsql_by_level": [0.17115798799986884, 0.26325074213497096, 0.31732494743666456, 0.3486148190888516, 0.35724245077913813, 0.35352405536602427, 0.31859189379715164, 0.24150481804585935, 0.12777879998208178], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 1.3056446033006068, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6534624112178543, "wql": 0.577214746526443}}, {"config_id": "ett1__T__medium", "leaderboard_key": "ett1/15T/medium", "dataset": "ett1/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9498380421522724, "wql": 0.3705354577532055, "wsql_by_level": [0.18479904170851444, 0.3262891631785495, 0.43720298942516617, 0.4902123894444339, 0.49835194618526213, 0.4725493348123783, 0.410498000302961, 0.3181601290123875, 0.19675612570919634], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 1.6250812006056377, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.2262810923768237, "wql": 0.8446611031596755}}, {"config_id": "ett1__T__long", "leaderboard_key": "ett1/15T/long", "dataset": "ett1/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.307144751187593, "wql": 0.484231353164451, "wsql_by_level": [0.32044519379308123, 0.4796127755126053, 0.5892257298256933, 0.6426452886050719, 0.6392561091822294, 0.5873755132834569, 0.49750931033550294, 0.37792387166450886, 0.22408838627790922], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 2.1915924136447886, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9849832397532534, "wql": 0.8353424856889321}}, {"config_id": "ett1__H__short", "leaderboard_key": "ett1/H/short", "dataset": "ett1/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7726356581245624, "wql": 0.34251968289765683, "wsql_by_level": [0.19759934766088905, 0.3031639190338136, 0.3731717231822459, 0.42378386420456776, 0.44475795105448696, 0.44057830291431305, 0.40092626065039877, 0.31933512444671125, 0.17936065293148531], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 5.374857471989734, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7399586764835896, "wql": 0.6790479669247866}}, {"config_id": "ett1__H__medium", "leaderboard_key": "ett1/H/medium", "dataset": "ett1/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.3991428670417723, "wql": 0.4332363035852189, "wsql_by_level": [0.30410618415640356, 0.4704771858545054, 0.5392114172157767, 0.5576007510909506, 0.5436870557396306, 0.5015203970655315, 0.43198146856622777, 0.33937526714055377, 0.21116700543738964], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 8.319531202429374, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1434762057287606, "wql": 0.7877949971718228}}, {"config_id": "ett1__H__long", "leaderboard_key": "ett1/H/long", "dataset": "ett1/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.436061394009377, "wql": 0.4187041967200971, "wsql_by_level": [0.3100586483740042, 0.47347088300421175, 0.5447297538736405, 0.5578969570024439, 0.5319711553700133, 0.4751547539889456, 0.3955262397911802, 0.2974199205118426, 0.18210945856459188], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 8.957151509213837, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0027919313374156, "wql": 0.7239955943608372}}, {"config_id": "ett1__D__short", "leaderboard_key": "ett1/D/short", "dataset": "ett1/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.7379944124041118, "wql": 0.33756847378928573, "wsql_by_level": [0.1620133170878742, 0.2962002627857162, 0.3988072918909074, 0.4513767846788654, 0.4528711596212441, 0.4241558967561161, 0.36387028038267033, 0.2908148576147514, 0.19800641328542687], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 143.75229959487916, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9558890891083643, "wql": 0.6956112870175899}}, {"config_id": "ett1__W__short", "leaderboard_key": "ett1/W/short", "dataset": "ett1/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0401542904755747, "wql": 0.19655578741796256, "wsql_by_level": [0.1417659685354361, 0.19202323511237912, 0.23171246827783198, 0.23833150059355862, 0.2226324734280471, 0.21453460320583057, 0.21010518507123527, 0.1822399923304321, 0.13565666020691236], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 555.6324206760952, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8358595974022779, "wql": 0.7614204440831972}}, {"config_id": "ett2__T__short", "leaderboard_key": "ett2/15T/short", "dataset": "ett2/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0694336064769143, "wql": 0.1300259440329757, "wsql_by_level": [0.07024619154982942, 0.10910481518272273, 0.1369538766922629, 0.1554215670776755, 0.16554360726393702, 0.16515344449365948, 0.15417793517110404, 0.13000491823775007, 0.08362714062784012], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 2.6415581504503884, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.403778404354072, "wql": 1.3842912839493247}}, {"config_id": "ett2__T__medium", "leaderboard_key": "ett2/15T/medium", "dataset": "ett2/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8013788268197071, "wql": 0.09589557037266866, "wsql_by_level": [0.062442344077559137, 0.09532673585996267, 0.11402786174212132, 0.1225096423836964, 0.12218240427468238, 0.11474202571235899, 0.1006774633802991, 0.07950371576259843, 0.051647940160739494], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 1.8594081902516164, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8877389913113496, "wql": 0.7025782241924592}}, {"config_id": "ett2__T__long", "leaderboard_key": "ett2/15T/long", "dataset": "ett2/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0070280976302255, "wql": 0.12508008701264237, "wsql_by_level": [0.0861425888728795, 0.1261291943561307, 0.15091368842654168, 0.1631320691714223, 0.16156487527481217, 0.1485440862740269, 0.12629619158849958, 0.09799194762903372, 0.06500614152043467], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 2.4367197962529543, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9530875983260918, "wql": 0.7464822626784796}}, {"config_id": "ett2__H__short", "leaderboard_key": "ett2/H/short", "dataset": "ett2/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7005212020970276, "wql": 0.0760180875396463, "wsql_by_level": [0.05297798128578211, 0.07899861436753486, 0.09249208354052788, 0.09768586778808594, 0.09564036146174022, 0.08604012801734809, 0.0730743783629783, 0.06183555113359217, 0.045417821899227155], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 5.863916364454088, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7064821802191489, "wql": 0.637125813789166}}, {"config_id": "ett2__H__medium", "leaderboard_key": "ett2/H/medium", "dataset": "ett2/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 2.6997179603989685, "wql": 0.26034717331086205, "wsql_by_level": [0.10473916331099253, 0.18863697282489295, 0.26186317542946996, 0.3193415719452675, 0.35743111979962355, 0.36208092114892465, 0.330859277439312, 0.2626379885729415, 0.15553436932633372], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 20.329321246146268, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0191178708314248, "wql": 0.7528429238363763}}, {"config_id": "ett2__H__long", "leaderboard_key": "ett2/H/long", "dataset": "ett2/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 3.2217239655101504, "wql": 0.3559165218046931, "wsql_by_level": [0.2900237568768538, 0.39104001404476496, 0.43848327271807586, 0.4553130903730483, 0.44681216585979033, 0.4122155914838351, 0.35228942504880745, 0.26646637709171755, 0.15060500274534422], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 25.212170086302315, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0157463673452953, "wql": 0.9611658017781922}}, {"config_id": "ett2__D__short", "leaderboard_key": "ett2/D/short", "dataset": "ett2/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 4.734661744814033, "wql": 0.32867900858724947, "wsql_by_level": [0.3016735859700118, 0.39890578527586945, 0.4314240723591547, 0.430661558111209, 0.40573626215401437, 0.3589212649061593, 0.29505514020428636, 0.21482601335951942, 0.1209073949450205], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 548.6558208556403, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.006424061452747, "wql": 1.031392816210494}}, {"config_id": "ett2__W__short", "leaderboard_key": "ett2/W/short", "dataset": "ett2/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.6321554468961936, "wql": 0.17309921274194798, "wsql_by_level": [0.10348270441451943, 0.17462612359193827, 0.20931293600096204, 0.22361376288623414, 0.22312351495354324, 0.20781433434280577, 0.1750220314962269, 0.14161511914865027, 0.09928238784265167], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 2171.5529644829885, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9231329960664922, "wql": 0.8190583801256105}}, {"config_id": "jena_weather__T__short", "leaderboard_key": "jena_weather/10T/short", "dataset": "jena_weather/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.4136366926205477, "wql": 0.01826307160877487, "wsql_by_level": [0.0066087252793233554, 0.011898878670890902, 0.015671763715629672, 0.018800183444110972, 0.021650031026221712, 0.02338061649971047, 0.024199116963668072, 0.022989197851183103, 0.01916913102823559], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 3.411707038030265, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5427111850349482, "wql": 0.1336250356188434}}, {"config_id": "jena_weather__T__medium", "leaderboard_key": "jena_weather/10T/medium", "dataset": "jena_weather/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.8092460761827927, "wql": 0.08302469555381571, "wsql_by_level": [0.023866667411919253, 0.04969422934316776, 0.07292001673125874, 0.09019619510717572, 0.10190225442268169, 0.10859629677824016, 0.10887568558944763, 0.10266840189325654, 0.08850251270719396], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 17.233196419801576, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8275817045838775, "wql": 0.3642966052609432}}, {"config_id": "jena_weather__T__long", "leaderboard_key": "jena_weather/10T/long", "dataset": "jena_weather/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.71085785589237, "wql": 0.07753375982735178, "wsql_by_level": [0.026517810899215753, 0.05158263867650761, 0.07151602829720438, 0.08621359050795607, 0.09551192887993631, 0.0986228221593162, 0.09749944405281147, 0.09151698890186007, 0.07882258607135817], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 16.328159357761105, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7849992115784338, "wql": 0.31921246064856895}}, {"config_id": "jena_weather__H__short", "leaderboard_key": "jena_weather/H/short", "dataset": "jena_weather/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.501028407452742, "wql": 0.05475492069058009, "wsql_by_level": [0.021104770494709237, 0.04377233789533583, 0.057354816974309435, 0.06463419667570057, 0.06637619051863189, 0.06578395304758333, 0.06397621320592457, 0.06058291153542194, 0.04920889586760403], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 11.091345129694442, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6599621484749805, "wql": 0.29836444197683304}}, {"config_id": "jena_weather__H__medium", "leaderboard_key": "jena_weather/H/medium", "dataset": "jena_weather/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.8128829413765802, "wql": 0.08957674510059367, "wsql_by_level": [0.041600030760003424, 0.07088384477188964, 0.088614759505003, 0.09871587715928565, 0.10349411265634889, 0.10705025355950666, 0.1073536633919154, 0.10222347904294532, 0.08625468505844502], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 17.826358951349487, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7591849551593689, "wql": 0.246023059258878}}, {"config_id": "jena_weather__H__long", "leaderboard_key": "jena_weather/H/long", "dataset": "jena_weather/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.9833592005773739, "wql": 0.11928175584415124, "wsql_by_level": [0.06021289491839813, 0.10980343022798765, 0.13527727841893505, 0.14548322832648072, 0.14471711673100054, 0.1395123022974652, 0.12994232757621146, 0.11532789130025589, 0.09325933280062645], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 25.224927203146795, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.658841755665935, "wql": 0.2687262784398826}}, {"config_id": "jena_weather__D__short", "leaderboard_key": "jena_weather/D/short", "dataset": "jena_weather/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.4535239618710496, "wql": 0.11146099179186322, "wsql_by_level": [0.05772887196401991, 0.1000696255021768, 0.12447077518288599, 0.13643453611532597, 0.14036779213683404, 0.13622245910614034, 0.12708195479253323, 0.1064783364660867, 0.074294574860766], "n_valid_labels": 630, "n_masked_labels": 0, "mae_median": 24.466817761288073, "n_mase_elements": 630, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7823702149104226, "wql": 0.48171649762027424}}, {"config_id": "bitbrains_fast_storage__T__short", "leaderboard_key": "bitbrains_fast_storage/5T/short", "dataset": "bitbrains_fast_storage/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6396329283345135, "wql": 0.4893255945916352, "wsql_by_level": [0.20707631155256367, 0.3426775091737015, 0.44425791785215585, 0.5136279327329788, 0.569970469171546, 0.6190315287681786, 0.6357219087280306, 0.5964443919918374, 0.4751223813537247], "n_valid_labels": 16726, "n_masked_labels": 1706, "mae_median": 135.9774617170374, "n_mase_elements": 16078, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 4}, "relative": {"mase": 0.4336113552721743, "wql": 0.19973415252734247}}, {"config_id": "bitbrains_fast_storage__T__medium", "leaderboard_key": "bitbrains_fast_storage/5T/medium", "dataset": "bitbrains_fast_storage/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.2823505350856539, "wql": 0.9204756719991529, "wsql_by_level": [0.7068885439884177, 1.2199587038249335, 1.2986491543478493, 1.242500227271508, 1.1296531051462149, 0.9783808120520179, 0.797424797059384, 0.5826653607547148, 0.3281603435473359], "n_valid_labels": 173366, "n_masked_labels": 10954, "mae_median": 531.1822922052705, "n_mase_elements": 169900, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 20}, "relative": {"mase": 0.8995106320827394, "wql": 0.922140110905034}}, {"config_id": "bitbrains_fast_storage__T__long", "leaderboard_key": "bitbrains_fast_storage/5T/long", "dataset": "bitbrains_fast_storage/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.003057003333043, "wql": 0.4342224496133564, "wsql_by_level": [0.23793413043329423, 0.4048407657343644, 0.49331326145922405, 0.5436802338256669, 0.5607834178723312, 0.5400986043326984, 0.4897609579905021, 0.3945289451674268, 0.24306172970469872], "n_valid_labels": 263236, "n_masked_labels": 13244, "mae_median": 455.6692861078686, "n_mase_elements": 252350, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 12}, "relative": {"mase": 0.8278558454895827, "wql": 0.6744046853095246}}, {"config_id": "bitbrains_fast_storage__H__short", "leaderboard_key": "bitbrains_fast_storage/H/short", "dataset": "bitbrains_fast_storage/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.566240723083086, "wql": 0.460430501484308, "wsql_by_level": [0.3284192317937252, 0.5271802482699615, 0.5968982554258156, 0.6041513004765608, 0.5733865939898345, 0.5132410217013492, 0.4367964799587199, 0.3447941864604242, 0.21900719528238058], "n_valid_labels": 17892, "n_masked_labels": 540, "mae_median": 397.57576030244593, "n_mase_elements": 17316, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 6}, "relative": {"mase": 0.9109722316466803, "wql": 0.766521326783759}}, {"config_id": "bitbrains_rnd__T__short", "leaderboard_key": "bitbrains_rnd/5T/short", "dataset": "bitbrains_rnd/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5211174300914677, "wql": 0.19250376266775776, "wsql_by_level": [0.11130984871831118, 0.16474338601595379, 0.1979934855669115, 0.21911239798363313, 0.22465474438653157, 0.22210064241016592, 0.21243437961395384, 0.20082723783963055, 0.17935774147472835], "n_valid_labels": 17856, "n_masked_labels": 576, "mae_median": 102.21508052536883, "n_mase_elements": 17376, "n_seasonal_error_zero": 10, "n_seasonal_error_nan": 12}, "relative": {"mase": 0.634958543756279, "wql": 0.20032237276725073}}, {"config_id": "bitbrains_rnd__T__medium", "leaderboard_key": "bitbrains_rnd/5T/medium", "dataset": "bitbrains_rnd/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.9277904693654061, "wql": 0.8123310042815085, "wsql_by_level": [0.3793326641892228, 0.7323109225631247, 0.8980399863374966, 0.9736284030250074, 0.9945762735485142, 0.9695789961224563, 0.9065584121238849, 0.8071500210131923, 0.6498033596106778], "n_valid_labels": 179348, "n_masked_labels": 4972, "mae_median": 312.3318546654097, "n_mase_elements": 176510, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 8}, "relative": {"mase": 0.8958969667427079, "wql": 0.8584347201196296}}, {"config_id": "bitbrains_rnd__T__long", "leaderboard_key": "bitbrains_rnd/5T/long", "dataset": "bitbrains_rnd/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.8388015954178812, "wql": 0.8515044254818762, "wsql_by_level": [0.4453629273731855, 0.6063950180783263, 0.7172052349133586, 0.8185647701585127, 0.912490397348722, 1.0057434139863084, 1.0799059574881968, 1.1114984838279558, 0.96637362616232], "n_valid_labels": 262774, "n_masked_labels": 13706, "mae_median": 239.42580187128624, "n_mase_elements": 256386, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 22}, "relative": {"mase": 0.8795781411608433, "wql": 0.7119784512335846}}, {"config_id": "bitbrains_rnd__H__short", "leaderboard_key": "bitbrains_rnd/H/short", "dataset": "bitbrains_rnd/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 192, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7868212161796346, "wql": 0.6295687211926445, "wsql_by_level": [0.15042726171777046, 0.31537820331132177, 0.5139129442012994, 0.6825863404660105, 0.8273207875925015, 0.8954290416125545, 0.8778721210277796, 0.802465268498955, 0.6007265223056075], "n_valid_labels": 18028, "n_masked_labels": 404, "mae_median": 320.7036235593324, "n_mase_elements": 17472, "n_seasonal_error_zero": 4, "n_seasonal_error_nan": 16}, "relative": {"mase": 0.6557939572938044, "wql": 0.6541876308215867}}, {"config_id": "bizitobs_application__S__short", "leaderboard_key": "bizitobs_application/10S/short", "dataset": "bizitobs_application", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5365259750149728, "wql": 0.009654993860777627, "wsql_by_level": [0.005724845362497532, 0.00920887429438802, 0.011466729962842885, 0.01266084206423771, 0.012951872384924368, 0.012313010096105564, 0.010544246709686766, 0.00775752984075642, 0.004266994031559382], "n_valid_labels": 120, "n_masked_labels": 0, "mae_median": 335.13487946192424, "n_mase_elements": 120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.38500187920526924, "wql": 0.52459756299694}}, {"config_id": "bizitobs_application__S__medium", "leaderboard_key": "bizitobs_application/10S/medium", "dataset": "bizitobs_application", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.670653392134585, "wql": 0.008981826130304946, "wsql_by_level": [0.0053366038757372, 0.008049966794615416, 0.00992207713123076, 0.011052931794968844, 0.01154130838274721, 0.011256373314944335, 0.010204657507417605, 0.008291323572934061, 0.005181192798149096], "n_valid_labels": 1200, "n_masked_labels": 0, "mae_median": 276.3001642068227, "n_mase_elements": 1200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7302938272520174, "wql": 0.6535816313232373}}, {"config_id": "bizitobs_application__S__long", "leaderboard_key": "bizitobs_application/10S/long", "dataset": "bizitobs_application", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7073717633687269, "wql": 0.00936897182344085, "wsql_by_level": [0.0056248523183692915, 0.008790223831655883, 0.010743770191326657, 0.011757188151021558, 0.011915729308279865, 0.011455608273473097, 0.010329936196961464, 0.008389199827276088, 0.00531423831260375], "n_valid_labels": 1800, "n_masked_labels": 0, "mae_median": 290.33115371280246, "n_mase_elements": 1800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9447672897600948, "wql": 0.7238819059421883}}, {"config_id": "bizitobs_service__S__short", "leaderboard_key": "bizitobs_service/10S/short", "dataset": "bizitobs_service", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5056253458415603, "wql": 0.008997030137135983, "wsql_by_level": [0.005544246292032471, 0.008735699680501302, 0.01078215627564844, 0.011832983659387085, 0.012001755131681273, 0.011368232217467607, 0.009836286187428203, 0.007227603780454877, 0.0036443080096225976], "n_valid_labels": 2520, "n_masked_labels": 0, "mae_median": 16.092892949141206, "n_mase_elements": 2520, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4788533738841219, "wql": 0.352616776583892}}, {"config_id": "bizitobs_service__S__medium", "leaderboard_key": "bizitobs_service/10S/medium", "dataset": "bizitobs_service", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6760128108560223, "wql": 0.00981458802096833, "wsql_by_level": [0.0060991305699777745, 0.009245982524425041, 0.011209319536050581, 0.012253208488651208, 0.012497058851992919, 0.012008801468687425, 0.010785806750653507, 0.00873847968665123, 0.0054935043116252965], "n_valid_labels": 25200, "n_masked_labels": 0, "mae_median": 15.762687789265598, "n_mase_elements": 25200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7081158524164899, "wql": 0.4174036444620968}}, {"config_id": "bizitobs_service__S__long", "leaderboard_key": "bizitobs_service/10S/long", "dataset": "bizitobs_service", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7411342906991989, "wql": 0.010556989822489177, "wsql_by_level": [0.006410213440200779, 0.009894457883444204, 0.012035222781647042, 0.013195692023143005, 0.013489119352055726, 0.013023600495377506, 0.011666882061255542, 0.009323164267890002, 0.0059745560973887835], "n_valid_labels": 37800, "n_masked_labels": 0, "mae_median": 17.23687046433836, "n_mase_elements": 37800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8911148567780734, "wql": 0.4458379328384122}}, {"config_id": "bizitobs_l2c__T__short", "leaderboard_key": "bizitobs_l2c/5T/short", "dataset": "bizitobs_l2c/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.18322311795554455, "wql": 0.054518895403781596, "wsql_by_level": [0.036908051629222303, 0.055444112480953024, 0.06565553562335827, 0.06940281424515697, 0.06840994660832993, 0.06426975462043978, 0.0553060782947343, 0.04397503126257423, 0.031298733869265495], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 1.7574006347429185, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.2372922751834896, "wql": 0.24675367177697805}}, {"config_id": "bizitobs_l2c__T__medium", "leaderboard_key": "bizitobs_l2c/5T/medium", "dataset": "bizitobs_l2c/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.4610753969735693, "wql": 0.1528605630177465, "wsql_by_level": [0.12384610134301514, 0.1678060742527983, 0.18818114349117637, 0.18628440521650788, 0.1788416975151349, 0.17203827233629065, 0.15227199762905824, 0.11956653494393596, 0.08690884043180094], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 3.9802337528694243, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3198153451739089, "wql": 0.324605479579304}}, {"config_id": "bizitobs_l2c__T__long", "leaderboard_key": "bizitobs_l2c/5T/long", "dataset": "bizitobs_l2c/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7459196494649294, "wql": 0.28002923026495735, "wsql_by_level": [0.14189577835254674, 0.22637030369472252, 0.289039711240719, 0.3354423425265624, 0.37103875275917725, 0.37788119691475053, 0.3580260520587308, 0.27691033483740524, 0.1436586000000015], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 6.787637180119517, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.44346423004685526, "wql": 0.41450854587151004}}, {"config_id": "bizitobs_l2c__H__short", "leaderboard_key": "bizitobs_l2c/H/short", "dataset": "bizitobs_l2c/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7505402275148327, "wql": 0.2262536880109035, "wsql_by_level": [0.13227568214422789, 0.2326930988529389, 0.30614538883800735, 0.329868513126158, 0.3282708313225938, 0.28868459830168486, 0.20890769001996812, 0.13036976360724126, 0.07906762588531176], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 6.868164217365639, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4736514683215731, "wql": 0.4059262777826502}}, {"config_id": "bizitobs_l2c__H__medium", "leaderboard_key": "bizitobs_l2c/H/medium", "dataset": "bizitobs_l2c/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.35672871360610625, "wql": 0.2151929516544161, "wsql_by_level": [0.11857116283033574, 0.1845369054539126, 0.21966346683797974, 0.24345271425312393, 0.2562009800788367, 0.25523936841907074, 0.24786605846265178, 0.23175813842136378, 0.17944777013246996], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 3.5065599092326702, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.22075296885394705, "wql": 0.19268863222793592}}, {"config_id": "bizitobs_l2c__H__long", "leaderboard_key": "bizitobs_l2c/H/long", "dataset": "bizitobs_l2c/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.4325885606544303, "wql": 0.21763516941937858, "wsql_by_level": [0.11999215158299158, 0.19215285432455603, 0.2356988499450652, 0.2593403749509408, 0.26444359568403997, 0.25745491168733164, 0.24400614746013263, 0.21989427543055365, 0.16573336370879574], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 3.9954311957050646, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3379006855428726, "wql": 0.21475638959074228}}], "cpu_seconds": 1.3254058239981532, "members": ["/workspace/research/evals/weekly_slow_ar_delta3k", "/workspace/research/evals/patch8_ema6000", "/workspace/research/evals/split_patch_ema12000"], "member_checkpoint_hashes": ["094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "weights": [0.3333333333333333, 0.3333333333333333, 0.3333333333333333], "selection_only": true, "cutoff": "valid_screen", "E102skill": 0.38490788212550675, "difference": 0.0005607513307689382} +{"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.34022701617855455, "rel_mase_gmean": 0.793943875648557, "rel_wql_gmean": 0.5482760224393256, "groups": {"term": {"short": 0.30679900406441385, "medium": 0.36032523598865074, "long": 0.4021215513716557}, "domain": {"Econ/Fin": 0.1721308320213788, "Energy": 0.23201167666328837, "Healthcare": 0.41340649703065946, "Nature": 0.3726147779766633, "Sales": 0.40537645795323973, "Transport": 0.3736005845535242, "Web/CloudOps": 0.4512360055080098}, "freq": {"A-DEC": 0.32618793542255464, "Q-DEC": 0.23705558696487827, "M": 0.18927345845861632, "W-SUN": 0.04774678469324367, "D": 0.3525759177381407, "H": 0.3717309606412096, "15T": 0.22268456202455988, "W-FRI": 0.23138568044707775, "10T": 0.32565055179276703, "W-TUE": 0.5626997768481531, "W-THU": 0.2588925082219147, "W-WED": 0.36108396742238325, "5T": 0.44162689257641674, "10S": 0.34789392531645824}}, "configs": [{"config_id": "m4_yearly__A__short", "leaderboard_key": "m4_yearly/A/short", "dataset": "m4_yearly", "term": "short", "freq": "A-DEC", "prediction_length": 6, "seasonality": 1, "n_variates": 1, "n_instances": 152, "domain": "Econ/Fin", "n_cohorts": 3, "skipped_series": 235, "dropped_containers": 11, "metrics": {"mase": 3.037902337626994, "wql": 0.09815505039265969, "wsql_by_level": [0.05160042192944336, 0.0811926081610661, 0.10477089379142959, 0.11816640740805852, 0.12242559934653295, 0.12257290813667518, 0.11503862092825626, 0.09804872106545864, 0.06957927276701664], "n_valid_labels": 912, "n_masked_labels": 0, "mae_median": 521.7503059788754, "n_mase_elements": 912, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6383825071799306, "wql": 0.7112079251290501}}, {"config_id": "m4_quarterly__Q__short", "leaderboard_key": "m4_quarterly/Q/short", "dataset": "m4_quarterly", "term": "short", "freq": "Q-DEC", "prediction_length": 8, "seasonality": 4, "n_variates": 1, "n_instances": 190, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 95, "metrics": {"mase": 1.1658471474205265, "wql": 0.07590016082227818, "wsql_by_level": [0.04536972898090432, 0.06673398496299082, 0.0791267276623346, 0.08758012702442965, 0.09189271723631638, 0.09232417412241245, 0.08807945136398072, 0.07637413311013558, 0.05562040293699915], "n_valid_labels": 1520, "n_masked_labels": 0, "mae_median": 470.5227991405286, "n_mase_elements": 1520, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7561361981507358, "wql": 0.7698139287671926}}, {"config_id": "m4_monthly__M__short", "leaderboard_key": "m4_monthly/M/short", "dataset": "m4_monthly", "term": "short", "freq": "M", "prediction_length": 18, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 499, "metrics": {"mase": 0.9139769716535198, "wql": 0.0871699317752213, "wsql_by_level": [0.04608788598960208, 0.07304806082562258, 0.09096215954844103, 0.10182623614350343, 0.10779716433420318, 0.10903505271737492, 0.1032173746742856, 0.08877763366532075, 0.06377781807863801], "n_valid_labels": 3456, "n_masked_labels": 0, "mae_median": 488.5874289362519, "n_mase_elements": 3456, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7164257853065333, "wql": 0.6235116787717548}}, {"config_id": "m4_weekly__W__short", "leaderboard_key": "m4_weekly/W/short", "dataset": "m4_weekly", "term": "short", "freq": "W-SUN", "prediction_length": 13, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 4, "metrics": {"mase": 3.1100809288727103, "wql": 0.055098038079052614, "wsql_by_level": [0.032602047194699495, 0.04785429715208218, 0.05725972722518824, 0.06333705164638065, 0.06706519071059011, 0.06758570043383451, 0.06409405578058587, 0.05605318360657813, 0.04003108896153436], "n_valid_labels": 2496, "n_masked_labels": 0, "mae_median": 336.8346457389685, "n_mase_elements": 2496, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.158338248458987, "wql": 0.7828336733837569}}, {"config_id": "m4_daily__D__short", "leaderboard_key": "m4_daily/D/short", "dataset": "m4_daily", "term": "short", "freq": "D", "prediction_length": 14, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 23, "metrics": {"mase": 3.365311284055928, "wql": 0.01953638209252006, "wsql_by_level": [0.01299470704967311, 0.019569479837904673, 0.02314227463682247, 0.024675381709502498, 0.02471096336713756, 0.023348724884659326, 0.020517867021259475, 0.016315514473370443, 0.010552525852351015], "n_valid_labels": 2688, "n_masked_labels": 0, "mae_median": 178.2896702403114, "n_mase_elements": 2688, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.147522273526741, "wql": 1.1860716967977745}}, {"config_id": "m4_hourly__H__short", "leaderboard_key": "m4_hourly/H/short", "dataset": "m4_hourly", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 1, "metrics": {"mase": 1.1122722486534364, "wql": 0.03736682604153149, "wsql_by_level": [0.01874741392379996, 0.03145967904991591, 0.04068737146647257, 0.0456794174593893, 0.04753805000550144, 0.04721690942603064, 0.04404922953445294, 0.03685106292326483, 0.024072300584955922], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 352.90519963156515, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8953871829604685, "wql": 0.7944626922388952}}, {"config_id": "electricity__T__short", "leaderboard_key": "electricity/15T/short", "dataset": "electricity/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7414485035347453, "wql": 0.05874078023278089, "wsql_by_level": [0.03660522792607276, 0.054623159839400255, 0.06574675212827316, 0.07161938696534081, 0.07289646506205745, 0.0709393775615199, 0.06491803982321434, 0.05428902047892521, 0.03702959231022416], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 24.881237040894728, "n_mase_elements": 9168, "n_seasonal_error_zero": 1, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9007102952311252, "wql": 0.8955152027394758}}, {"config_id": "electricity__T__medium", "leaderboard_key": "electricity/15T/medium", "dataset": "electricity/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8341249217131992, "wql": 0.0588387869460271, "wsql_by_level": [0.032029932243865376, 0.05030349324262281, 0.06257228393377615, 0.07028636322757713, 0.07393768470060368, 0.0734247240139721, 0.06850076640753922, 0.05820932687517861, 0.040284507869108886], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 42.24310534259891, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7399527532889328, "wql": 0.6348937040939772}}, {"config_id": "electricity__T__long", "leaderboard_key": "electricity/15T/long", "dataset": "electricity/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7783637870874349, "wql": 0.05518133110407022, "wsql_by_level": [0.03188683872861633, 0.048383447963460495, 0.05900291425963093, 0.06546503930631685, 0.06854103198610194, 0.06818039746638782, 0.06368531022730614, 0.05412012180224378, 0.03736687819656763], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 44.27354983369999, "n_mase_elements": 137520, "n_seasonal_error_zero": 1, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7682049221663798, "wql": 0.6060938006492076}}, {"config_id": "electricity__H__short", "leaderboard_key": "electricity/H/short", "dataset": "electricity/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.005195247495848, "wql": 0.1076856363194789, "wsql_by_level": [0.056397069100389094, 0.08542071182630076, 0.10586568127503418, 0.12027328825594023, 0.12946795446135537, 0.13311199502313206, 0.12999302041997104, 0.1175107840454948, 0.0911302224676928], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 469.98805135850694, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9662502361868567, "wql": 0.9473149320482348}}, {"config_id": "electricity__H__medium", "leaderboard_key": "electricity/H/medium", "dataset": "electricity/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 191, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.278985998725151, "wql": 0.08168963046658351, "wsql_by_level": [0.038246727237136076, 0.06055069824767401, 0.07688735765720536, 0.08883191357429941, 0.09690449614467006, 0.10127365248392153, 0.100903593259357, 0.09422247612259164, 0.07738575947239647], "n_valid_labels": 91680, "n_masked_labels": 0, "mae_median": 167.4791256503792, "n_mase_elements": 91680, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8050794219396586, "wql": 0.6818928301208295}}, {"config_id": "electricity__H__long", "leaderboard_key": "electricity/H/long", "dataset": "electricity/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.005989986542046, "wql": 0.0717512335841778, "wsql_by_level": [0.049766060526332916, 0.0693342995653751, 0.08060650327958628, 0.08627758903474247, 0.0875531085760828, 0.0847966155464082, 0.07769951011733353, 0.06513523172470284, 0.04459218388703604], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 167.4959181247693, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8444221392598532, "wql": 0.49822417172241473}}, {"config_id": "electricity__D__short", "leaderboard_key": "electricity/D/short", "dataset": "electricity/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1917353430285285, "wql": 0.05653707378588931, "wsql_by_level": [0.028734693953438258, 0.046048837523563535, 0.0540482446124841, 0.06007380156021994, 0.06768452994506077, 0.07239000603555543, 0.07146735784754593, 0.06328271681240813, 0.045103475782727644], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 4460.843291813383, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9078475373444427, "wql": 0.7012293467791362}}, {"config_id": "electricity__W__short", "leaderboard_key": "electricity/W/short", "dataset": "electricity/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 191, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1478089106300988, "wql": 0.05751283904096939, "wsql_by_level": [0.042071013341648984, 0.06220590585953188, 0.07164510277304512, 0.07673931931529472, 0.0740760284170807, 0.06473270874411347, 0.045854636942121274, 0.04171226851328447, 0.03857856746260389], "n_valid_labels": 1528, "n_masked_labels": 0, "mae_median": 34350.672626595224, "n_mase_elements": 1528, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8916680515190532, "wql": 0.7078612687253304}}, {"config_id": "solar__T__short", "leaderboard_key": "solar/10T/short", "dataset": "solar/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 2.2569681674637607, "wql": 0.27450083346814824, "wsql_by_level": [0.17580773794424964, 0.26214253166540347, 0.30958668541568485, 0.3326243908805928, 0.3385805727016281, 0.3285689033235246, 0.3036853577440995, 0.2542765365056289, 0.16523478503252242], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 4.793607888196044, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7899645662054536, "wql": 0.7814825817695297}}, {"config_id": "solar__T__medium", "leaderboard_key": "solar/10T/medium", "dataset": "solar/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.411404056768297, "wql": 0.4897848466734051, "wsql_by_level": [0.339130686589927, 0.5559608554346483, 0.6400826123950002, 0.6509103069605772, 0.6176635830074539, 0.5558985852383285, 0.46434349103858485, 0.3527329145514503, 0.23134058484467496], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 3.0150506714476757, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8376883417448442, "wql": 0.6607978423819508}}, {"config_id": "solar__T__long", "leaderboard_key": "solar/10T/long", "dataset": "solar/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.430149138591592, "wql": 0.5495577844671765, "wsql_by_level": [0.4157401410782553, 0.6083748609468729, 0.6967427243138244, 0.7227016883592806, 0.7000813698397036, 0.6349690598273663, 0.5349107411605489, 0.39991406028280785, 0.23258541439592897], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 3.0458078342487633, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.964859187184016, "wql": 0.657464015239788}}, {"config_id": "solar__H__short", "leaderboard_key": "solar/H/short", "dataset": "solar/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.6032989531688455, "wql": 0.1562461810465075, "wsql_by_level": [0.1269083400787946, 0.16975321749136202, 0.1870554715552497, 0.19526095379716882, 0.19537370345968197, 0.1804040518453034, 0.15323976337516274, 0.11880742989820889, 0.07941269791763558], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 8.069525182930924, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9112658674603129, "wql": 0.4977486438341271}}, {"config_id": "solar__H__medium", "leaderboard_key": "solar/H/medium", "dataset": "solar/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8298881294707111, "wql": 0.20765944252671026, "wsql_by_level": [0.13702955611790757, 0.20442243059967066, 0.24086463443054604, 0.2603003402361452, 0.26689643592954443, 0.25744601781061316, 0.2300159089787736, 0.1781150671560422, 0.09384459148114953], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 11.036797324489177, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6338663004639878, "wql": 0.30866947754193164}}, {"config_id": "solar__H__long", "leaderboard_key": "solar/H/long", "dataset": "solar/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8664748980834234, "wql": 0.24149192208142528, "wsql_by_level": [0.20212932324840507, 0.26476239855549133, 0.29158481759233384, 0.2990499375543338, 0.29371152501441994, 0.2763990815201093, 0.2440782241170833, 0.19064763041624877, 0.11106436071440225], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 11.45228937594979, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9187700921037038, "wql": 0.31406052602147916}}, {"config_id": "solar__D__short", "leaderboard_key": "solar/D/short", "dataset": "solar/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8662851913167189, "wql": 0.18096753724081802, "wsql_by_level": [0.13449481850277614, 0.2025700781264022, 0.23433717425007533, 0.24304762270253996, 0.23482219503100754, 0.21122660012807895, 0.17501660705638253, 0.12582756656144395, 0.06736517280865549], "n_valid_labels": 4110, "n_masked_labels": 0, "mae_median": 219.74637008444236, "n_mase_elements": 4110, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9695104857715756, "wql": 0.46212316645231355}}, {"config_id": "solar__W__short", "leaderboard_key": "solar/W/short", "dataset": "solar/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.4968143843922421, "wql": 0.07159665674111809, "wsql_by_level": [0.08119457306313575, 0.08510824224183965, 0.07550284183365813, 0.06882739354028107, 0.0698621354913643, 0.0725424822367246, 0.07162788277173564, 0.06606170669939873, 0.05364265279192507], "n_valid_labels": 1096, "n_masked_labels": 0, "mae_median": 491.3424066696724, "n_mase_elements": 1096, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8469430211434178, "wql": 0.6528724385888193}}, {"config_id": "hospital__M__short", "leaderboard_key": "hospital/M/short", "dataset": "hospital", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.8481243709218815, "wql": 0.0665162351031477, "wsql_by_level": [0.03760282071491459, 0.05621833396756983, 0.06829957085769918, 0.0773011330794918, 0.08258827118115555, 0.08398543271819885, 0.07980048778138711, 0.06773460883029214, 0.045115456797620405], "n_valid_labels": 2304, "n_masked_labels": 0, "mae_median": 29.84849091122548, "n_mase_elements": 2304, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8634206906224304, "wql": 0.9269797009125593}}, {"config_id": "covid_deaths__D__short", "leaderboard_key": "covid_deaths/D/short", "dataset": "covid_deaths", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 41.65824528650925, "wql": 0.09378869450337197, "wsql_by_level": [0.06893365326520318, 0.09745776414805045, 0.11347630040720862, 0.11327189144529728, 0.10493573295622083, 0.10197121627492853, 0.08579602466634267, 0.0759116145972824, 0.08234405276981378], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 104.63141933064779, "n_mase_elements": 4830, "n_seasonal_error_zero": 31, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.902118695367908, "wql": 0.6264220401997149}}, {"config_id": "us_births__D__short", "leaderboard_key": "us_births/D/short", "dataset": "us_births/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.7505052337781618, "wql": 0.03418652269517344, "wsql_by_level": [0.019749713764894636, 0.03171121505489005, 0.03927113138939224, 0.04338475020201229, 0.0447388278680091, 0.04228310721274306, 0.03756746364626895, 0.029155380423803685, 0.01981711469454688], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 494.60712890625, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4887905216980433, "wql": 0.32205892136256864}}, {"config_id": "us_births__M__short", "leaderboard_key": "us_births/M/short", "dataset": "us_births/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.4641970150847043, "wql": 0.010839906647462445, "wsql_by_level": [0.007690452660143038, 0.011101179131491754, 0.013314852898448347, 0.013933100581369, 0.01413719115604733, 0.012927403511671366, 0.01051376419769212, 0.008277431100709318, 0.005663784589589735], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 4419.627604166667, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6064599747287054, "wql": 0.5841568114542499}}, {"config_id": "us_births__W__short", "leaderboard_key": "us_births/W/short", "dataset": "us_births/W", "term": "short", "freq": "W-TUE", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.4843569991561676, "wql": 0.005578090588797161, "wsql_by_level": [0.0035051770054383377, 0.0061232056864479805, 0.007010747861980568, 0.0072738841606162915, 0.006934070457851651, 0.006446740210251619, 0.005279154454708256, 0.00407659575081509, 0.003553239711064651], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 526.111328125, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4492358442736684, "wql": 0.4256817161992966}}, {"config_id": "saugeenday__D__short", "leaderboard_key": "saugeen/D/short", "dataset": "saugeenday/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.675554660589966, "wql": 0.31344431652848964, "wsql_by_level": [0.12161772616823995, 0.19689573333266563, 0.2341903522250219, 0.2574401621359866, 0.3589836675399531, 0.4293852679891742, 0.45935019692894014, 0.4411765039690803, 0.3219592384673449], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 7.4788263956705725, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.2879724425121457, "wql": 0.4718377991729083}}, {"config_id": "saugeenday__M__short", "leaderboard_key": "saugeen/M/short", "dataset": "saugeenday/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.5927630646565163, "wql": 0.3203269447356998, "wsql_by_level": [0.12598857865704416, 0.18968222121544395, 0.24040851967481697, 0.3136420374208496, 0.38228621366892634, 0.42160177466840687, 0.45474315632306894, 0.43669600555236926, 0.3178939954403716], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 10.376739422480265, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.3051388914641786, "wql": 1.0458487266954335}}, {"config_id": "saugeenday__W__short", "leaderboard_key": "saugeen/W/short", "dataset": "saugeenday/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.3519638114323024, "wql": 0.2662752495211793, "wsql_by_level": [0.11372987147884636, 0.18552782814033983, 0.23128901181167458, 0.27377207562527, 0.32433923441108065, 0.3547655413558739, 0.39123735928434705, 0.3490464389655082, 0.17276988461767362], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 4.22625607252121, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8894037617219445, "wql": 0.24018150950267242}}, {"config_id": "temperature_rain_with_missing__D__short", "leaderboard_key": "temperature_rain/D/short", "dataset": "temperature_rain_with_missing", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.5515686319785789, "wql": 0.5381728314133933, "wsql_by_level": [0.18632494166550886, 0.34708943125977854, 0.48836454284916286, 0.6053340733310679, 0.686717752974089, 0.7200669298086018, 0.7158889436906286, 0.6381245989700771, 0.4556442681716257], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 6.085248474554371, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.054893375281003, "wql": 0.5056231367221576}}, {"config_id": "kdd_cup_2018_with_missing__H__short", "leaderboard_key": "kdd_cup_2018/H/short", "dataset": "kdd_cup_2018_with_missing/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 176, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.9314590653179857, "wql": 0.4144698581629218, "wsql_by_level": [0.17042770636579477, 0.31958737278243426, 0.43495208981935, 0.5140882428507184, 0.5569903741134093, 0.5563970412640289, 0.5050260744081512, 0.40239699224894754, 0.27036282961346225], "n_valid_labels": 8071, "n_masked_labels": 377, "mae_median": 18.78991258007594, "n_mase_elements": 8071, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8075459670396663, "wql": 0.7189950739967459}}, {"config_id": "kdd_cup_2018_with_missing__H__medium", "leaderboard_key": "kdd_cup_2018/H/medium", "dataset": "kdd_cup_2018_with_missing/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 183, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.8480288628030781, "wql": 0.470069973426411, "wsql_by_level": [0.17893876446622387, 0.32772203748762174, 0.4507381237346121, 0.5418444741746805, 0.5981812239304258, 0.6181714963553333, 0.5994242556270963, 0.5328490400735261, 0.38276034498817996], "n_valid_labels": 84423, "n_masked_labels": 3417, "mae_median": 17.355613578305753, "n_mase_elements": 84423, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7006489300316523, "wql": 0.412321717770212}}, {"config_id": "kdd_cup_2018_with_missing__H__long", "leaderboard_key": "kdd_cup_2018/H/long", "dataset": "kdd_cup_2018_with_missing/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 182, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.857558379067222, "wql": 0.47829225390599056, "wsql_by_level": [0.17818917454251948, 0.3338041316392467, 0.4596481048436853, 0.5522913851434088, 0.61105096369842, 0.6339827967625987, 0.6151859222096626, 0.5407691871915298, 0.37970861912284326], "n_valid_labels": 124627, "n_masked_labels": 6413, "mae_median": 18.779386165107308, "n_mase_elements": 124627, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7889175398800053, "wql": 0.3718634450419643}}, {"config_id": "kdd_cup_2018_with_missing__D__short", "leaderboard_key": "kdd_cup_2018/D/short", "dataset": "kdd_cup_2018_with_missing/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 184, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 1.1398713402362113, "wql": 0.4452585200870648, "wsql_by_level": [0.23439720860283367, 0.3630833673662009, 0.4535136492570833, 0.5149219367451351, 0.5514592922543351, 0.5604099266997383, 0.5370881317145794, 0.4682844182400131, 0.32416874990366445], "n_valid_labels": 5433, "n_masked_labels": 87, "mae_median": 16.537140032977618, "n_mase_elements": 5433, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0568695442143516, "wql": 0.517322856079971}}, {"config_id": "car_parts_with_missing__M__short", "leaderboard_key": "car_parts/M/short", "dataset": "car_parts_with_missing", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 187, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.8263689971998104, "wql": 1.2192532765615771, "wsql_by_level": [0.2766903109814157, 0.6254175547601963, 0.9438783489916143, 1.2223525838813596, 1.4755679973457547, 1.657124344371809, 1.7430252986469423, 1.6540169406612468, 1.375206109413854], "n_valid_labels": 2244, "n_masked_labels": 0, "mae_median": 0.748962544107315, "n_mase_elements": 1368, "n_seasonal_error_zero": 73, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9001036285124183, "wql": 0.7882894800168283}}, {"config_id": "restaurant__D__short", "leaderboard_key": "restaurant/D/short", "dataset": "restaurant", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 188, "domain": "Sales", "n_cohorts": 13, "skipped_series": 1, "metrics": {"mase": 0.7032572725336931, "wql": 0.29388985640575416, "wsql_by_level": [0.14388509764644014, 0.2374718115070401, 0.3045734092783732, 0.35000386166169445, 0.37377117701051293, 0.37533248318597334, 0.3520210542915942, 0.3000197969740691, 0.20793001609608977], "n_valid_labels": 4908, "n_masked_labels": 732, "mae_median": 7.39111940554224, "n_mase_elements": 4879, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 1}, "relative": {"mase": 0.6372438611435927, "wql": 0.3962249469444833}}, {"config_id": "hierarchical_sales__D__short", "leaderboard_key": "hierarchical_sales/D/short", "dataset": "hierarchical_sales/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.7348890090260285, "wql": 0.5734915322577943, "wsql_by_level": [0.2123124849189796, 0.37864348610574, 0.5201218954642599, 0.6358867324597284, 0.7166157852320038, 0.7657184055714783, 0.7738833937793305, 0.6742189100170203, 0.4840226967716072], "n_valid_labels": 3422, "n_masked_labels": 118, "mae_median": 2.345021497085908, "n_mase_elements": 3422, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.637460473750277, "wql": 0.335251124750253}}, {"config_id": "hierarchical_sales__W__short", "leaderboard_key": "hierarchical_sales/W/short", "dataset": "hierarchical_sales/W", "term": "short", "freq": "W-WED", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.811843611649546, "wql": 0.428206896002995, "wsql_by_level": [0.14393482815309452, 0.2502359699546728, 0.33823247780256843, 0.41385793315226654, 0.47960619545690814, 0.5352625072635407, 0.5769880606821238, 0.5938267044023506, 0.5219173871594297], "n_valid_labels": 944, "n_masked_labels": 0, "mae_median": 13.82576631034835, "n_mase_elements": 944, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7478520895769962, "wql": 0.5458481728861894}}, {"config_id": "LOOP_SEATTLE__T__short", "leaderboard_key": "loop_seattle/5T/short", "dataset": "LOOP_SEATTLE/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5864394836519787, "wql": 0.05428408817899554, "wsql_by_level": [0.04479178098907267, 0.06000763809732082, 0.06637466849100017, 0.06788984760988573, 0.06605520506110114, 0.061294463229775095, 0.053358117703003374, 0.042244454810520214, 0.026540617619280685], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 3.9955498398695557, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8253045664949409, "wql": 0.7091877102191098}}, {"config_id": "LOOP_SEATTLE__T__medium", "leaderboard_key": "loop_seattle/5T/medium", "dataset": "LOOP_SEATTLE/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.74182900729652, "wql": 0.06788873443760415, "wsql_by_level": [0.05357422454078263, 0.07493314508780921, 0.08472113983743966, 0.08724279381143979, 0.08435672147263845, 0.07730137093578172, 0.06638934676629683, 0.051380998284025835, 0.03109886920222329], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 4.579496950264244, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.755158697865816, "wql": 0.6385961674510584}}, {"config_id": "LOOP_SEATTLE__T__long", "leaderboard_key": "loop_seattle/5T/long", "dataset": "LOOP_SEATTLE/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7465064067482573, "wql": 0.0718782304981459, "wsql_by_level": [0.05180627157965504, 0.07442746588233085, 0.08624474272042683, 0.09078284999619254, 0.08968703608200657, 0.08429582001894365, 0.07419009199650099, 0.058873657814727316, 0.03659613839252939], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 4.707955171464494, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7823282219272191, "wql": 0.6217114573451009}}, {"config_id": "LOOP_SEATTLE__H__short", "leaderboard_key": "loop_seattle/H/short", "dataset": "LOOP_SEATTLE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7790671230574661, "wql": 0.056192889416918024, "wsql_by_level": [0.04702487987186681, 0.0623758295313483, 0.06896356914078333, 0.07004562495761203, 0.06746910304840772, 0.06199981916614292, 0.05439636364683567, 0.04431985166795878, 0.029140963721306687], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 3.5669649561039276, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8684396521913409, "wql": 0.6895963495119618}}, {"config_id": "LOOP_SEATTLE__H__medium", "leaderboard_key": "loop_seattle/H/medium", "dataset": "LOOP_SEATTLE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7919756972825184, "wql": 0.056683030945589144, "wsql_by_level": [0.0497444993514591, 0.06313123056500668, 0.06854955380599254, 0.06947031458062264, 0.06742205770250141, 0.06256440075956698, 0.05523141115237446, 0.04481747578808889, 0.029216334804689603], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 3.7603892812712325, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6638118359610692, "wql": 0.37381839332646466}}, {"config_id": "LOOP_SEATTLE__H__long", "leaderboard_key": "loop_seattle/H/long", "dataset": "LOOP_SEATTLE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.738829739885067, "wql": 0.052308953536778224, "wsql_by_level": [0.039299238664245624, 0.05255967792580262, 0.05936548448019612, 0.062281229622256615, 0.06242582927152043, 0.06017755752451767, 0.055325450299709304, 0.04694625617869633, 0.032399857864059314], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 3.517151350220148, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6601483744160617, "wql": 0.30585123119424396}}, {"config_id": "LOOP_SEATTLE__D__short", "leaderboard_key": "loop_seattle/D/short", "dataset": "LOOP_SEATTLE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6562146459533866, "wql": 0.029987287094365996, "wsql_by_level": [0.018323798041140163, 0.02760173533914183, 0.03314279031738056, 0.03620883489365932, 0.037273057818275786, 0.036196217843546305, 0.03324895703842775, 0.028101569026567724, 0.019788623531154504], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 2.1110521952311196, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6250123240755511, "wql": 0.3491149302247672}}, {"config_id": "SZ_TAXI__T__short", "leaderboard_key": "sz_taxi/15T/short", "dataset": "SZ_TAXI/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.4626850814794651, "wql": 0.1808778853917687, "wsql_by_level": [0.09152374229134473, 0.14991132036443927, 0.19007622164072213, 0.2160504160188806, 0.2286942847375343, 0.22882632172005063, 0.2147448931457453, 0.18291428918473465, 0.12515947942246664], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 2.496985606481987, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7548541376291873, "wql": 0.6456545135962624}}, {"config_id": "SZ_TAXI__T__medium", "leaderboard_key": "sz_taxi/15T/medium", "dataset": "SZ_TAXI/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5008475574542578, "wql": 0.24294826960572802, "wsql_by_level": [0.1144784379080718, 0.18109881224225755, 0.22839716900666954, 0.2632517694336473, 0.28869728020287816, 0.30456811389744826, 0.3066071083453445, 0.28593691229547863, 0.21349882311975676], "n_valid_labels": 74880, "n_masked_labels": 0, "mae_median": 3.186576861898866, "n_mase_elements": 74880, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.843510613849713, "wql": 0.5671558774065893}}, {"config_id": "SZ_TAXI__T__long", "leaderboard_key": "sz_taxi/15T/long", "dataset": "SZ_TAXI/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 1.2714380607200964, "wql": 0.5053214252545055, "wsql_by_level": [0.3837884898338214, 0.5145672121895367, 0.5878809607458092, 0.6205584479386093, 0.619577141276385, 0.5883309106434682, 0.5283571131532746, 0.4297701066185521, 0.27506244489109344], "n_valid_labels": 112320, "n_masked_labels": 0, "mae_median": 7.75467368370671, "n_mase_elements": 112320, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8566686903348999, "wql": 0.7853460499598182}}, {"config_id": "SZ_TAXI__H__short", "leaderboard_key": "sz_taxi/H/short", "dataset": "SZ_TAXI/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.47345451712987424, "wql": 0.13107144630496928, "wsql_by_level": [0.07168371404348971, 0.11062127195213284, 0.13574895353242047, 0.15137690630330758, 0.15985518210004876, 0.15975554696182498, 0.15159900283284908, 0.13529366643313054, 0.10370877258551961], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 1.7788976422031202, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8187380577833887, "wql": 0.6338111871439569}}, {"config_id": "M_DENSE__H__short", "leaderboard_key": "m_dense/H/short", "dataset": "M_DENSE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6673477339598097, "wql": 0.13381121739461577, "wsql_by_level": [0.07646318303094778, 0.11560903093371483, 0.14019385353585342, 0.15541976040070474, 0.16345965850577704, 0.16431241336887312, 0.1564272476816878, 0.13593208290942133, 0.09648372618456158], "n_valid_labels": 1440, "n_masked_labels": 0, "mae_median": 91.79810526702138, "n_mase_elements": 1440, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.48186482983036266, "wql": 0.5419359172124095}}, {"config_id": "M_DENSE__H__medium", "leaderboard_key": "m_dense/H/medium", "dataset": "M_DENSE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 1.1023516251122774, "wql": 0.22740508980268567, "wsql_by_level": [0.10112015585497222, 0.16695728722522082, 0.2175547342833934, 0.25686230897469, 0.28505085746368725, 0.2978260076547916, 0.29139076819452586, 0.2557078083184608, 0.1741758802544288], "n_valid_labels": 14400, "n_masked_labels": 0, "mae_median": 150.24812372797066, "n_mase_elements": 14400, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9159202242343034, "wql": 0.619367971150801}}, {"config_id": "M_DENSE__H__long", "leaderboard_key": "m_dense/H/long", "dataset": "M_DENSE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.877295611800436, "wql": 0.23923573976712356, "wsql_by_level": [0.13525328549690072, 0.21459976076575216, 0.26852823138537474, 0.2991725933161364, 0.30700966487585296, 0.2939798674862894, 0.26147771508661855, 0.21698062485528127, 0.15611991463590622], "n_valid_labels": 21600, "n_masked_labels": 0, "mae_median": 131.68062999712097, "n_mase_elements": 21600, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7276824551361437, "wql": 0.4362160022315357}}, {"config_id": "M_DENSE__D__short", "leaderboard_key": "m_dense/D/short", "dataset": "M_DENSE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.8196729786938285, "wql": 0.11209314497244116, "wsql_by_level": [0.0807601741683664, 0.11281415574834637, 0.12866431854257337, 0.13424117321141613, 0.13110805376462456, 0.12534945960064903, 0.11722106015594659, 0.10267272744110614, 0.07600718211894188], "n_valid_labels": 900, "n_masked_labels": 0, "mae_median": 56.234031346639, "n_mase_elements": 900, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6243486437915622, "wql": 0.37453130535027723}}, {"config_id": "ett1__T__short", "leaderboard_key": "ett1/15T/short", "dataset": "ett1/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.5708853042944508, "wql": 0.2463715128723785, "wsql_by_level": [0.16400218592871096, 0.2209048333404705, 0.25009514187287185, 0.28636883518720563, 0.30217447690601895, 0.3066069876564013, 0.28578592381915535, 0.23769464717162778, 0.1637105839689438], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 0.82533742073879, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6103915361813244, "wql": 0.47356494274680283}}, {"config_id": "ett1__T__medium", "leaderboard_key": "ett1/15T/medium", "dataset": "ett1/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9656647615391196, "wql": 0.3351660915837733, "wsql_by_level": [0.2219368106918946, 0.3472761207016973, 0.41775119517537523, 0.4446392771767811, 0.43434917469794937, 0.4033060833000697, 0.3397643262596162, 0.2539064451094817, 0.1535653911410951], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 1.6562388141462137, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9821210166045352, "wql": 0.7574072980094135}}, {"config_id": "ett1__T__long", "leaderboard_key": "ett1/15T/long", "dataset": "ett1/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9981941011380466, "wql": 0.3341812007426018, "wsql_by_level": [0.17604461969397395, 0.30606202331419974, 0.39350708727911426, 0.44093391078866023, 0.4533487609029168, 0.43228551872328214, 0.37722060649662625, 0.2807368069639273, 0.14749147252071573], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 1.78651595814634, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9510582227463917, "wql": 0.716810411846765}}, {"config_id": "ett1__H__short", "leaderboard_key": "ett1/H/short", "dataset": "ett1/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0872611679136062, "wql": 0.34736108490237666, "wsql_by_level": [0.1514118953058142, 0.32051725290272637, 0.42456589444848597, 0.46715596044238133, 0.46963146146470147, 0.4384089289055736, 0.37952209792833436, 0.2978647374627226, 0.17717153526065016], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 6.745783526073431, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1773105697244175, "wql": 0.905695260450443}}, {"config_id": "ett1__H__medium", "leaderboard_key": "ett1/H/medium", "dataset": "ett1/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2143995688190363, "wql": 0.2937695158276702, "wsql_by_level": [0.16182556979140045, 0.2566703247646637, 0.3179489848185056, 0.3541190232345261, 0.3704390450363359, 0.3672515650523988, 0.34074828752681774, 0.2844462990740073, 0.19047654315037613], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 7.120665203544887, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8713861852411183, "wql": 0.6837159505652904}}, {"config_id": "ett1__H__long", "leaderboard_key": "ett1/H/long", "dataset": "ett1/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.108403107049459, "wql": 0.26932565727244423, "wsql_by_level": [0.18580205173921305, 0.2691977943702413, 0.31432952759334043, 0.3357948938746346, 0.3368756881855405, 0.32147375815247675, 0.28621902161368934, 0.22914730127554972, 0.1450908786473119], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 6.310423026872533, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7644035739323134, "wql": 0.5072743027547193}}, {"config_id": "ett1__D__short", "leaderboard_key": "ett1/D/short", "dataset": "ett1/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.3338834402028559, "wql": 0.2206528626585563, "wsql_by_level": [0.15649360362438544, 0.2303063783024349, 0.2682668707833516, 0.28042882156590027, 0.2818932849855062, 0.2623312262814881, 0.222607064312146, 0.16755314667045879, 0.11599536740133552], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 115.04867627677463, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6945867018524801, "wql": 0.5679786095136372}}, {"config_id": "ett1__W__short", "leaderboard_key": "ett1/W/short", "dataset": "ett1/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.7872141092783826, "wql": 0.350722739439398, "wsql_by_level": [0.25740515084491233, 0.36722578222770363, 0.4341312748791001, 0.4698497916628444, 0.47558501620376037, 0.43992886363316525, 0.3682594082264771, 0.2352245408730326, 0.10889482640358612], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 1206.4078138896398, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1878188416566207, "wql": 0.9823258018145309}}, {"config_id": "ett2__T__short", "leaderboard_key": "ett2/15T/short", "dataset": "ett2/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7334312991377362, "wql": 0.09034943889243417, "wsql_by_level": [0.04996557085755058, 0.08156682729735686, 0.100392275643997, 0.11005223439949974, 0.11454438833014206, 0.11198991891836993, 0.10268340572706176, 0.08531853826517385, 0.056631790592755686], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 1.6327879840419406, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9502422871919158, "wql": 0.8986485212055849}}, {"config_id": "ett2__T__medium", "leaderboard_key": "ett2/15T/medium", "dataset": "ett2/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9688128767833858, "wql": 0.11409979342549387, "wsql_by_level": [0.07361681477023599, 0.11133464695296702, 0.13270487095982894, 0.1440311981626583, 0.14805075627645434, 0.14162851828917508, 0.12419906598251608, 0.09503742561681594, 0.05629484381879317], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 2.1427634680022796, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.04290069549812, "wql": 0.7905715012820052}}, {"config_id": "ett2__T__long", "leaderboard_key": "ett2/15T/long", "dataset": "ett2/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1814935595212168, "wql": 0.1518794297450886, "wsql_by_level": [0.08573930208102536, 0.1256910603887048, 0.15486537904412703, 0.17940530803092924, 0.19544675389931845, 0.19590265286986644, 0.18027881898760942, 0.1487984125519407, 0.10078717985227596], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 2.6614835896640128, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0221257530089185, "wql": 0.8109950843353438}}, {"config_id": "ett2__H__short", "leaderboard_key": "ett2/H/short", "dataset": "ett2/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9103654412061127, "wql": 0.1138812898763956, "wsql_by_level": [0.060818171359859466, 0.10352711408995882, 0.1280990270501541, 0.14037094991506227, 0.14472871297163692, 0.14151891524938315, 0.130715044030325, 0.10698919780618057, 0.06816447641500023], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 8.656774342060089, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0134098694730314, "wql": 0.9397892290630341}}, {"config_id": "ett2__H__medium", "leaderboard_key": "ett2/H/medium", "dataset": "ett2/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.8694182427593795, "wql": 0.25023382477764383, "wsql_by_level": [0.220076891420819, 0.28039882522030457, 0.30656915583097655, 0.31040645068461287, 0.29721700118072714, 0.27393192051510545, 0.24077174371249124, 0.19556643453938347, 0.12716599989437424], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 16.37365030462942, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8224600750099719, "wql": 0.7992166251430929}}, {"config_id": "ett2__H__long", "leaderboard_key": "ett2/H/long", "dataset": "ett2/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 2.23374691186863, "wql": 0.19834196458622855, "wsql_by_level": [0.10201105137789299, 0.16346227198220944, 0.20400863175825276, 0.2298445545815791, 0.2453488648604956, 0.248015414715013, 0.2371621949432866, 0.20775795738618005, 0.14746673967114723], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 14.948326876998342, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9277932661452751, "wql": 0.6905087978434369}}, {"config_id": "ett2__D__short", "leaderboard_key": "ett2/D/short", "dataset": "ett2/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 3.404406995021055, "wql": 0.1918257823859732, "wsql_by_level": [0.10945473409087089, 0.16743746408255653, 0.20527960686654992, 0.2285801873993269, 0.23887596568471434, 0.2355004008313435, 0.22034273377818359, 0.1887640988490374, 0.13219684989117594], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 348.4026689252683, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.987838692674619, "wql": 0.873445782463934}}, {"config_id": "ett2__W__short", "leaderboard_key": "ett2/W/short", "dataset": "ett2/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9115859642912271, "wql": 0.1204472615024173, "wsql_by_level": [0.08616865338245543, 0.11273013021246696, 0.11918473584177104, 0.12394733728017499, 0.13595853548360168, 0.1461198671533806, 0.1436604493547486, 0.12448990089370228, 0.09176574391945433], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 1376.942128249577, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9785192706599976, "wql": 0.6793186610726261}}, {"config_id": "jena_weather__T__short", "leaderboard_key": "jena_weather/10T/short", "dataset": "jena_weather/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.6567776950876182, "wql": 0.10390181982960771, "wsql_by_level": [0.032702103921265824, 0.051871420161722005, 0.08150691540344444, 0.1085879172513168, 0.1283605940657619, 0.14296673640107685, 0.14603120266302402, 0.1352920872213466, 0.10779740137751087], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 23.64989696035073, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0386262245009232, "wql": 0.7307616392787628}}, {"config_id": "jena_weather__T__medium", "leaderboard_key": "jena_weather/10T/medium", "dataset": "jena_weather/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.8367471886797653, "wql": 0.07105917062773195, "wsql_by_level": [0.03440606641296538, 0.05942451747618064, 0.07495589803699289, 0.08474438180798205, 0.08929319800113891, 0.08794267549414034, 0.08171248813648332, 0.07016853398959526, 0.056884776294108874], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 15.519449593482488, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8940784095923496, "wql": 0.3328005013577497}}, {"config_id": "jena_weather__T__long", "leaderboard_key": "jena_weather/10T/long", "dataset": "jena_weather/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.6355318728376552, "wql": 0.06488234596988064, "wsql_by_level": [0.03484147055585464, 0.057717572158342695, 0.07169477064502051, 0.08002494830477477, 0.08232802171025812, 0.07914022773691949, 0.07143942419855309, 0.059993541794748216, 0.04676113662445417], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 14.16328993834735, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6594381615983075, "wql": 0.2739286586856853}}, {"config_id": "jena_weather__H__short", "leaderboard_key": "jena_weather/H/short", "dataset": "jena_weather/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.7566441877218407, "wql": 0.08283165018375324, "wsql_by_level": [0.030581945405944517, 0.05137454871395742, 0.07062253019359829, 0.08460918614431572, 0.09420930226255605, 0.10199047834610948, 0.1089697787648516, 0.11031500836157337, 0.0928120734608727], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 16.5090222686191, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8336503105845321, "wql": 0.4801528639999464}}, {"config_id": "jena_weather__H__medium", "leaderboard_key": "jena_weather/H/medium", "dataset": "jena_weather/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.099199699911339, "wql": 0.11812050772931568, "wsql_by_level": [0.11657790757847461, 0.13855340831394772, 0.14632593379857026, 0.14388637692896508, 0.13452738848123366, 0.1231768233627765, 0.10804714815512985, 0.08870020748898999, 0.06328937545575362], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 24.37716235135583, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7300963316874448, "wql": 0.33088668826658996}}, {"config_id": "jena_weather__H__long", "leaderboard_key": "jena_weather/H/long", "dataset": "jena_weather/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.0287052164817878, "wql": 0.08571698754034823, "wsql_by_level": [0.05112869529819806, 0.07881822275377764, 0.09521211722243107, 0.1028508759819873, 0.10438748307772369, 0.10052790069166972, 0.09273136046856695, 0.08167146928105229, 0.06412476308772742], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 20.256139428320107, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.023473634676717, "wql": 0.2175284728920603}}, {"config_id": "jena_weather__D__short", "leaderboard_key": "jena_weather/D/short", "dataset": "jena_weather/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.2260421303547482, "wql": 0.07062996890613342, "wsql_by_level": [0.037566261048266984, 0.06001960183833484, 0.07579125133427225, 0.08643661282874487, 0.09088247242255622, 0.0878164474304829, 0.08223889554683157, 0.06890530160982503, 0.04601287609588614], "n_valid_labels": 630, "n_masked_labels": 0, "mae_median": 17.63552465090798, "n_mase_elements": 630, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0409201289037093, "wql": 0.36279590867078565}}, {"config_id": "bitbrains_fast_storage__T__short", "leaderboard_key": "bitbrains_fast_storage/5T/short", "dataset": "bitbrains_fast_storage/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 189, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5495690409618929, "wql": 0.4640114691068969, "wsql_by_level": [0.2735727210349164, 0.41126061433918715, 0.4773614782159531, 0.5097300459438864, 0.5302770091595749, 0.5516661797740225, 0.5459540768906436, 0.4995231463148054, 0.37675795028908265], "n_valid_labels": 18124, "n_masked_labels": 20, "mae_median": 164.91747839772205, "n_mase_elements": 17454, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 2}, "relative": {"mase": 0.5592570882200334, "wql": 0.23452315349567934}}, {"config_id": "bitbrains_fast_storage__T__medium", "leaderboard_key": "bitbrains_fast_storage/5T/medium", "dataset": "bitbrains_fast_storage/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 184, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.8537420640137354, "wql": 0.3475119141408658, "wsql_by_level": [0.14851780246237994, 0.2619325858301886, 0.3562623489519422, 0.4308924916002662, 0.48124148139269113, 0.49618091496030575, 0.4684975993344411, 0.3563007186937533, 0.12778128404182415], "n_valid_labels": 175364, "n_masked_labels": 1276, "mae_median": 375.3476695428092, "n_mase_elements": 173750, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 4}, "relative": {"mase": 0.802478242122517, "wql": 0.5530322889608165}}, {"config_id": "bitbrains_fast_storage__T__long", "leaderboard_key": "bitbrains_fast_storage/5T/long", "dataset": "bitbrains_fast_storage/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 182, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7621650331510523, "wql": 0.5470072015588816, "wsql_by_level": [0.2968334547515154, 0.47999623085957555, 0.5998344678722822, 0.6776370093847325, 0.7144447053365166, 0.7064816013600345, 0.6484886354250166, 0.5162975409801511, 0.2830511680601104], "n_valid_labels": 262080, "n_masked_labels": 0, "mae_median": 425.5427895169757, "n_mase_elements": 254880, "n_seasonal_error_zero": 10, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8682223785356328, "wql": 0.7114087638496536}}, {"config_id": "bitbrains_fast_storage__H__short", "leaderboard_key": "bitbrains_fast_storage/H/short", "dataset": "bitbrains_fast_storage/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 188, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.8782510282113798, "wql": 0.6249780145611263, "wsql_by_level": [0.3414958373352421, 0.6040678304015741, 0.7731398110158448, 0.8418376720783018, 0.8374039796915037, 0.7631582332493825, 0.644374016270727, 0.49883149361525647, 0.32049325739230455], "n_valid_labels": 18042, "n_masked_labels": 6, "mae_median": 491.7578944897342, "n_mase_elements": 17466, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8937180939836543, "wql": 0.878934753600448}}, {"config_id": "bitbrains_rnd__T__short", "leaderboard_key": "bitbrains_rnd/5T/short", "dataset": "bitbrains_rnd/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 186, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.9855778026707239, "wql": 0.7002636946401669, "wsql_by_level": [0.15854831614964782, 0.3073962918894868, 0.4502861740964458, 0.5910852639913861, 0.7274652658554417, 0.8632444042222703, 0.9908741198357276, 1.103960010980373, 1.1095134047407234], "n_valid_labels": 17856, "n_masked_labels": 0, "mae_median": 262.20216032318325, "n_mase_elements": 17376, "n_seasonal_error_zero": 10, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8265802855038655, "wql": 0.5333497188237823}}, {"config_id": "bitbrains_rnd__T__medium", "leaderboard_key": "bitbrains_rnd/5T/medium", "dataset": "bitbrains_rnd/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 190, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.1074614495310078, "wql": 0.4739412828125972, "wsql_by_level": [0.13849494472882778, 0.2729460200568033, 0.3875664515868339, 0.48722993987297364, 0.5719146863149911, 0.6424389237087188, 0.6892778516686807, 0.6756300539499801, 0.39997267342556553], "n_valid_labels": 181300, "n_masked_labels": 1100, "mae_median": 165.4849557380094, "n_mase_elements": 177590, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 8}, "relative": {"mase": 0.8509824401976337, "wql": 0.5825912354590667}}, {"config_id": "bitbrains_rnd__T__long", "leaderboard_key": "bitbrains_rnd/5T/long", "dataset": "bitbrains_rnd/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 183, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7321179294190999, "wql": 0.7556704428037802, "wsql_by_level": [0.43086307309383404, 0.7640450817796286, 0.895850551794913, 0.9424746594341056, 0.9326704461007479, 0.8834700216740905, 0.7873138681072934, 0.6612523873598382, 0.5030938958895704], "n_valid_labels": 261076, "n_masked_labels": 2444, "mae_median": 173.10021903609947, "n_mase_elements": 257668, "n_seasonal_error_zero": 4, "n_seasonal_error_nan": 4}, "relative": {"mase": 0.9271972181904886, "wql": 0.4452092664511326}}, {"config_id": "bitbrains_rnd__H__short", "leaderboard_key": "bitbrains_rnd/H/short", "dataset": "bitbrains_rnd/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 187, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.111504471519387, "wql": 0.4003264076306634, "wsql_by_level": [0.14237119303408338, 0.25782396189694645, 0.3626456361992451, 0.43885336274804965, 0.48894998551374863, 0.5224329418408078, 0.5128626702070823, 0.49009149966704707, 0.38690641756895994], "n_valid_labels": 17622, "n_masked_labels": 330, "mae_median": 149.52690210467262, "n_mase_elements": 16992, "n_seasonal_error_zero": 6, "n_seasonal_error_nan": 14}, "relative": {"mase": 0.8684486324844234, "wql": 0.481850025263346}}, {"config_id": "bizitobs_application__S__short", "leaderboard_key": "bizitobs_application/10S/short", "dataset": "bizitobs_application", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7019078777385723, "wql": 0.007163020842642658, "wsql_by_level": [0.0048323953217077175, 0.007428689548045082, 0.00880632022869619, 0.00922815800829287, 0.009240588644501887, 0.008852255472677557, 0.007735533214100556, 0.005460030581390467, 0.002883216564371579], "n_valid_labels": 120, "n_masked_labels": 0, "mae_median": 237.88245471318564, "n_mase_elements": 120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9708410885426743, "wql": 0.6045244118723399}}, {"config_id": "bizitobs_application__S__medium", "leaderboard_key": "bizitobs_application/10S/medium", "dataset": "bizitobs_application", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6817085244875766, "wql": 0.00908305176245739, "wsql_by_level": [0.0062095942843725885, 0.008970014505947982, 0.01051934205054723, 0.011257378777146233, 0.011346542971008068, 0.010808225766877181, 0.009729047591349151, 0.007907085317193958, 0.005000234597674131], "n_valid_labels": 1200, "n_masked_labels": 0, "mae_median": 278.2595032596588, "n_mase_elements": 1200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8879461934578673, "wql": 0.7616154085572984}}, {"config_id": "bizitobs_application__S__long", "leaderboard_key": "bizitobs_application/10S/long", "dataset": "bizitobs_application", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.47039677164969534, "wql": 0.0069275774196375945, "wsql_by_level": [0.004539485797206928, 0.006361344864985718, 0.007201870509530482, 0.007636722525801759, 0.008063931285277545, 0.008292973433903702, 0.008112719388224904, 0.007130441459236186, 0.005008707512571115], "n_valid_labels": 1800, "n_masked_labels": 0, "mae_median": 192.6971052148607, "n_mase_elements": 1800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8535136868258836, "wql": 0.5544770786481568}}, {"config_id": "bizitobs_service__S__short", "leaderboard_key": "bizitobs_service/10S/short", "dataset": "bizitobs_service", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.4949962544597988, "wql": 0.006549953409254277, "wsql_by_level": [0.004442757460789555, 0.006606321187581675, 0.007784137504677365, 0.008214760553852686, 0.008319303075487582, 0.00793713373963574, 0.007023749197421014, 0.005407263156896729, 0.003214154806946143], "n_valid_labels": 2520, "n_masked_labels": 0, "mae_median": 11.094890022940106, "n_mase_elements": 2520, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6821867814552184, "wql": 0.35568480632273597}}, {"config_id": "bizitobs_service__S__medium", "leaderboard_key": "bizitobs_service/10S/medium", "dataset": "bizitobs_service", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7127825594019868, "wql": 0.01067594117051045, "wsql_by_level": [0.007043672747066382, 0.010247076607099828, 0.01214680903015517, 0.013113579326992524, 0.013293415891855499, 0.012830367828236839, 0.01160501471039321, 0.009510649916310737, 0.006292884476483866], "n_valid_labels": 25200, "n_masked_labels": 0, "mae_median": 17.058138304800977, "n_mase_elements": 25200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.884530481811879, "wql": 0.48693155408691524}}, {"config_id": "bizitobs_service__S__long", "leaderboard_key": "bizitobs_service/10S/long", "dataset": "bizitobs_service", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5855097987971744, "wql": 0.008541787992337763, "wsql_by_level": [0.005347169484117975, 0.00742687531847613, 0.008760381786199532, 0.009707581076710757, 0.010341851103091921, 0.010532398012756468, 0.010036556837851937, 0.00865577178193952, 0.006067506529895632], "n_valid_labels": 37800, "n_masked_labels": 0, "mae_median": 13.017232756930053, "n_mase_elements": 37800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8298664374836866, "wql": 0.36298022285353765}}, {"config_id": "bizitobs_l2c__T__short", "leaderboard_key": "bizitobs_l2c/5T/short", "dataset": "bizitobs_l2c/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.22382198847707513, "wql": 0.08186275444872211, "wsql_by_level": [0.037408019609334854, 0.0587024836969484, 0.07274663658623153, 0.08546096903659495, 0.09553181181020633, 0.1023533552907774, 0.10414736405542024, 0.09814263389813305, 0.0822715160548523], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 2.464862904378346, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3141628202629681, "wql": 0.40902169334995897}}, {"config_id": "bizitobs_l2c__T__medium", "leaderboard_key": "bizitobs_l2c/5T/medium", "dataset": "bizitobs_l2c/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.4407966027857633, "wql": 0.520422498817802, "wsql_by_level": [0.22978402310712473, 0.36165335731056003, 0.46592120999148956, 0.5478746493831328, 0.6186311495874676, 0.6448182830937803, 0.6550486809870452, 0.6207646219800333, 0.5393065139195853], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 4.267838733288504, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4960515060225297, "wql": 0.41974068372145845}}, {"config_id": "bizitobs_l2c__T__long", "leaderboard_key": "bizitobs_l2c/5T/long", "dataset": "bizitobs_l2c/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.3944093443876808, "wql": 0.670821020204813, "wsql_by_level": [0.20348635948821533, 0.4055405210610619, 0.5543135992200804, 0.673438203664718, 0.7792245439047436, 0.8435686573300065, 0.8817232379021219, 0.879307778029058, 0.8167862812433121], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 3.6977173183408993, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.2558446503954267, "wql": 0.276780534576553}}, {"config_id": "bizitobs_l2c__H__short", "leaderboard_key": "bizitobs_l2c/H/short", "dataset": "bizitobs_l2c/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.40004485130097434, "wql": 0.9345752346818303, "wsql_by_level": [0.9007532928297839, 0.9956025797043763, 0.9990633699137654, 1.0538246849540982, 1.051375534094755, 1.0057298018953584, 0.930539836300793, 0.8177558526503745, 0.6565321597931688], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 3.639788052355427, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5082574591296873, "wql": 0.4082143613285467}}, {"config_id": "bizitobs_l2c__H__medium", "leaderboard_key": "bizitobs_l2c/H/medium", "dataset": "bizitobs_l2c/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5221058974261685, "wql": 0.27240897937295977, "wsql_by_level": [0.13013451384900276, 0.22117940454590101, 0.2751250741357467, 0.3115947965021312, 0.3368170295202441, 0.3416225788178767, 0.3309159542200145, 0.29263050398847507, 0.2116609587772456], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 4.964060758289304, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.37993860849764666, "wql": 0.3088321968073675}}, {"config_id": "bizitobs_l2c__H__long", "leaderboard_key": "bizitobs_l2c/H/long", "dataset": "bizitobs_l2c/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5968389877417738, "wql": 0.3011822329583366, "wsql_by_level": [0.14526495877212975, 0.25054966257046185, 0.31308607361678453, 0.34185030922902476, 0.3954609389648448, 0.396417300782174, 0.3591385200219045, 0.2966344116703586, 0.21223792099734698], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 5.701087109615938, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4490006084453436, "wql": 0.28811590287425715}}], "cpu_seconds": 1.1467377638909966, "members": ["/workspace/research/backcast_evals/weekly_slow_ar_delta3k", "/workspace/research/backcast_evals/patch8_ema6000", "/workspace/research/backcast_evals/split_patch_ema12000"], "member_checkpoint_hashes": ["094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "weights": [0.3333333333333333, 0.3333333333333333, 0.3333333333333333], "selection_only": true, "cutoff": "valid_backcast", "E102skill": 0.3397943577904946, "difference": 0.0004326583880599477} +{"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.36494952219954613, "rel_mase_gmean": 0.7652921044693154, "rel_wql_gmean": 0.5269740887164148, "groups": {"term": {"short": 0.35231864866246176, "medium": 0.39298299792182056, "long": 0.3687947028461305}, "domain": {"Econ/Fin": 0.12172660354585485, "Energy": 0.24152286056809502, "Healthcare": 0.3524592910484051, "Nature": 0.4788459673908466, "Sales": 0.5562200646344707, "Transport": 0.42520099368193554, "Web/CloudOps": 0.4370802681174131}, "freq": {"A-DEC": 0.3367893179024516, "Q-DEC": 0.15679817162375864, "M": 0.16573415798569047, "W-SUN": 0.06797376532770616, "D": 0.43063552907975755, "H": 0.3947520428143986, "15T": 0.10816823329454162, "W-FRI": 0.15582466897824498, "10T": 0.5091318264307638, "W-TUE": 0.09072022101156729, "W-THU": 0.35383995123098644, "W-WED": 0.563658397919643, "5T": 0.47248290588277875, "10S": 0.28530046798638997}}, "configs": [{"config_id": "m4_yearly__A__short", "leaderboard_key": "m4_yearly/A/short", "dataset": "m4_yearly", "term": "short", "freq": "A-DEC", "prediction_length": 6, "seasonality": 1, "n_variates": 1, "n_instances": 117, "domain": "Econ/Fin", "n_cohorts": 3, "skipped_series": 235, "dropped_containers": 11, "metrics": {"mase": 2.9310956808598876, "wql": 0.1120823955071256, "wsql_by_level": [0.05644202792579237, 0.0905053717375648, 0.11408590505170658, 0.12930253744442674, 0.13960575186697724, 0.1391001159288124, 0.13444935326991628, 0.11877412643252444, 0.08647636990640943], "n_valid_labels": 702, "n_masked_labels": 0, "mae_median": 497.2042572803986, "n_mase_elements": 702, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5810671768613991, "wql": 0.7569665373702766}}, {"config_id": "m4_quarterly__Q__short", "leaderboard_key": "m4_quarterly/Q/short", "dataset": "m4_quarterly", "term": "short", "freq": "Q-DEC", "prediction_length": 8, "seasonality": 4, "n_variates": 1, "n_instances": 187, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 95, "metrics": {"mase": 1.6478859979869742, "wql": 0.10829988142949554, "wsql_by_level": [0.056003642707730145, 0.08983228427039322, 0.11123343407784438, 0.12480187246088971, 0.1322823443816346, 0.13234772923365642, 0.12698538731234796, 0.11318215410203093, 0.0880300843189324], "n_valid_labels": 1496, "n_masked_labels": 0, "mae_median": 658.2217914356905, "n_mase_elements": 1496, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8236951165880326, "wql": 0.8631704972613484}}, {"config_id": "m4_monthly__M__short", "leaderboard_key": "m4_monthly/M/short", "dataset": "m4_monthly", "term": "short", "freq": "M", "prediction_length": 18, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 499, "metrics": {"mase": 1.2065657349170607, "wql": 0.11616278210500203, "wsql_by_level": [0.06629914650161015, 0.10673308107406702, 0.1299410869238568, 0.1420671300945937, 0.146201258287822, 0.14056828824772014, 0.12820119810683464, 0.10795273317008502, 0.07750111653842881], "n_valid_labels": 3456, "n_masked_labels": 0, "mae_median": 685.2708041403029, "n_mase_elements": 3438, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 1}, "relative": {"mase": 0.8023830743189523, "wql": 0.8362369063369826}}, {"config_id": "m4_weekly__W__short", "leaderboard_key": "m4_weekly/W/short", "dataset": "m4_weekly", "term": "short", "freq": "W-SUN", "prediction_length": 13, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 4, "metrics": {"mase": 3.4120286945915503, "wql": 0.06543789387564042, "wsql_by_level": [0.03568810513079098, 0.05573298663766547, 0.06941860827544521, 0.07742239160518294, 0.08155154894880773, 0.0820178043222598, 0.07725284580870735, 0.06601944523015421, 0.0438373089217501], "n_valid_labels": 2496, "n_masked_labels": 0, "mae_median": 421.99554291443945, "n_mase_elements": 2496, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.055884538770714, "wql": 0.8226968671486973}}, {"config_id": "m4_daily__D__short", "leaderboard_key": "m4_daily/D/short", "dataset": "m4_daily", "term": "short", "freq": "D", "prediction_length": 14, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 23, "metrics": {"mase": 3.198081444911027, "wql": 0.017990809522792868, "wsql_by_level": [0.011334370410659413, 0.01708152964339461, 0.020489328746587362, 0.02218487101773786, 0.022524596765804428, 0.02176468750400583, 0.01964995836602746, 0.01603944649549975, 0.010848496755419105], "n_valid_labels": 2688, "n_masked_labels": 0, "mae_median": 160.98624503044854, "n_mase_elements": 2688, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.104570424679131, "wql": 1.1209370715015687}}, {"config_id": "m4_hourly__H__short", "leaderboard_key": "m4_hourly/H/short", "dataset": "m4_hourly", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 1, "metrics": {"mase": 1.2051508031734401, "wql": 0.035455791086468784, "wsql_by_level": [0.022635859061656737, 0.031868857116692025, 0.03783818151612068, 0.042129871543003294, 0.044377254084510626, 0.043981818274749666, 0.04074230287417112, 0.03367133925465812, 0.021856636052656822], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 324.76857741891257, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9686625638484314, "wql": 0.9635541079372303}}, {"config_id": "electricity__T__short", "leaderboard_key": "electricity/15T/short", "dataset": "electricity/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.061137228646092, "wql": 0.04591758165497868, "wsql_by_level": [0.026081163297573977, 0.040577145372865414, 0.04973832461946903, 0.05510200546983552, 0.057696196719431804, 0.057247755878974904, 0.05347010788765257, 0.044527117196815375, 0.028818418452189545], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 31.861565152073226, "n_mase_elements": 9168, "n_seasonal_error_zero": 1, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9505070462344758, "wql": 0.9362673863304282}}, {"config_id": "electricity__T__medium", "leaderboard_key": "electricity/15T/medium", "dataset": "electricity/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7747484929662815, "wql": 0.05309715861514194, "wsql_by_level": [0.030180252210181283, 0.04596581504333987, 0.05636227583964971, 0.06297520734873935, 0.06639451806383717, 0.06627160807306913, 0.06197078540317996, 0.05236928965253693, 0.035384675901744045], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 37.07979084028054, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7208015867064266, "wql": 0.6017494925974258}}, {"config_id": "electricity__T__long", "leaderboard_key": "electricity/15T/long", "dataset": "electricity/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9631048407873014, "wql": 0.06530777451639308, "wsql_by_level": [0.03868243596033826, 0.05779712956476083, 0.07041444297527456, 0.07805245423605922, 0.08156683542619748, 0.0810059250720502, 0.07510093629409416, 0.06302772507444722, 0.04212208604431579], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 54.271278551763494, "n_mase_elements": 137520, "n_seasonal_error_zero": 1, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8373763327252927, "wql": 0.682692595415901}}, {"config_id": "electricity__H__short", "leaderboard_key": "electricity/H/short", "dataset": "electricity/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1860486086671909, "wql": 0.12013049348037932, "wsql_by_level": [0.096727096738415, 0.13408846786092338, 0.150329087482554, 0.15458854056498766, 0.14894639634645762, 0.13563981815790846, 0.11593386248863469, 0.08978187340561354, 0.05513929827791953], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 491.3261660417807, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9624248739757734, "wql": 1.2265362305458265}}, {"config_id": "electricity__H__medium", "leaderboard_key": "electricity/H/medium", "dataset": "electricity/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 191, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0450184810481011, "wql": 0.06694406280534905, "wsql_by_level": [0.04150106060160619, 0.06102083502791941, 0.07311294372802071, 0.07970163345112803, 0.08197371341192622, 0.08039645950436046, 0.07485210114064052, 0.06415357520889897, 0.04578424317364093], "n_valid_labels": 91680, "n_masked_labels": 0, "mae_median": 130.55320361785553, "n_mase_elements": 91680, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8449165096305236, "wql": 0.5871682426273181}}, {"config_id": "electricity__H__long", "leaderboard_key": "electricity/H/long", "dataset": "electricity/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9998993403902402, "wql": 0.06818011784879856, "wsql_by_level": [0.03836064953172228, 0.05651673040533495, 0.06909567595139311, 0.07748233882709064, 0.0822167438527255, 0.08330189576376698, 0.08018491768541545, 0.07164780265095338, 0.05481430597078458], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 156.94477863154995, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8216033574470202, "wql": 0.47852007257023116}}, {"config_id": "electricity__D__short", "leaderboard_key": "electricity/D/short", "dataset": "electricity/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1131579576678026, "wql": 0.04849914537664307, "wsql_by_level": [0.028828026115528017, 0.04565428828905595, 0.05588957267330372, 0.06014304029525304, 0.06103558996707249, 0.05887061087185514, 0.053607789451018385, 0.043479301282370944, 0.028984089444329876], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 3925.439582457104, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7985622713150854, "wql": 0.556481621909801}}, {"config_id": "electricity__W__short", "leaderboard_key": "electricity/W/short", "dataset": "electricity/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 191, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0793149662245882, "wql": 0.04086397317219995, "wsql_by_level": [0.022948895531247317, 0.03184474849617729, 0.037373845841537426, 0.04288584810894898, 0.0465127528640773, 0.0479516852887964, 0.049952008912604984, 0.04849472174460474, 0.039811251761805055], "n_valid_labels": 1511, "n_masked_labels": 17, "mae_median": 19573.32892012328, "n_mase_elements": 1488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 5}, "relative": {"mase": 0.8656625303046482, "wql": 0.6713736379674927}}, {"config_id": "solar__T__short", "leaderboard_key": "solar/10T/short", "dataset": "solar/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.19084156010689463, "wql": 0.4343575072579486, "wsql_by_level": [0.20779253832517464, 0.3849556409106096, 0.48689698493658684, 0.5496040418311166, 0.5736991639310752, 0.5627726299759063, 0.5065792133568167, 0.3869834899753305, 0.24993386207892077], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 0.43314461463919574, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.772953237778248, "wql": 0.2251192058640265}}, {"config_id": "solar__T__medium", "leaderboard_key": "solar/10T/medium", "dataset": "solar/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.035240092542235, "wql": 0.2947679001329638, "wsql_by_level": [0.19672717626798267, 0.3161935250005014, 0.37869650273195526, 0.3992906209489416, 0.3845364049578158, 0.3504917996538294, 0.29357824325670967, 0.21489950037823272, 0.11849732800070568], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 2.1841585941461465, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8174635334771951, "wql": 0.5190789613049622}}, {"config_id": "solar__T__long", "leaderboard_key": "solar/10T/long", "dataset": "solar/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2519314274970368, "wql": 0.446648833448481, "wsql_by_level": [0.37457636523739346, 0.5490203140498611, 0.5980099238426476, 0.5891475795016288, 0.5450058799385539, 0.47844673954273, 0.39681956532878426, 0.299551662152704, 0.18926147144202576], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 2.5721531510475453, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8011385519783164, "wql": 0.5653112957646796}}, {"config_id": "solar__H__short", "leaderboard_key": "solar/H/short", "dataset": "solar/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2511227283133475, "wql": 0.6311422099652426, "wsql_by_level": [0.5670637267850912, 0.8627076067697685, 0.8957423054194338, 0.8377163362117935, 0.742347572107844, 0.6315121972069098, 0.5094404688815857, 0.3863295401040202, 0.24742013620073655], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 16.6063073140262, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8899817189144198, "wql": 0.6968449432343201}}, {"config_id": "solar__H__medium", "leaderboard_key": "solar/H/medium", "dataset": "solar/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9325988326921647, "wql": 0.2717962382032388, "wsql_by_level": [0.2388186398097979, 0.3059638219945535, 0.33189523266564636, 0.3363412715892501, 0.3268453555834686, 0.30505546211175677, 0.26838445234232905, 0.20983039989810057, 0.12303150783424639], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 12.333341748959446, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.930396450637462, "wql": 0.3948994384819965}}, {"config_id": "solar__H__long", "leaderboard_key": "solar/H/long", "dataset": "solar/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7256882690377002, "wql": 0.18953329380033834, "wsql_by_level": [0.129437628172716, 0.19180382598905768, 0.2248972203588008, 0.23937464205632103, 0.2393617476759598, 0.22600921676530114, 0.19935205530955077, 0.1577053847749484, 0.09785792310038957], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 9.873129255650301, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8624529299069983, "wql": 0.26015448798234825}}, {"config_id": "solar__D__short", "leaderboard_key": "solar/D/short", "dataset": "solar/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.577381964419038, "wql": 0.12152042589107188, "wsql_by_level": [0.08003448281021071, 0.11780832849619896, 0.14114201439510723, 0.15296349702749676, 0.15540871822133015, 0.14868468500616785, 0.1310813522291261, 0.1030661446792501, 0.06349461015475899], "n_valid_labels": 4110, "n_masked_labels": 0, "mae_median": 153.8461724608484, "n_mase_elements": 4110, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7416265839767592, "wql": 0.3262377109510743}}, {"config_id": "solar__W__short", "leaderboard_key": "solar/W/short", "dataset": "solar/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.409378944950785, "wql": 0.13747223830275362, "wsql_by_level": [0.09879871761569382, 0.13926128338425484, 0.1642148838804733, 0.17956636196376843, 0.18085820246876824, 0.17296996304258708, 0.1497466687389315, 0.10583791387032208, 0.04599614975998329], "n_valid_labels": 1096, "n_masked_labels": 0, "mae_median": 1462.9799609775962, "n_mase_elements": 1096, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.944606579751424, "wql": 0.9250532999889218}}, {"config_id": "hospital__M__short", "leaderboard_key": "hospital/M/short", "dataset": "hospital", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 1.1872953754864706, "wql": 0.09033552842454197, "wsql_by_level": [0.05327101396064397, 0.08275308836121681, 0.10064665406714206, 0.1115716767764172, 0.11642451859276132, 0.11378717724161538, 0.10397332258146984, 0.08258679382620689, 0.04800551041340429], "n_valid_labels": 2304, "n_masked_labels": 0, "mae_median": 39.48999405755765, "n_mase_elements": 2304, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9163974870962155, "wql": 1.0227912518950282}}, {"config_id": "covid_deaths__D__short", "leaderboard_key": "covid_deaths/D/short", "dataset": "covid_deaths", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 48.12474977081638, "wql": 0.17856830413663605, "wsql_by_level": [0.10029766305721693, 0.15761679068042614, 0.19909568121718552, 0.21568803436801545, 0.20598700534658185, 0.17979196516825632, 0.16843612027495572, 0.19314640964449412, 0.18705506747259212], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 140.89114211581312, "n_mase_elements": 4560, "n_seasonal_error_zero": 40, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9664090981300282, "wql": 0.6744684525277332}}, {"config_id": "us_births__D__short", "leaderboard_key": "us_births/D/short", "dataset": "us_births/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.32740795206129847, "wql": 0.019424147474869674, "wsql_by_level": [0.019445241568923403, 0.02336107806595078, 0.024346462543590804, 0.022189927979153222, 0.01986436201877285, 0.018588094716870982, 0.01862441358842597, 0.01624212076957937, 0.012155626022559683], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 215.50846354166666, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.2451931851581462, "wql": 0.19108750531666133}}, {"config_id": "us_births__M__short", "leaderboard_key": "us_births/M/short", "dataset": "us_births/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.5608100261546994, "wql": 0.012788781420142236, "wsql_by_level": [0.006231326829633014, 0.010045851851306103, 0.013142028587465819, 0.016606814968716254, 0.01778984021264595, 0.017387134849044243, 0.015351196474565468, 0.011324881306241222, 0.007219957701662052], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 5432.84375, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7526712423658174, "wql": 0.7276728033996893}}, {"config_id": "us_births__W__short", "leaderboard_key": "us_births/W/short", "dataset": "us_births/W", "term": "short", "freq": "W-TUE", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 1.1354599702535948, "wql": 0.01303864029036468, "wsql_by_level": [0.007080270651410994, 0.013386538091011058, 0.016205541384536514, 0.016823123103362852, 0.016890607474384648, 0.01559078204241586, 0.013600947329397275, 0.010634957345017647, 0.007134995191745283], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 1227.296875, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9935615260068812, "wql": 0.8321474763622507}}, {"config_id": "saugeenday__D__short", "leaderboard_key": "saugeen/D/short", "dataset": "saugeenday/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.6507610560614754, "wql": 0.3521973340896551, "wsql_by_level": [0.12364373939688048, 0.21335570906115603, 0.2886726770445971, 0.3680583703859994, 0.43830693765189266, 0.4855708578366647, 0.4964484369014292, 0.44846730034139826, 0.3072519781868776], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 7.373783683776855, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.969809350802278, "wql": 0.41490670800427915}}, {"config_id": "saugeenday__M__short", "leaderboard_key": "saugeen/M/short", "dataset": "saugeenday/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.6558419406565725, "wql": 0.367224836950706, "wsql_by_level": [0.14533155878930448, 0.2609865011154885, 0.35636153526869563, 0.40374047557186615, 0.42543790813955895, 0.4503184706943847, 0.48092014120937, 0.4654226900962902, 0.31650425167139495], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 11.517845710118612, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7959641353687992, "wql": 0.8558915681597892}}, {"config_id": "saugeenday__W__short", "leaderboard_key": "saugeen/W/short", "dataset": "saugeenday/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.2623838915907404, "wql": 0.23391760552191043, "wsql_by_level": [0.09660638083203833, 0.15169760153288214, 0.19252882576794153, 0.2191029896774264, 0.24334744767371147, 0.27529677515189954, 0.3370562819009359, 0.3534970620350443, 0.23612508512531416], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 3.1556949615478516, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.511931989647992, "wql": 0.20502447442064026}}, {"config_id": "temperature_rain_with_missing__D__short", "leaderboard_key": "temperature_rain/D/short", "dataset": "temperature_rain_with_missing", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.6836916958010785, "wql": 0.5503255914030781, "wsql_by_level": [0.18114413832866588, 0.3458062364826655, 0.48865794463237877, 0.6058729128405423, 0.6908055643666081, 0.7396425302133325, 0.7430349579054545, 0.6656114143928422, 0.4923546234652134], "n_valid_labels": 5732, "n_masked_labels": 28, "mae_median": 4.245014685762957, "n_mase_elements": 5732, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.718970185522625, "wql": 0.3548679503623587}}, {"config_id": "kdd_cup_2018_with_missing__H__short", "leaderboard_key": "kdd_cup_2018/H/short", "dataset": "kdd_cup_2018_with_missing/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 176, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.7467770125483886, "wql": 0.5260201815505297, "wsql_by_level": [0.21229944031244535, 0.3721926050004192, 0.5035340156300437, 0.6039977449411132, 0.6722016352233492, 0.6978572592385401, 0.6792612003265401, 0.5930794710528546, 0.3997582622294606], "n_valid_labels": 7994, "n_masked_labels": 454, "mae_median": 16.75100575813598, "n_mase_elements": 7994, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1490537608893228, "wql": 0.906615565799268}}, {"config_id": "kdd_cup_2018_with_missing__H__medium", "leaderboard_key": "kdd_cup_2018/H/medium", "dataset": "kdd_cup_2018_with_missing/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 183, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.8271580987122301, "wql": 0.47418914844558135, "wsql_by_level": [0.1758515949546377, 0.3340822655272025, 0.4615559865178126, 0.5534118165702606, 0.6105013952742315, 0.6298848044936609, 0.6073596316789519, 0.5290803286201458, 0.36597451237332823], "n_valid_labels": 83400, "n_masked_labels": 4440, "mae_median": 17.40643863505485, "n_mase_elements": 83400, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7219635400561616, "wql": 0.4031871638198852}}, {"config_id": "kdd_cup_2018_with_missing__H__long", "leaderboard_key": "kdd_cup_2018/H/long", "dataset": "kdd_cup_2018_with_missing/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 182, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.8417188469943878, "wql": 0.454385779300152, "wsql_by_level": [0.1910487834514514, 0.3444472331626547, 0.4627891880034824, 0.5450057049080962, 0.5913329213644287, 0.5991410023559574, 0.5635978125533547, 0.47551081396307016, 0.3165985539388721], "n_valid_labels": 124670, "n_masked_labels": 6370, "mae_median": 19.157532229761546, "n_mase_elements": 124670, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7860392483075707, "wql": 0.367081603822145}}, {"config_id": "kdd_cup_2018_with_missing__D__short", "leaderboard_key": "kdd_cup_2018/D/short", "dataset": "kdd_cup_2018_with_missing/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 184, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.9731026563071604, "wql": 0.3618683962324938, "wsql_by_level": [0.16891787704362585, 0.28076358810240654, 0.3650952627657956, 0.42573921467526593, 0.46175204430315486, 0.4694310730435063, 0.4460503358614484, 0.37872282481547914, 0.26034334548176175], "n_valid_labels": 5452, "n_masked_labels": 68, "mae_median": 14.280525457100316, "n_mase_elements": 5452, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6954914997585044, "wql": 0.4101977548318569}}, {"config_id": "restaurant__D__short", "leaderboard_key": "restaurant/D/short", "dataset": "restaurant", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 187, "domain": "Sales", "n_cohorts": 13, "skipped_series": 1, "metrics": {"mase": 0.8266709730317843, "wql": 0.32644913849321516, "wsql_by_level": [0.17724339906405612, 0.27715916260973633, 0.34594166785126407, 0.38876537515995313, 0.40968647661066604, 0.40748798070518794, 0.38082780692388535, 0.3245481243241838, 0.22638225319000363], "n_valid_labels": 4315, "n_masked_labels": 1295, "mae_median": 8.628766249671044, "n_mase_elements": 4315, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.680304862437252, "wql": 0.44520610487500445}}, {"config_id": "hierarchical_sales__D__short", "leaderboard_key": "hierarchical_sales/D/short", "dataset": "hierarchical_sales/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.8848156527449037, "wql": 0.6636354646686073, "wsql_by_level": [0.2153590107876379, 0.3775907377845517, 0.52773037847808, 0.667930906163994, 0.7958236864677126, 0.8865128577171479, 0.9300890829888578, 0.8900604788298458, 0.6816220427996388], "n_valid_labels": 3540, "n_masked_labels": 0, "mae_median": 2.8348408718525016, "n_mase_elements": 3540, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.47269492857869055, "wql": 0.28022514514941543}}, {"config_id": "hierarchical_sales__W__short", "leaderboard_key": "hierarchical_sales/W/short", "dataset": "hierarchical_sales/W", "term": "short", "freq": "W-WED", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.688349341334979, "wql": 0.29516711557019454, "wsql_by_level": [0.1342657644058261, 0.2174622471569406, 0.2773994812659516, 0.31980641655424935, 0.3454592294020399, 0.35325513921582674, 0.3499432804581461, 0.34068254486517663, 0.3182299368075937], "n_valid_labels": 944, "n_masked_labels": 0, "mae_median": 8.317736043515852, "n_mase_elements": 944, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5465837254098869, "wql": 0.3483345457519338}}, {"config_id": "LOOP_SEATTLE__T__short", "leaderboard_key": "loop_seattle/5T/short", "dataset": "LOOP_SEATTLE/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.619426023168628, "wql": 0.05831865403682283, "wsql_by_level": [0.049583559939091526, 0.06606104296761284, 0.07287325962414125, 0.07397327966108512, 0.07086285002412619, 0.06507150056332438, 0.05602616211356297, 0.04372435605975259, 0.026691875378708634], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 4.120602800407344, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6824586969691046, "wql": 0.6127625347157203}}, {"config_id": "LOOP_SEATTLE__T__medium", "leaderboard_key": "loop_seattle/5T/medium", "dataset": "LOOP_SEATTLE/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7236690091469337, "wql": 0.06901664939356221, "wsql_by_level": [0.04922209623783197, 0.07109489674952088, 0.08254247176331708, 0.08696535020990583, 0.08605364420060367, 0.08101989432401416, 0.07156044535768286, 0.05703689116016593, 0.03565415453901756], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 4.532584031478877, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7535041326714996, "wql": 0.6331818372782158}}, {"config_id": "LOOP_SEATTLE__T__long", "leaderboard_key": "loop_seattle/5T/long", "dataset": "LOOP_SEATTLE/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.9310019968557798, "wql": 0.08766539101773935, "wsql_by_level": [0.07174411347309662, 0.09762971655843491, 0.1090345068249475, 0.1119508330221983, 0.1082489733907105, 0.09931322948368128, 0.08533728131102443, 0.06591531123592403, 0.03981455385963659], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 5.83313470481619, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5499788486325501, "wql": 0.4985434566000823}}, {"config_id": "LOOP_SEATTLE__H__short", "leaderboard_key": "loop_seattle/H/short", "dataset": "LOOP_SEATTLE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7641490521664479, "wql": 0.05575730791788738, "wsql_by_level": [0.04469594671245008, 0.05916655714182244, 0.06637444331492785, 0.06834809212645392, 0.06708957262978296, 0.06274388862715742, 0.05594740748580088, 0.0463437666888313, 0.031106096533759616], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 3.549170459750005, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7266364371020412, "wql": 0.6132222335435451}}, {"config_id": "LOOP_SEATTLE__H__medium", "leaderboard_key": "loop_seattle/H/medium", "dataset": "LOOP_SEATTLE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7162499484103702, "wql": 0.05008735845492902, "wsql_by_level": [0.03665382381247482, 0.049308702031704406, 0.055949295159185286, 0.05912453730737827, 0.059721017375504205, 0.05809575317953436, 0.053877582653537544, 0.045993586237147575, 0.032061928337894674], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 3.3963020701685713, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6383153449125551, "wql": 0.34264036822884186}}, {"config_id": "LOOP_SEATTLE__H__long", "leaderboard_key": "loop_seattle/H/long", "dataset": "LOOP_SEATTLE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6730999548261424, "wql": 0.04738473747520454, "wsql_by_level": [0.03741420298926475, 0.049003076365163316, 0.05456816163843598, 0.05670344612452634, 0.056392474262329954, 0.053872629865046366, 0.04903879186669284, 0.04124862630978554, 0.028221227855595804], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 3.1660571400395217, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6479154578840101, "wql": 0.2831342224745045}}, {"config_id": "LOOP_SEATTLE__D__short", "leaderboard_key": "loop_seattle/D/short", "dataset": "LOOP_SEATTLE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5869527498943429, "wql": 0.026517682768301874, "wsql_by_level": [0.018836363470185382, 0.026725220148757133, 0.03085448306553965, 0.032604502211547, 0.032476990740548155, 0.030763722380641685, 0.027792403818444496, 0.022993790058456615, 0.015611669020596772], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 1.8353070232603286, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5674112681823771, "wql": 0.3153108094409606}}, {"config_id": "SZ_TAXI__T__short", "leaderboard_key": "sz_taxi/15T/short", "dataset": "SZ_TAXI/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5275099821911426, "wql": 0.20434423431930657, "wsql_by_level": [0.1063352570127323, 0.17224981969772526, 0.21653015626983474, 0.2443338898174095, 0.2577343162728452, 0.25695140799535693, 0.23999858073348534, 0.20446561578853037, 0.14049906528583933], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 2.828674548874095, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7528484432860356, "wql": 0.6706520413345237}}, {"config_id": "SZ_TAXI__T__medium", "leaderboard_key": "sz_taxi/15T/medium", "dataset": "SZ_TAXI/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 1.2247380279585667, "wql": 0.4606462422807205, "wsql_by_level": [0.35271563027858044, 0.46916671844764296, 0.5347574666973072, 0.5645971811346638, 0.5639857267667516, 0.5360861472248911, 0.4816248899642675, 0.3916217673837492, 0.25126065262863073], "n_valid_labels": 74880, "n_masked_labels": 0, "mae_median": 7.516599158164984, "n_mase_elements": 74880, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8464958215201235, "wql": 0.8074034064141411}}, {"config_id": "SZ_TAXI__H__short", "leaderboard_key": "sz_taxi/H/short", "dataset": "SZ_TAXI/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.48236939748182234, "wql": 0.1354479873405955, "wsql_by_level": [0.07083712908538735, 0.1105372186115372, 0.13693856479136124, 0.15434980584193558, 0.16477553303477152, 0.16617163715875705, 0.15956254128526853, 0.14421913712925524, 0.11164031912708551], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 1.8412857813400945, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8145983157874067, "wql": 0.628189930360445}}, {"config_id": "M_DENSE__H__short", "leaderboard_key": "m_dense/H/short", "dataset": "M_DENSE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6162997543359653, "wql": 0.10877191722864998, "wsql_by_level": [0.06842868632873086, 0.09740792301646804, 0.1160604477140447, 0.12857126860399587, 0.13560961697225254, 0.13573949532414786, 0.12534388643656147, 0.10358798916803391, 0.06819794149361473], "n_valid_labels": 1440, "n_masked_labels": 0, "mae_median": 81.5105882300271, "n_mase_elements": 1440, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.46661331281821217, "wql": 0.4736986381907257}}, {"config_id": "M_DENSE__H__medium", "leaderboard_key": "m_dense/H/medium", "dataset": "M_DENSE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.9148011108326657, "wql": 0.24504539102617562, "wsql_by_level": [0.14577099949003738, 0.22502219095496742, 0.27481079495526645, 0.30219021195853174, 0.30826281677348044, 0.2953885829843998, 0.2648341688065938, 0.22490004916309475, 0.1642287041492086], "n_valid_labels": 14400, "n_masked_labels": 0, "mae_median": 125.8994382126795, "n_mase_elements": 14400, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8400498271111567, "wql": 0.503397100948463}}, {"config_id": "M_DENSE__H__long", "leaderboard_key": "m_dense/H/long", "dataset": "M_DENSE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7819969830359697, "wql": 0.19776195024018062, "wsql_by_level": [0.15134470327137428, 0.20260209627716286, 0.22826577814636828, 0.23789205268069274, 0.23559926372484558, 0.22473934562755532, 0.2048769050860482, 0.17312237115020496, 0.12141503619737332], "n_valid_labels": 21600, "n_masked_labels": 0, "mae_median": 120.48273391845049, "n_mase_elements": 21600, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6098391116491899, "wql": 0.40316645461133116}}, {"config_id": "M_DENSE__D__short", "leaderboard_key": "m_dense/D/short", "dataset": "M_DENSE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7738065478738333, "wql": 0.12120110479278938, "wsql_by_level": [0.08607953195096542, 0.11947397605395241, 0.14036146571913397, 0.15063517229645662, 0.15061120626314242, 0.14340735182437886, 0.12780760139289363, 0.10374263393804896, 0.06869100369613208], "n_valid_labels": 900, "n_masked_labels": 0, "mae_median": 77.02082595825195, "n_mase_elements": 900, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.549989437783038, "wql": 0.47290777871154444}}, {"config_id": "ett1__T__short", "leaderboard_key": "ett1/15T/short", "dataset": "ett1/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.107083738198638, "wql": 0.5316922568983645, "wsql_by_level": [0.5029810745408837, 0.6338315695950164, 0.6753554104316974, 0.6742020897094367, 0.6409019880677244, 0.5812692632016984, 0.49237570731020813, 0.373691657366816, 0.21062155186179923], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 2.062846050642076, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9245781564552206, "wql": 1.0262072040911547}}, {"config_id": "ett1__T__medium", "leaderboard_key": "ett1/15T/medium", "dataset": "ett1/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0151525991880934, "wql": 0.3436310755687199, "wsql_by_level": [0.18236583162500872, 0.3237334768715601, 0.40952103959242186, 0.45340760079656006, 0.4644181827193618, 0.44080993665116874, 0.3842897872189889, 0.285010745952635, 0.14912307869077415], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 1.8481640429681214, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9760175426447272, "wql": 0.7797003304065692}}, {"config_id": "ett1__T__long", "leaderboard_key": "ett1/15T/long", "dataset": "ett1/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.27307247294281, "wql": 0.3282946572402945, "wsql_by_level": [0.1986055679793525, 0.32963009334568827, 0.40464662823603, 0.4298134323826024, 0.4252601705899528, 0.3950404252046606, 0.34232899486159035, 0.2677727721923813, 0.16155383037039198], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 1.8683039446764196, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0291183243563582, "wql": 0.9052467154063255}}, {"config_id": "ett1__H__short", "leaderboard_key": "ett1/H/short", "dataset": "ett1/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9129143559624434, "wql": 0.34525472332347, "wsql_by_level": [0.22660598368120843, 0.3171342306770723, 0.3892051243710807, 0.4526477770519681, 0.4649088283402593, 0.43816249084566516, 0.37952975924819127, 0.2841396536602566, 0.1549586620355285], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 5.417795660705971, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.720688952054486, "wql": 0.49139043771251073}}, {"config_id": "ett1__H__medium", "leaderboard_key": "ett1/H/medium", "dataset": "ett1/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0214294966412503, "wql": 0.24595398164793053, "wsql_by_level": [0.17406814006790872, 0.25245690613813665, 0.2916652230833364, 0.3078214520838479, 0.304365418806307, 0.2861875993700716, 0.2538061200774976, 0.2059109555179105, 0.13730401968635877], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 5.731355004216589, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6755707955775141, "wql": 0.4958830967109687}}, {"config_id": "ett1__H__long", "leaderboard_key": "ett1/H/long", "dataset": "ett1/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9184933289661569, "wql": 0.2433123192760126, "wsql_by_level": [0.148087687622324, 0.2254563058854089, 0.2648049834729476, 0.28675883967819676, 0.297921759296374, 0.29718192906862895, 0.27793974878550404, 0.23383002176933265, 0.15782959790539627], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 5.45492329030549, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7635105614810753, "wql": 0.4861402649246405}}, {"config_id": "ett1__D__short", "leaderboard_key": "ett1/D/short", "dataset": "ett1/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2362219565396784, "wql": 0.21211818079512806, "wsql_by_level": [0.12759474468457743, 0.20016557795687595, 0.2450403479988854, 0.2690227946277039, 0.27601033694224114, 0.26289772789069005, 0.23030779703065501, 0.18160797888721447, 0.11641632113730907], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 101.23239531744095, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1437216981005118, "wql": 0.5927534593021693}}, {"config_id": "ett1__W__short", "leaderboard_key": "ett1/W/short", "dataset": "ett1/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.5817972675735799, "wql": 0.2921973343828827, "wsql_by_level": [0.17739626287432736, 0.2657361769468288, 0.33113457925827, 0.35921673551398514, 0.3726774138843192, 0.3692334104671081, 0.32880365974566456, 0.2511231373457456, 0.17445463340969528], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 887.4289741516113, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9560732123503632, "wql": 0.8619209911132996}}, {"config_id": "ett2__T__short", "leaderboard_key": "ett2/15T/short", "dataset": "ett2/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2112942226535321, "wql": 0.10603323316944578, "wsql_by_level": [0.05555965645990992, 0.09118557231149862, 0.11608241426198763, 0.13235425709829884, 0.14054109753033928, 0.1378913565280705, 0.12474886142503079, 0.09823391892168855, 0.057701963988187825], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 2.3284006239402864, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.325018254897407, "wql": 1.0341219872765686}}, {"config_id": "ett2__T__medium", "leaderboard_key": "ett2/15T/medium", "dataset": "ett2/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1125619361426078, "wql": 0.14794900206922662, "wsql_by_level": [0.07797574792800502, 0.11103643536660461, 0.14002828934016004, 0.1709334350168507, 0.19261772408209973, 0.1960801454455856, 0.18402660763026965, 0.15401239083343302, 0.10483024298003114], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 2.5729244746528344, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9696438663585314, "wql": 0.8447528997618089}}, {"config_id": "ett2__T__long", "leaderboard_key": "ett2/15T/long", "dataset": "ett2/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 3.132940668573695, "wql": 0.40124570231715473, "wsql_by_level": [0.37730294414013316, 0.46656567513758473, 0.5038930442282548, 0.5078262594027046, 0.48564469472572414, 0.4406983717335641, 0.3738659991398243, 0.2859758751299265, 0.16943845721667647], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 6.437485706969488, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1117072218371524, "wql": 1.2608097043818878}}, {"config_id": "ett2__H__short", "leaderboard_key": "ett2/H/short", "dataset": "ett2/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.6563529338448054, "wql": 0.0862884390726809, "wsql_by_level": [0.06938829387567377, 0.10122261034470352, 0.11337074919837953, 0.1117961904391991, 0.09917241903269325, 0.08668258638540494, 0.07708285140796965, 0.06754543705426297, 0.050334813915841346], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 5.987722199587595, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8289956718205904, "wql": 0.7613814868523202}}, {"config_id": "ett2__H__medium", "leaderboard_key": "ett2/H/medium", "dataset": "ett2/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 2.2075137248499512, "wql": 0.18439759967917982, "wsql_by_level": [0.08817730746844442, 0.1412533046409432, 0.17940398523137663, 0.2063651328459806, 0.22440375088238398, 0.2319564432707547, 0.2276133614516551, 0.205835015194146, 0.15457009612693381], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 14.37627405598732, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9145284159882985, "wql": 0.7521615481310319}}, {"config_id": "ett2__H__long", "leaderboard_key": "ett2/H/long", "dataset": "ett2/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.394798318269394, "wql": 0.1611886217250057, "wsql_by_level": [0.11527137813406174, 0.16411191658426302, 0.1910512770653619, 0.2027425152895694, 0.20221066171358998, 0.19019332494177116, 0.16763191820242476, 0.13294724491987017, 0.0845373586741391], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 12.173998493500171, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0851923982475131, "wql": 0.6065658921590206}}, {"config_id": "ett2__D__short", "leaderboard_key": "ett2/D/short", "dataset": "ett2/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.6994531212586015, "wql": 0.13292929996003863, "wsql_by_level": [0.11347945972700656, 0.1474595699205491, 0.1646314501935089, 0.16653716913443242, 0.16051770159505488, 0.14520457750039695, 0.12595022495289165, 0.10029361350798896, 0.0722899331085184], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 231.56498560905456, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0461322783283002, "wql": 0.6669074142925306}}, {"config_id": "ett2__W__short", "leaderboard_key": "ett2/W/short", "dataset": "ett2/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 2.7207313917731892, "wql": 0.2439608460673083, "wsql_by_level": [0.2123043410143094, 0.2360606948537212, 0.2628012649520402, 0.2949735441893475, 0.3030302356922222, 0.2900898749855996, 0.255908406398546, 0.2048120514281047, 0.13566720109188443], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 3183.673274074282, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9881762125721921, "wql": 0.8515882038546841}}, {"config_id": "jena_weather__T__short", "leaderboard_key": "jena_weather/10T/short", "dataset": "jena_weather/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.3693799156133635, "wql": 0.03857587237506894, "wsql_by_level": [0.010771764445689159, 0.02024841146306703, 0.027892457408170743, 0.034847879870089984, 0.04111959615798594, 0.046979672544462864, 0.05141035091302487, 0.05522032308707679, 0.05869239548605312], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 6.649642039245616, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.620697524222115, "wql": 0.26077522062932934}}, {"config_id": "jena_weather__T__medium", "leaderboard_key": "jena_weather/10T/medium", "dataset": "jena_weather/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.5413986589833613, "wql": 0.05367567446141438, "wsql_by_level": [0.03001228670780097, 0.04860846118302179, 0.06016931792661841, 0.06723564070031182, 0.06922530584714544, 0.06652758814760626, 0.0591056417206643, 0.04727754051934235, 0.034919287400218005], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 11.876657931865859, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7181975850720205, "wql": 0.26429131030519104}}, {"config_id": "jena_weather__T__long", "leaderboard_key": "jena_weather/10T/long", "dataset": "jena_weather/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.7594754178515889, "wql": 0.06366694627814617, "wsql_by_level": [0.035884214832891774, 0.0529284746807158, 0.06322715370665824, 0.06983585961097323, 0.07315002437881775, 0.07568589020748705, 0.07452279102216243, 0.06934186160871068, 0.05842624645489858], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 12.655410731558948, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7458502225804546, "wql": 0.25538232386627097}}, {"config_id": "jena_weather__H__short", "leaderboard_key": "jena_weather/H/short", "dataset": "jena_weather/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.33191519473523495, "wql": 0.04738684853278885, "wsql_by_level": [0.027985432833509728, 0.038955617603439664, 0.04517740355470951, 0.050102263715761174, 0.05421992312086661, 0.05573756454830676, 0.05730162379080594, 0.05367931504126654, 0.043322492586433725], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 9.382634961705966, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.37532523759556985, "wql": 0.25553695505697527}}, {"config_id": "jena_weather__H__medium", "leaderboard_key": "jena_weather/H/medium", "dataset": "jena_weather/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.9677294126704467, "wql": 0.08082793326156262, "wsql_by_level": [0.052850077276572836, 0.07992208185597273, 0.09437410985182884, 0.10050465489996874, 0.10006670080201084, 0.09254463400255994, 0.08109815551600089, 0.06981744828458945, 0.056273536864559486], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 19.92106823067713, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0177542533513237, "wql": 0.25349829803305995}}, {"config_id": "jena_weather__H__long", "leaderboard_key": "jena_weather/H/long", "dataset": "jena_weather/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.3942574079014727, "wql": 0.11464388218242544, "wsql_by_level": [0.07528698117500926, 0.1105696461852858, 0.13315981104348013, 0.14245028978155674, 0.14196177356913645, 0.13467972619837376, 0.12119504127525058, 0.10021379760450566, 0.07227787280923058], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 28.905303384889336, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9458660496522819, "wql": 0.2947195312591485}}, {"config_id": "jena_weather__D__short", "leaderboard_key": "jena_weather/D/short", "dataset": "jena_weather/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.5093121737156134, "wql": 0.09724836964952815, "wsql_by_level": [0.06768729792131656, 0.09533974371540223, 0.11081749220812914, 0.11844442995185328, 0.12076572727729964, 0.11604674267461824, 0.10497925816880616, 0.08433185101141111, 0.056822783916916975], "n_valid_labels": 630, "n_masked_labels": 0, "mae_median": 24.450099781597594, "n_mase_elements": 630, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9063957442681962, "wql": 0.48151458212352155}}, {"config_id": "bitbrains_fast_storage__T__short", "leaderboard_key": "bitbrains_fast_storage/5T/short", "dataset": "bitbrains_fast_storage/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 189, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7873417787456084, "wql": 0.17004234287352293, "wsql_by_level": [0.10419149307524825, 0.14694589153060567, 0.17381513031474, 0.1885775453605322, 0.19636511235874685, 0.194198080946545, 0.18048859045029986, 0.1699597711345186, 0.17583947069047004], "n_valid_labels": 18144, "n_masked_labels": 0, "mae_median": 76.28833707197467, "n_mase_elements": 17472, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 2}, "relative": {"mase": 0.9301168785823798, "wql": 0.13950583511064976}}, {"config_id": "bitbrains_fast_storage__T__medium", "leaderboard_key": "bitbrains_fast_storage/5T/medium", "dataset": "bitbrains_fast_storage/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 182, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7112655547226566, "wql": 0.5879802217038006, "wsql_by_level": [0.3335109407036411, 0.5510798369187269, 0.6640653949799512, 0.7292558148169821, 0.756650871113682, 0.7358371570152223, 0.6711333545136516, 0.5422782560286026, 0.308010369243744], "n_valid_labels": 174720, "n_masked_labels": 0, "mae_median": 395.6898486661917, "n_mase_elements": 173760, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8132431660475362, "wql": 0.7421229429809829}}, {"config_id": "bitbrains_fast_storage__T__long", "leaderboard_key": "bitbrains_fast_storage/5T/long", "dataset": "bitbrains_fast_storage/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 182, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7214092088082876, "wql": 0.4972824133703841, "wsql_by_level": [0.3064214127552295, 0.5225172656270939, 0.5818980520212783, 0.5960653227032154, 0.593892465089494, 0.5760645833731588, 0.5375496968441965, 0.4615169686208724, 0.29961595329891844], "n_valid_labels": 262080, "n_masked_labels": 0, "mae_median": 443.1621442951751, "n_mase_elements": 252000, "n_seasonal_error_zero": 10, "n_seasonal_error_nan": 4}, "relative": {"mase": 0.7804660417878175, "wql": 0.7032124595530006}}, {"config_id": "bitbrains_fast_storage__H__short", "leaderboard_key": "bitbrains_fast_storage/H/short", "dataset": "bitbrains_fast_storage/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 188, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5690350150639927, "wql": 0.34840789929643523, "wsql_by_level": [0.16967738691785286, 0.302882880307531, 0.39966400144092246, 0.4525647753293816, 0.46521437463772825, 0.4470010118091984, 0.4027574753294348, 0.31925003082592074, 0.17665915706994673], "n_valid_labels": 18048, "n_masked_labels": 0, "mae_median": 335.3995370736956, "n_mase_elements": 17472, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7843670429667351, "wql": 0.6042522353305465}}, {"config_id": "bitbrains_rnd__T__short", "leaderboard_key": "bitbrains_rnd/5T/short", "dataset": "bitbrains_rnd/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 186, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.1762276768493416, "wql": 0.29305788852580017, "wsql_by_level": [0.0941130412093545, 0.16622963545994934, 0.226678972851334, 0.27978610366565937, 0.3269947778695106, 0.3686592579693599, 0.4020833311541577, 0.41608000269585727, 0.3568958738570189], "n_valid_labels": 17856, "n_masked_labels": 0, "mae_median": 52.206851834061446, "n_mase_elements": 17376, "n_seasonal_error_zero": 10, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.853011114931803, "wql": 0.302634558662142}}, {"config_id": "bitbrains_rnd__T__medium", "leaderboard_key": "bitbrains_rnd/5T/medium", "dataset": "bitbrains_rnd/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 188, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7018403923087395, "wql": 0.8763071749093687, "wsql_by_level": [0.4593097018225786, 0.9207738511644981, 1.0929373491978462, 1.1319649154348952, 1.1000326475380773, 1.0137410432291196, 0.8788118060722624, 0.7181236981849387, 0.5710695615401022], "n_valid_labels": 178498, "n_masked_labels": 1982, "mae_median": 195.70914827139654, "n_mase_elements": 177486, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 4}, "relative": {"mase": 0.8424568913342672, "wql": 0.4601642426171456}}, {"config_id": "bitbrains_rnd__T__long", "leaderboard_key": "bitbrains_rnd/5T/long", "dataset": "bitbrains_rnd/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 181, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.1018156833060604, "wql": 0.6628716401107811, "wsql_by_level": [0.20530593636375716, 0.3717069457920215, 0.518072770111531, 0.6517749761797804, 0.7620512965890279, 0.8697410983682754, 0.9144529240804049, 0.9053833830481348, 0.7673554304640974], "n_valid_labels": 260626, "n_masked_labels": 14, "mae_median": 209.089716706767, "n_mase_elements": 246232, "n_seasonal_error_zero": 4, "n_seasonal_error_nan": 16}, "relative": {"mase": 0.7693993451517863, "wql": 0.6084504573504855}}, {"config_id": "bitbrains_rnd__H__short", "leaderboard_key": "bitbrains_rnd/H/short", "dataset": "bitbrains_rnd/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 180, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.2215021770399326, "wql": 0.36860351639044364, "wsql_by_level": [0.14886295299375826, 0.2641160652678832, 0.3535642757534057, 0.44892928556562695, 0.5143735939904236, 0.5221533797370183, 0.46486019908891, 0.3523978235325424, 0.2481740715844244], "n_valid_labels": 17280, "n_masked_labels": 0, "mae_median": 250.59353141244387, "n_mase_elements": 16992, "n_seasonal_error_zero": 6, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8251812853807775, "wql": 0.4597046797120189}}, {"config_id": "bizitobs_application__S__short", "leaderboard_key": "bizitobs_application/10S/short", "dataset": "bizitobs_application", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.4062655295463454, "wql": 0.006554902715506177, "wsql_by_level": [0.001765639491537941, 0.003677057251152104, 0.005721009967562471, 0.00740489998704737, 0.008884389930746837, 0.009561424272219617, 0.009204914185693592, 0.00775450057763828, 0.00502028877595738], "n_valid_labels": 120, "n_masked_labels": 0, "mae_median": 226.22181529998778, "n_mase_elements": 120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0914920939774215, "wql": 0.8113244574488367}}, {"config_id": "bizitobs_application__S__medium", "leaderboard_key": "bizitobs_application/10S/medium", "dataset": "bizitobs_application", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.4703034034625197, "wql": 0.00669723470787308, "wsql_by_level": [0.004606076681672416, 0.006445194841912462, 0.007311925529992874, 0.0077634796399292105, 0.007855401423663174, 0.007724686936390077, 0.007453408045348879, 0.006523392176113295, 0.004591547095835339], "n_valid_labels": 1200, "n_masked_labels": 0, "mae_median": 187.96784063339234, "n_mase_elements": 1200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8849852965089385, "wql": 0.5926567331089186}}, {"config_id": "bizitobs_application__S__long", "leaderboard_key": "bizitobs_application/10S/long", "dataset": "bizitobs_application", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6654016738485262, "wql": 0.011677349915199205, "wsql_by_level": [0.011072168278189536, 0.01512204458353631, 0.016228991617481307, 0.015169236927761277, 0.01320514614232288, 0.010918002761176599, 0.008785145277329313, 0.007835656948784589, 0.00675975670021103], "n_valid_labels": 1800, "n_masked_labels": 0, "mae_median": 323.02682648764716, "n_mase_elements": 1800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0038139945754476, "wql": 0.8458267168495301}}, {"config_id": "bizitobs_service__S__short", "leaderboard_key": "bizitobs_service/10S/short", "dataset": "bizitobs_service", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5911467133771469, "wql": 0.008201373646660888, "wsql_by_level": [0.004057122255436924, 0.00663481674992507, 0.00848352286574821, 0.009837478530932867, 0.010565611856506289, 0.010618757352089779, 0.009928090259344657, 0.008306594949895255, 0.005380368000068941], "n_valid_labels": 2520, "n_masked_labels": 0, "mae_median": 13.990628957348905, "n_mase_elements": 2520, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7740464521109395, "wql": 0.4906841904603532}}, {"config_id": "bizitobs_service__S__medium", "leaderboard_key": "bizitobs_service/10S/medium", "dataset": "bizitobs_service", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5845086884755826, "wql": 0.008399305981727882, "wsql_by_level": [0.0053232467060303525, 0.007428680774369053, 0.008813081163579473, 0.009741711463396563, 0.010266253138463466, 0.010284305113961138, 0.009685945822732973, 0.008290074331809337, 0.005760455321208573], "n_valid_labels": 25200, "n_masked_labels": 0, "mae_median": 12.938362117326921, "n_mase_elements": 25200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8394513110829915, "wql": 0.394265471797736}}, {"config_id": "bizitobs_service__S__long", "leaderboard_key": "bizitobs_service/10S/long", "dataset": "bizitobs_service", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7293534428628334, "wql": 0.010389260259255953, "wsql_by_level": [0.0072624646328127065, 0.010321832856757153, 0.012023497528620112, 0.012818662254133417, 0.012900946360225922, 0.01232845830991949, 0.011047585669131875, 0.008907567335014127, 0.00589232738668876], "n_valid_labels": 37800, "n_masked_labels": 0, "mae_median": 16.5367922705065, "n_mase_elements": 37800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8900132461854047, "wql": 0.40257154138262724}}, {"config_id": "bizitobs_l2c__T__short", "leaderboard_key": "bizitobs_l2c/5T/short", "dataset": "bizitobs_l2c/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.2095262378348314, "wql": 0.0739445046795741, "wsql_by_level": [0.033110671484900586, 0.052002194573316715, 0.06505702329612414, 0.0770106599351185, 0.08776760413787124, 0.09483606922862413, 0.09668902741370758, 0.09005576656204753, 0.06897152548445652], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 2.1584483129637584, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3275733914863857, "wql": 0.396731646948172}}, {"config_id": "bizitobs_l2c__T__medium", "leaderboard_key": "bizitobs_l2c/5T/medium", "dataset": "bizitobs_l2c/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.3440786668313065, "wql": 0.5938867322323665, "wsql_by_level": [0.13600572828480512, 0.36147536137441144, 0.47508819657130597, 0.5721192663332282, 0.6723217686989006, 0.7375980346365651, 0.7914280009022922, 0.8207589470617863, 0.7781852862280043], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 3.633236852332595, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.22607178220419485, "wql": 0.2819516465789851}}, {"config_id": "bizitobs_l2c__T__long", "leaderboard_key": "bizitobs_l2c/5T/long", "dataset": "bizitobs_l2c/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.45511087159958724, "wql": 0.19160275633213286, "wsql_by_level": [0.11921702306453705, 0.1798427767400755, 0.21040762287704848, 0.2321147763267757, 0.24018903730717306, 0.2330038092952642, 0.20994098572164058, 0.17722710493187102, 0.12248167072481017], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 5.020375507525982, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.45570853675646317, "wql": 0.5185063261158916}}, {"config_id": "bizitobs_l2c__H__short", "leaderboard_key": "bizitobs_l2c/H/short", "dataset": "bizitobs_l2c/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.43744211877725736, "wql": 0.306751021444636, "wsql_by_level": [0.12845518194518704, 0.22146909752749813, 0.28943233655169903, 0.33668810146483885, 0.37014855030159677, 0.38925141609197206, 0.38404756827844544, 0.3604672440158595, 0.2807996968246274], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 5.071506102525053, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3840288994664711, "wql": 0.4652754878218807}}, {"config_id": "bizitobs_l2c__H__medium", "leaderboard_key": "bizitobs_l2c/H/medium", "dataset": "bizitobs_l2c/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6304829242294927, "wql": 0.2828865952176213, "wsql_by_level": [0.15106216711713033, 0.25351171362375946, 0.3105823304861972, 0.34165283339413277, 0.37635173300444147, 0.3679158123250064, 0.3232675397260872, 0.25181060871544203, 0.16982461856639489], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 5.9699882950345495, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.44472341451408304, "wql": 0.3287825561336583}}], "cpu_seconds": 1.0800957710016519, "members": ["/workspace/research/backcast2_evals/weekly_slow_ar_delta3k", "/workspace/research/backcast2_evals/patch8_ema6000", "/workspace/research/backcast2_evals/split_patch_ema12000"], "member_checkpoint_hashes": ["094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "weights": [0.3333333333333333, 0.3333333333333333, 0.3333333333333333], "selection_only": true, "cutoff": "valid_backcast2", "E102skill": 0.3650870167535245, "difference": -0.00013749455397837895} +{"composition": "equal quantile mean after each member applies its own fixed rules", "skill_score": 0.3895560076325473, "rel_mase_gmean": 0.7397944917104605, "rel_wql_gmean": 0.5037099789104116, "groups": {"term": {"short": 0.39497499447719087, "medium": 0.36817084374084685, "long": 0.3961751351498505}, "domain": {"Econ/Fin": 0.1867078283664393, "Energy": 0.31635325174873963, "Healthcare": 0.2409392551732944, "Nature": 0.5066352280851036, "Sales": 0.39984868686183916, "Transport": 0.5093415403788037, "Web/CloudOps": 0.3940107201665548}, "freq": {"A-DEC": 0.35784995850867973, "Q-DEC": 0.25447966877928774, "M": 0.148976696722656, "W-SUN": 0.1683943609547428, "D": 0.4400873284135568, "H": 0.4057663179487805, "15T": 0.2545202824131877, "W-FRI": 0.03968631706726722, "10T": 0.6070409132004327, "W-TUE": 0.2726738628251745, "W-THU": 0.3390868412221538, "W-WED": 0.37715156511841175, "5T": 0.4653160336561383, "10S": 0.2927867937240686}}, "configs": [{"config_id": "m4_yearly__A__short", "leaderboard_key": "m4_yearly/A/short", "dataset": "m4_yearly", "term": "short", "freq": "A-DEC", "prediction_length": 6, "seasonality": 1, "n_variates": 1, "n_instances": 72, "domain": "Econ/Fin", "n_cohorts": 3, "skipped_series": 235, "dropped_containers": 11, "metrics": {"mase": 1.9968311000247458, "wql": 0.09431077343688035, "wsql_by_level": [0.057351370674834486, 0.08460425826103793, 0.09675036185704364, 0.10488426826187748, 0.1141929048203329, 0.11318498653042676, 0.10820881729176861, 0.09524758021703066, 0.07437241301757068], "n_valid_labels": 432, "n_masked_labels": 0, "mae_median": 386.90164022092466, "n_mase_elements": 432, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5327260887435096, "wql": 0.7740500878413724}}, {"config_id": "m4_quarterly__Q__short", "leaderboard_key": "m4_quarterly/Q/short", "dataset": "m4_quarterly", "term": "short", "freq": "Q-DEC", "prediction_length": 8, "seasonality": 4, "n_variates": 1, "n_instances": 164, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 95, "metrics": {"mase": 1.3466628410343882, "wql": 0.07619546429116468, "wsql_by_level": [0.042053495533562364, 0.06642435787204258, 0.0810742047190762, 0.08988202179447301, 0.09444603993760482, 0.09470428424835266, 0.08887245008707427, 0.07575735078687426, 0.052544973641421994], "n_valid_labels": 1312, "n_masked_labels": 0, "mae_median": 467.81559930196624, "n_mase_elements": 1312, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7201529208440769, "wql": 0.7717813094641036}}, {"config_id": "m4_monthly__M__short", "leaderboard_key": "m4_monthly/M/short", "dataset": "m4_monthly", "term": "short", "freq": "M", "prediction_length": 18, "seasonality": 12, "n_variates": 1, "n_instances": 148, "domain": "Econ/Fin", "n_cohorts": 3, "dropped_containers": 499, "metrics": {"mase": 1.3586919716401007, "wql": 0.1137018990727708, "wsql_by_level": [0.07387143973071765, 0.10365601243650747, 0.12558889012990404, 0.13686400165768292, 0.13963017215907328, 0.13580584565048176, 0.12544054841260036, 0.10674629458647017, 0.07571388689149945], "n_valid_labels": 2664, "n_masked_labels": 0, "mae_median": 632.0187633502949, "n_mase_elements": 2664, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.779267946142973, "wql": 0.7562270530823811}}, {"config_id": "m4_weekly__W__short", "leaderboard_key": "m4_weekly/W/short", "dataset": "m4_weekly", "term": "short", "freq": "W-SUN", "prediction_length": 13, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 4, "metrics": {"mase": 3.1376710929808236, "wql": 0.05610427278366708, "wsql_by_level": [0.03207904965590628, 0.04743180538291435, 0.057305160776317136, 0.06428230854640059, 0.06812246664712152, 0.06918429210907566, 0.06656931715735032, 0.0586662174764149, 0.04129783730150303], "n_valid_labels": 2496, "n_masked_labels": 0, "mae_median": 347.26442183898047, "n_mase_elements": 2496, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9927479701235363, "wql": 0.6966198468336456}}, {"config_id": "m4_daily__D__short", "leaderboard_key": "m4_daily/D/short", "dataset": "m4_daily", "term": "short", "freq": "D", "prediction_length": 14, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 2, "dropped_containers": 23, "metrics": {"mase": 2.899294632917307, "wql": 0.01782209940529695, "wsql_by_level": [0.012368559288437032, 0.017953943856232044, 0.020997375199711395, 0.022303848398829706, 0.02211073841633459, 0.020777217756722845, 0.018327784517731156, 0.014925917277556348, 0.01063350993611742], "n_valid_labels": 2688, "n_masked_labels": 0, "mae_median": 157.58748077210925, "n_mase_elements": 2688, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1233738943586717, "wql": 1.1683129880583574}}, {"config_id": "m4_hourly__H__short", "leaderboard_key": "m4_hourly/H/short", "dataset": "m4_hourly", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Econ/Fin", "n_cohorts": 1, "metrics": {"mase": 1.1448737645362772, "wql": 0.030195311576824854, "wsql_by_level": [0.01450632321854546, 0.023160041176966722, 0.029678064430175035, 0.0358304213678648, 0.03931481124092293, 0.04008023758962699, 0.037634115512838316, 0.031165855762965624, 0.02038793389151782], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 292.94997708439445, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9366634566620275, "wql": 0.7293334098979858}}, {"config_id": "electricity__T__short", "leaderboard_key": "electricity/15T/short", "dataset": "electricity/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.6963746720913301, "wql": 0.05573553609690128, "wsql_by_level": [0.03357291719577235, 0.05048769495355534, 0.06113133394546291, 0.0673339201516293, 0.06955087669417274, 0.06858196942696926, 0.06365083936968094, 0.052885465011481225, 0.034424808123387406], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 23.270813270649846, "n_mase_elements": 9168, "n_seasonal_error_zero": 1, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8564447332091749, "wql": 0.8239957863230027}}, {"config_id": "electricity__T__medium", "leaderboard_key": "electricity/15T/medium", "dataset": "electricity/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9086374800774779, "wql": 0.06562175592497879, "wsql_by_level": [0.03810428198148621, 0.058562556936855206, 0.07160368470090045, 0.07931327378437407, 0.08240346934426789, 0.08132439285170404, 0.07526672608421923, 0.06265865854174585, 0.04135875909925615], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 45.90769322239002, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7273277053860124, "wql": 0.6700476497993054}}, {"config_id": "electricity__T__long", "leaderboard_key": "electricity/15T/long", "dataset": "electricity/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.525505258771378, "wql": 0.10136274316991528, "wsql_by_level": [0.044960879821685326, 0.07365369312572438, 0.09534593040703065, 0.11150829597624808, 0.12236944961760891, 0.12791602471238733, 0.1272245464872267, 0.11713715388789882, 0.09214871449342744], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 85.60192187346344, "n_mase_elements": 137520, "n_seasonal_error_zero": 1, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9718135129102374, "wql": 0.8832261889065163}}, {"config_id": "electricity__H__short", "leaderboard_key": "electricity/H/short", "dataset": "electricity/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9339368071829378, "wql": 0.08451570457917906, "wsql_by_level": [0.057753048430970115, 0.08226480428322495, 0.09582090553613322, 0.10229778463115763, 0.10328533576443624, 0.10005686705048246, 0.09174950283440365, 0.07641853333832672, 0.05099455934347652], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 365.78789349765026, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9021533773762123, "wql": 0.914463408155945}}, {"config_id": "electricity__H__medium", "leaderboard_key": "electricity/H/medium", "dataset": "electricity/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 191, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.006297427269044, "wql": 0.061165138419857774, "wsql_by_level": [0.03361703495649566, 0.05166759434578359, 0.06347512617417748, 0.07096351483682163, 0.0748634270052266, 0.07546739246049308, 0.07202832763351609, 0.0630162031797374, 0.0453876251864683], "n_valid_labels": 91680, "n_masked_labels": 0, "mae_median": 119.91655007300226, "n_mase_elements": 91680, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8386311394110976, "wql": 0.5370471342452036}}, {"config_id": "electricity__H__long", "leaderboard_key": "electricity/H/long", "dataset": "electricity/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9482095470456032, "wql": 0.05615345836757914, "wsql_by_level": [0.035456049559589815, 0.05064282126602756, 0.060462722237666244, 0.06617908206370164, 0.06854991299709427, 0.06769838405559461, 0.06329345961627485, 0.054382815434690944, 0.038715878077572256], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 124.21419495831209, "n_mase_elements": 137520, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 1}, "relative": {"mase": 0.828125229606739, "wql": 0.3895974292070914}}, {"config_id": "electricity__D__short", "leaderboard_key": "electricity/D/short", "dataset": "electricity/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0208449978332912, "wql": 0.04236610716126062, "wsql_by_level": [0.022930174804668003, 0.034609920466850554, 0.04320888101367589, 0.05061157488192572, 0.054984504292154554, 0.0550782045903533, 0.05050751702191169, 0.04103818935327935, 0.028325998026526526], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 3155.0729112885065, "n_mase_elements": 5730, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 1}, "relative": {"mase": 0.8879976876707474, "wql": 0.49665715084116496}}, {"config_id": "electricity__W__short", "leaderboard_key": "electricity/W/short", "dataset": "electricity/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 186, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.4911280475115984, "wql": 0.056031502441841186, "wsql_by_level": [0.03403167157968172, 0.05032646338430331, 0.06381012997265191, 0.07221977643955861, 0.07228943944903228, 0.06428776091367575, 0.05186269586027058, 0.05123353902703701, 0.044222045350359424], "n_valid_labels": 1452, "n_masked_labels": 36, "mae_median": 32724.16763078674, "n_mase_elements": 1440, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 6}, "relative": {"mase": 0.9705294841674605, "wql": 0.8299011498843935}}, {"config_id": "solar__T__short", "leaderboard_key": "solar/10T/short", "dataset": "solar/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.01601852853255743, "wql": 0.4304672828217729, "wsql_by_level": [0.19313393587875957, 0.31669038670192684, 0.4073168348047967, 0.4666404347287517, 0.5035122099136743, 0.528858131399247, 0.5308552246819881, 0.5142831168260029, 0.41291527046080884], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 0.04024039566632442, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7017727033189929, "wql": 0.02929915989361301}}, {"config_id": "solar__T__medium", "leaderboard_key": "solar/10T/medium", "dataset": "solar/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9600420031253558, "wql": 0.3500907238317365, "wsql_by_level": [0.27418397431172375, 0.40510800273791686, 0.45478022132823825, 0.4598562656660608, 0.4349718395633114, 0.3893210354750151, 0.3276210975418393, 0.24943900345006845, 0.1555350744114546], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 1.9883911493226405, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6998297201573468, "wql": 0.4757784389558314}}, {"config_id": "solar__T__long", "leaderboard_key": "solar/10T/long", "dataset": "solar/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.3710659245706367, "wql": 0.4921561471624368, "wsql_by_level": [0.5921053099511725, 0.6730755278015691, 0.6700792780273112, 0.6272611645515841, 0.5619412380643437, 0.4805118303950251, 0.3848602220207613, 0.2772256579743168, 0.16234509567584657], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 2.8277735929062633, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8906144584774237, "wql": 0.6661135728385024}}, {"config_id": "solar__H__short", "leaderboard_key": "solar/H/short", "dataset": "solar/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.8215647883066035, "wql": 1.2809713286445232, "wsql_by_level": [1.1562071116288766, 1.6875777465060555, 1.7867397013661925, 1.6948241337233199, 1.5158755806283277, 1.3086838994999097, 1.0709737284645895, 0.807118874193595, 0.5007411817898416], "n_valid_labels": 6576, "n_masked_labels": 0, "mae_median": 23.96474583904483, "n_mase_elements": 6576, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7739858536922466, "wql": 0.6587816242911256}}, {"config_id": "solar__H__medium", "leaderboard_key": "solar/H/medium", "dataset": "solar/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7577705618447346, "wql": 0.19958721292674253, "wsql_by_level": [0.1185204016846511, 0.179705312059717, 0.2170112984802342, 0.23903490662722385, 0.24939234708792876, 0.24776146142371328, 0.2317259163719266, 0.1942496757572412, 0.1188835968480468], "n_valid_labels": 65760, "n_masked_labels": 0, "mae_median": 10.199804727017876, "n_mase_elements": 65760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6376097136259046, "wql": 0.2982413140172017}}, {"config_id": "solar__H__long", "leaderboard_key": "solar/H/long", "dataset": "solar/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.7200532477625126, "wql": 0.20559683285571348, "wsql_by_level": [0.18231550942937055, 0.22492229637420466, 0.24380659902260088, 0.24805215853445903, 0.24173553692921843, 0.22780238889473872, 0.2044210061618349, 0.16758868731046145, 0.1097273130445326], "n_valid_labels": 98640, "n_masked_labels": 0, "mae_median": 10.123846055358113, "n_mase_elements": 98640, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8334464887619782, "wql": 0.27455215119878584}}, {"config_id": "solar__D__short", "leaderboard_key": "solar/D/short", "dataset": "solar/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.6828874993941112, "wql": 0.14928606155763943, "wsql_by_level": [0.10293948175520116, 0.15253657328349718, 0.1783256054978091, 0.1895798660138208, 0.19036392291864423, 0.17968131931487913, 0.1554834674117354, 0.1208024580499453, 0.07386185977322247], "n_valid_labels": 4110, "n_masked_labels": 0, "mae_median": 191.33786379960333, "n_mase_elements": 4110, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0265669616847226, "wql": 0.3903500708379611}}, {"config_id": "solar__W__short", "leaderboard_key": "solar/W/short", "dataset": "solar/W", "term": "short", "freq": "W-FRI", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 137, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1796782633405722, "wql": 0.13237867192981143, "wsql_by_level": [0.09880627671933405, 0.13614151430116472, 0.15900204650471061, 0.17001123473369792, 0.17033158367737974, 0.16396449717472925, 0.1440218180265793, 0.09904185086789351, 0.050087225362813806], "n_valid_labels": 1096, "n_masked_labels": 0, "mae_median": 1265.9088820854242, "n_mase_elements": 1096, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1358319139891182, "wql": 0.9296153808012306}}, {"config_id": "hospital__M__short", "leaderboard_key": "hospital/M/short", "dataset": "hospital", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.9650611808951928, "wql": 0.06701452164733225, "wsql_by_level": [0.04391370384633518, 0.06437858547937508, 0.07569239050600829, 0.08171296943136121, 0.0819235831312105, 0.07792278242192055, 0.07243126027340525, 0.06182548285151166, 0.043329936884862516], "n_valid_labels": 2304, "n_masked_labels": 0, "mae_median": 26.339854261113537, "n_mase_elements": 2304, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.917184901657952, "wql": 0.958614463965833}}, {"config_id": "covid_deaths__D__short", "leaderboard_key": "covid_deaths/D/short", "dataset": "covid_deaths", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 685.332318203542, "wql": 0.8367400585246769, "wsql_by_level": [0.18347583918359756, 0.3596452067883896, 0.5329096021613966, 0.7026816771446398, 0.8672663728531759, 1.0265614009114306, 1.17488841742336, 1.3028572800560336, 1.3803747302000688], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 214.7057933381154, "n_mase_elements": 2850, "n_seasonal_error_zero": 97, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0306658614045787, "wql": 1.0057055964429988}}, {"config_id": "us_births__D__short", "leaderboard_key": "us_births/D/short", "dataset": "us_births/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.5647386579920928, "wql": 0.028919259682802442, "wsql_by_level": [0.02051734202246418, 0.031027893371614705, 0.036048502539453756, 0.03611405511675562, 0.034044943289992816, 0.031894461658740235, 0.029141546710848253, 0.025542773595797708, 0.015941818839554693], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 371.05016276041664, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4820711481881469, "wql": 0.3032253073879135}}, {"config_id": "us_births__M__short", "leaderboard_key": "us_births/M/short", "dataset": "us_births/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.5085407789942138, "wql": 0.012968075292075526, "wsql_by_level": [0.004303102041051231, 0.0077363949558552384, 0.012788252650658938, 0.015424604209921663, 0.016811657692282395, 0.017535840899075446, 0.016611887089931665, 0.014957049431829392, 0.010543888658073763], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 5112.010416666667, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0212446727042683, "wql": 0.8822890961122436}}, {"config_id": "us_births__W__short", "leaderboard_key": "us_births/W/short", "dataset": "us_births/W", "term": "short", "freq": "W-TUE", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Healthcare", "n_cohorts": 1, "metrics": {"mase": 0.4881749759964642, "wql": 0.006742915263625082, "wsql_by_level": [0.006003898814607167, 0.006864239108807159, 0.005948443577625446, 0.0063774292893453745, 0.007463318545270138, 0.0075996400416965286, 0.0072948178242089904, 0.006914686976702416, 0.006219763194362515], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 529.814453125, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9212161758313413, "wql": 0.5742444864694869}}, {"config_id": "saugeenday__D__short", "leaderboard_key": "saugeen/D/short", "dataset": "saugeenday/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.2668320637788269, "wql": 0.16900847968998908, "wsql_by_level": [0.07731043710157902, 0.09124374221006319, 0.09234677100494404, 0.11806301745523912, 0.14212591848273898, 0.19090958210984946, 0.23801582344370076, 0.2782598482649291, 0.29280117713685794], "n_valid_labels": 30, "n_masked_labels": 0, "mae_median": 1.1938577175140381, "n_mase_elements": 30, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.185951288877324, "wql": 0.10866533134256415}}, {"config_id": "saugeenday__M__short", "leaderboard_key": "saugeen/M/short", "dataset": "saugeenday/M", "term": "short", "freq": "M", "prediction_length": 12, "seasonality": 12, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.8019083143691277, "wql": 0.3447663630082628, "wsql_by_level": [0.17685088733973128, 0.2665897273923398, 0.3216868529352762, 0.36900570307676295, 0.4005632985087462, 0.403448819158748, 0.41850731516322986, 0.4139981157307005, 0.3322465477688303], "n_valid_labels": 12, "n_masked_labels": 0, "mae_median": 14.064674973487854, "n_mase_elements": 12, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7490568384215482, "wql": 0.7867490607033338}}, {"config_id": "saugeenday__W__short", "leaderboard_key": "saugeen/W/short", "dataset": "saugeenday/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.4479101428518725, "wql": 0.2716841719150056, "wsql_by_level": [0.1302206753745989, 0.22571368822749546, 0.28360011107221816, 0.3030837154060274, 0.26828749390164414, 0.22140996478166136, 0.29143766285264155, 0.3385625826829112, 0.3828416529358519], "n_valid_labels": 8, "n_masked_labels": 0, "mae_median": 5.392578601837158, "n_mase_elements": 8, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4029682529677202, "wql": 0.34371576208954147}}, {"config_id": "temperature_rain_with_missing__D__short", "leaderboard_key": "temperature_rain/D/short", "dataset": "temperature_rain_with_missing", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.9418289288006938, "wql": 0.6678012207864849, "wsql_by_level": [0.21678625563079706, 0.4055330389598721, 0.5741468141477218, 0.7166200981909755, 0.8262107881608138, 0.906820720334431, 0.9181700096954959, 0.8415931616676545, 0.6043301002906023], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 5.243044345335806, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.38143077166730627, "wql": 0.35509874777654266}}, {"config_id": "kdd_cup_2018_with_missing__H__short", "leaderboard_key": "kdd_cup_2018/H/short", "dataset": "kdd_cup_2018_with_missing/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 176, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.4705943860133582, "wql": 0.4157966504863415, "wsql_by_level": [0.17254159087564677, 0.28887740978273146, 0.38128217839593653, 0.4510005026827958, 0.4982290485585779, 0.5249752291595532, 0.5292355589634328, 0.5068742135827407, 0.3891541223756586], "n_valid_labels": 7981, "n_masked_labels": 467, "mae_median": 10.333274213277207, "n_mase_elements": 7981, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5189791285857186, "wql": 0.4866925068041162}}, {"config_id": "kdd_cup_2018_with_missing__H__medium", "leaderboard_key": "kdd_cup_2018/H/medium", "dataset": "kdd_cup_2018_with_missing/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 183, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.8432648563645159, "wql": 0.45561038716194907, "wsql_by_level": [0.19433888141411107, 0.34997383353645295, 0.468540211270749, 0.5514200899126277, 0.5973268195665872, 0.600990390533035, 0.5597073850207196, 0.46791517731668153, 0.3102806958865783], "n_valid_labels": 83859, "n_masked_labels": 3981, "mae_median": 18.662953259113344, "n_mase_elements": 83859, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9205105077950781, "wql": 0.44149985180090867}}, {"config_id": "kdd_cup_2018_with_missing__H__long", "leaderboard_key": "kdd_cup_2018/H/long", "dataset": "kdd_cup_2018_with_missing/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 182, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.6980256671825639, "wql": 0.4487673088169827, "wsql_by_level": [0.17348640444749572, 0.30772369928549254, 0.41658445328133825, 0.5004838902081757, 0.5589181528747673, 0.5899371073891406, 0.5825362296732435, 0.5240547282709421, 0.3851811139222486], "n_valid_labels": 115026, "n_masked_labels": 16014, "mae_median": 17.113191825177523, "n_mase_elements": 115026, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.854371130522864, "wql": 0.36483190985630665}}, {"config_id": "kdd_cup_2018_with_missing__D__short", "leaderboard_key": "kdd_cup_2018/D/short", "dataset": "kdd_cup_2018_with_missing/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 184, "domain": "Nature", "n_cohorts": 2, "metrics": {"mase": 0.9126124710638742, "wql": 0.41400514179295, "wsql_by_level": [0.20452037508282037, 0.34441885780525205, 0.43628570291190966, 0.4949969396197756, 0.5252641092480357, 0.5255472305126704, 0.49360785896235715, 0.4155642423487188, 0.2858409596450099], "n_valid_labels": 5412, "n_masked_labels": 108, "mae_median": 15.377688205629553, "n_mase_elements": 5412, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8823531141056573, "wql": 0.4698728814533824}}, {"config_id": "restaurant__D__short", "leaderboard_key": "restaurant/D/short", "dataset": "restaurant", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 185, "domain": "Sales", "n_cohorts": 13, "skipped_series": 1, "metrics": {"mase": 0.7829474600874426, "wql": 0.293452765014078, "wsql_by_level": [0.14353622237796626, 0.23801112762248375, 0.3058506358647123, 0.35097433010561774, 0.3749722288517917, 0.3757465455619672, 0.3517836269109516, 0.2969150508493311, 0.20328511698188054], "n_valid_labels": 4965, "n_masked_labels": 585, "mae_median": 8.113220871875413, "n_mase_elements": 4965, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6841832295346499, "wql": 0.4256411108889322}}, {"config_id": "hierarchical_sales__D__short", "leaderboard_key": "hierarchical_sales/D/short", "dataset": "hierarchical_sales/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.9165945404575011, "wql": 0.6230634195715564, "wsql_by_level": [0.19257177817151197, 0.3603045874468261, 0.5095166508624822, 0.6359077151337503, 0.7379809904740019, 0.8123449553136631, 0.8455490288160323, 0.8254601801752675, 0.6879348897504717], "n_valid_labels": 3540, "n_masked_labels": 0, "mae_median": 3.427442221577137, "n_mase_elements": 3540, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8600305398926182, "wql": 0.4809167937236858}}, {"config_id": "hierarchical_sales__W__short", "leaderboard_key": "hierarchical_sales/W/short", "dataset": "hierarchical_sales/W", "term": "short", "freq": "W-WED", "prediction_length": 8, "seasonality": 1, "n_variates": 1, "n_instances": 118, "domain": "Sales", "n_cohorts": 1, "metrics": {"mase": 0.8220106273494577, "wql": 0.40495970254413577, "wsql_by_level": [0.15586326408034157, 0.2598813650234217, 0.3419402614463747, 0.41102547931667366, 0.4673878267784049, 0.5103664274969811, 0.536013719436909, 0.523902537839536, 0.43825644147857956], "n_valid_labels": 944, "n_masked_labels": 0, "mae_median": 12.497673224089509, "n_mase_elements": 944, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7306805360613744, "wql": 0.5309299395404431}}, {"config_id": "LOOP_SEATTLE__T__short", "leaderboard_key": "loop_seattle/5T/short", "dataset": "LOOP_SEATTLE/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5349187112936977, "wql": 0.04573537190151744, "wsql_by_level": [0.03428067708385898, 0.050560965715162325, 0.05771704611606272, 0.05919957489943087, 0.05683773267977635, 0.05163142966080383, 0.044323800741619825, 0.034772381380048074, 0.022294738836893993], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 3.5091780909957984, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5702956121105398, "wql": 0.5609616785436202}}, {"config_id": "LOOP_SEATTLE__T__medium", "leaderboard_key": "loop_seattle/5T/medium", "dataset": "LOOP_SEATTLE/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.9100552906137017, "wql": 0.08722277834839087, "wsql_by_level": [0.07171478445747766, 0.09605247952509383, 0.10698190437053635, 0.10981982512303494, 0.10684941078441199, 0.09858129647547335, 0.0856824335264002, 0.067393864987149, 0.04192900588594062], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 5.628008592525859, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.49074362490102813, "wql": 0.4686240915854403}}, {"config_id": "LOOP_SEATTLE__T__long", "leaderboard_key": "loop_seattle/5T/long", "dataset": "LOOP_SEATTLE/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6500794945211592, "wql": 0.05655358138192314, "wsql_by_level": [0.04690253043030119, 0.06130389392980508, 0.06795076629385957, 0.07000752172425144, 0.06880546053447704, 0.06415634750682926, 0.05641048814910025, 0.04487950019025415, 0.028565723678430247], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 4.0464437110547875, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4918715457546411, "wql": 0.43868824252633043}}, {"config_id": "LOOP_SEATTLE__H__short", "leaderboard_key": "loop_seattle/H/short", "dataset": "LOOP_SEATTLE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.9335724414415559, "wql": 0.06235202029034882, "wsql_by_level": [0.05540359400420743, 0.07429583746227142, 0.08062058737963897, 0.08004392991866151, 0.07490475079481466, 0.06699605380792523, 0.056826319133918245, 0.04419908553122781, 0.02787802458047405], "n_valid_labels": 9216, "n_masked_labels": 0, "mae_median": 4.250828761348708, "n_mase_elements": 9216, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5940801903714601, "wql": 0.5336932904315588}}, {"config_id": "LOOP_SEATTLE__H__medium", "leaderboard_key": "loop_seattle/H/medium", "dataset": "LOOP_SEATTLE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.696462120275957, "wql": 0.04875368636697769, "wsql_by_level": [0.04009743154774071, 0.050917997788528395, 0.05587980728692514, 0.057644577700848146, 0.05725514473093831, 0.054916759478981995, 0.05029918120513576, 0.042454197067577235, 0.029318080496123507], "n_valid_labels": 92160, "n_masked_labels": 0, "mae_median": 3.235563015043994, "n_mase_elements": 92160, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.513109309628044, "wql": 0.30897393470128104}}, {"config_id": "LOOP_SEATTLE__H__long", "leaderboard_key": "loop_seattle/H/long", "dataset": "LOOP_SEATTLE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.659594595128472, "wql": 0.04652156907223157, "wsql_by_level": [0.03696938958324002, 0.04797240355180647, 0.05319179969074284, 0.055207529140060496, 0.05503048579964364, 0.052904051043625965, 0.048350700326860584, 0.04088944544614024, 0.028178317067963872], "n_valid_labels": 138240, "n_masked_labels": 0, "mae_median": 3.107244679397748, "n_mase_elements": 138240, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3637817074585924, "wql": 0.2405754932931896}}, {"config_id": "LOOP_SEATTLE__D__short", "leaderboard_key": "loop_seattle/D/short", "dataset": "LOOP_SEATTLE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 192, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5699060118700859, "wql": 0.025853525061792275, "wsql_by_level": [0.01605180072598903, 0.024115159749420762, 0.028956438289505317, 0.031647710856624406, 0.032403588501368104, 0.03138535687511882, 0.028663864561458544, 0.02380367119086307, 0.015654134805782413], "n_valid_labels": 5760, "n_masked_labels": 0, "mae_median": 1.8398868117067548, "n_mase_elements": 5760, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.2419606925978111, "wql": 0.22503868921418613}}, {"config_id": "SZ_TAXI__T__short", "leaderboard_key": "sz_taxi/15T/short", "dataset": "SZ_TAXI/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.44001407608885196, "wql": 0.17317839503205723, "wsql_by_level": [0.0918683183386289, 0.1482533375713214, 0.18532258633115162, 0.20822598576712967, 0.21829957538935266, 0.2166084884429117, 0.20147087443913778, 0.17033557402975635, 0.11822081497912507], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 2.4306645335226107, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.732549022492019, "wql": 0.6274538572147967}}, {"config_id": "SZ_TAXI__T__medium", "leaderboard_key": "sz_taxi/15T/medium", "dataset": "SZ_TAXI/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.7848120300942381, "wql": 0.22272686892869617, "wsql_by_level": [0.11035496118260098, 0.180175244707686, 0.23094012357907617, 0.2651585906375767, 0.2831106844186403, 0.28394505145066806, 0.266920182701546, 0.22754385162106588, 0.1563931300594054], "n_valid_labels": 74880, "n_masked_labels": 0, "mae_median": 5.410191487493221, "n_mase_elements": 74880, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7767024784125712, "wql": 0.6707301058681476}}, {"config_id": "SZ_TAXI__H__short", "leaderboard_key": "sz_taxi/H/short", "dataset": "SZ_TAXI/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 156, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.49185003433263047, "wql": 0.15369062752044496, "wsql_by_level": [0.07554497150479685, 0.11681149879243229, 0.14493173672624501, 0.1658950321787611, 0.18193956179753445, 0.19115575853432623, 0.19085004343161233, 0.17944422336264146, 0.13664282135565506], "n_valid_labels": 7488, "n_masked_labels": 0, "mae_median": 1.9981748695999213, "n_mase_elements": 7488, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9040617541728057, "wql": 0.6892342353634504}}, {"config_id": "M_DENSE__H__short", "leaderboard_key": "m_dense/H/short", "dataset": "M_DENSE/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.6788798307801768, "wql": 0.1072155029554015, "wsql_by_level": [0.06304705255997374, 0.09368898346820752, 0.11444276296324982, 0.1289585313492226, 0.13608976457337305, 0.13424200850645152, 0.12228386403700417, 0.1012077377524911, 0.07097882138863988], "n_valid_labels": 1440, "n_masked_labels": 0, "mae_median": 88.09738378094302, "n_mase_elements": 1440, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.89325809773895, "wql": 0.7557497116993788}}, {"config_id": "M_DENSE__H__medium", "leaderboard_key": "m_dense/H/medium", "dataset": "M_DENSE/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.761243171153656, "wql": 0.2377963135549466, "wsql_by_level": [0.20532608577138486, 0.25786811480515437, 0.28003101675574993, 0.2845439400276828, 0.2775444865629882, 0.2610872560941965, 0.23549050353901294, 0.1977578488489696, 0.14051756958938003], "n_valid_labels": 14400, "n_masked_labels": 0, "mae_median": 138.13142140063974, "n_mase_elements": 14400, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4805327452766241, "wql": 0.5151776256680263}}, {"config_id": "M_DENSE__H__long", "leaderboard_key": "m_dense/H/long", "dataset": "M_DENSE/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.559679298547275, "wql": 0.10569530934174286, "wsql_by_level": [0.07337071834538977, 0.09934257262428997, 0.11506212103078202, 0.12339593305735484, 0.12586162253554598, 0.12358171780611381, 0.11619305307280318, 0.10140128698145694, 0.07304875862194925], "n_valid_labels": 21600, "n_masked_labels": 0, "mae_median": 73.45239408764574, "n_mase_elements": 21600, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4852246411753012, "wql": 0.2689333495030699}}, {"config_id": "M_DENSE__D__short", "leaderboard_key": "m_dense/D/short", "dataset": "M_DENSE/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 1, "n_instances": 30, "domain": "Transport", "n_cohorts": 1, "metrics": {"mase": 0.5483876750056417, "wql": 0.07647292066749443, "wsql_by_level": [0.05341867331397267, 0.07508299173830851, 0.08669133459613743, 0.09177776441175675, 0.09310897920042048, 0.08912780847684652, 0.08109498905096064, 0.06919910619556133, 0.048754639023485605], "n_valid_labels": 900, "n_masked_labels": 0, "mae_median": 54.33806819703844, "n_mase_elements": 900, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.47465494664322866, "wql": 0.3740681934091836}}, {"config_id": "ett1__T__short", "leaderboard_key": "ett1/15T/short", "dataset": "ett1/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.5526814562793871, "wql": 0.29843604841613736, "wsql_by_level": [0.20691749029848022, 0.3069824132012207, 0.357625133393576, 0.3775163445388652, 0.3864057890888009, 0.3789150718302819, 0.32953131404329067, 0.2347051960096339, 0.10732568334108707], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 1.0350132066800835, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.48914610225278815, "wql": 0.39342343830265486}}, {"config_id": "ett1__T__medium", "leaderboard_key": "ett1/15T/medium", "dataset": "ett1/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2021965798071157, "wql": 0.35301164437566457, "wsql_by_level": [0.23663649787628022, 0.3728780016518156, 0.43339213234098417, 0.45640821246289887, 0.4508935997697171, 0.419267217684821, 0.36198980732512154, 0.27861382561154885, 0.16702550465779376], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 1.947610077766599, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.1364297732354351, "wql": 0.9018485537621849}}, {"config_id": "ett1__T__long", "leaderboard_key": "ett1/15T/long", "dataset": "ett1/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1857530774319667, "wql": 0.31836691457830624, "wsql_by_level": [0.2393167362106497, 0.3583668770377532, 0.40730622420542884, 0.41757846236023904, 0.399440931321071, 0.36232735301280705, 0.3067155772153581, 0.23213043201230665, 0.1421196378291424], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 2.062943595556158, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.115106494776113, "wql": 0.969971104698872}}, {"config_id": "ett1__H__short", "leaderboard_key": "ett1/H/short", "dataset": "ett1/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.3969756521681276, "wql": 0.547784226092488, "wsql_by_level": [0.6309129480562058, 0.7233234785017986, 0.7433296932207936, 0.7065080183734245, 0.6364317338965346, 0.5444938305093084, 0.4403698371575645, 0.3235647200822271, 0.18112377503453564], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 10.292127795694839, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9576505831494143, "wql": 0.924903696699536}}, {"config_id": "ett1__H__medium", "leaderboard_key": "ett1/H/medium", "dataset": "ett1/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.9120439870082669, "wql": 0.2328172728406775, "wsql_by_level": [0.13561523592604321, 0.20531428280037428, 0.2505461697224516, 0.27710169647176924, 0.289364013879569, 0.28808988739470315, 0.2689686693046782, 0.22664269787575075, 0.1537128021907578], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 5.362109633286794, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7318752185840395, "wql": 0.5139836535208311}}, {"config_id": "ett1__H__long", "leaderboard_key": "ett1/H/long", "dataset": "ett1/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.0149191095031243, "wql": 0.2724525708011962, "wsql_by_level": [0.16996791715962825, 0.25857478100850056, 0.3156856238919604, 0.3463162087036214, 0.34956017842903375, 0.33023875242508477, 0.2935743938200357, 0.2359814346550274, 0.15217384711787413], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 6.260802358313508, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8027460243261768, "wql": 0.5060308656392628}}, {"config_id": "ett1__D__short", "leaderboard_key": "ett1/D/short", "dataset": "ett1/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.1976404475081437, "wql": 0.25459974539317337, "wsql_by_level": [0.15601203150078552, 0.24108454771575316, 0.29721257336355317, 0.32311188528679957, 0.3288063230801001, 0.31718133145661476, 0.2788511142584925, 0.21770195081747268, 0.13143595105898845], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 112.48274988446917, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8735438407394557, "wql": 0.5764250532376664}}, {"config_id": "ett1__W__short", "leaderboard_key": "ett1/W/short", "dataset": "ett1/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.9975674282776272, "wql": 0.29824257931804005, "wsql_by_level": [0.1421766677834141, 0.26933999775539097, 0.3287667008214046, 0.3642887035098973, 0.3734986910331037, 0.3727228887739497, 0.3484712079034589, 0.28946701960934296, 0.19545133667239808], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 1271.3011454854693, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9138432945570321, "wql": 1.0557308321464913}}, {"config_id": "ett2__T__short", "leaderboard_key": "ett2/15T/short", "dataset": "ett2/15T", "term": "short", "freq": "15T", "prediction_length": 48, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.5397899386368822, "wql": 0.058414618020196554, "wsql_by_level": [0.033940518844315495, 0.050988146793909644, 0.059417056843117176, 0.06893266721551414, 0.07304518847229997, 0.07157788018495834, 0.0671871254391825, 0.05919982410359633, 0.04144315428487537], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 1.0615838755454337, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.5071014012257135, "wql": 0.5060448348253209}}, {"config_id": "ett2__T__medium", "leaderboard_key": "ett2/15T/medium", "dataset": "ett2/15T", "term": "medium", "freq": "15T", "prediction_length": 480, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.8614065796982358, "wql": 0.20608910780717146, "wsql_by_level": [0.07968990759342594, 0.12333733319957815, 0.17902671796276284, 0.2375942891299248, 0.27822085980789407, 0.2923347476194478, 0.2797793254261682, 0.23510443483955226, 0.14971435468578914], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 3.8472014122874714, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8494888979663114, "wql": 0.6707721158442258}}, {"config_id": "ett2__T__long", "leaderboard_key": "ett2/15T/long", "dataset": "ett2/15T", "term": "long", "freq": "15T", "prediction_length": 720, "seasonality": 96, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2344364244301387, "wql": 0.1440127861556565, "wsql_by_level": [0.11286240292772985, 0.15229720755890813, 0.17398000040622816, 0.18363012653296734, 0.18296628246632324, 0.16984708897381534, 0.14557005803744172, 0.11045491756558166, 0.06450699093191302], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 2.648470590596082, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9005424683558261, "wql": 0.7864686274825242}}, {"config_id": "ett2__H__short", "leaderboard_key": "ett2/H/short", "dataset": "ett2/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8617553955177528, "wql": 0.11761517254785575, "wsql_by_level": [0.06989247654540615, 0.10329216587550691, 0.12715020024876683, 0.14049864936366663, 0.14562135012330293, 0.1415270148464149, 0.13260051521626717, 0.11614534082138937, 0.08180883988998097], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 8.441254699514026, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.6943250986762217, "wql": 0.6957294118589596}}, {"config_id": "ett2__H__medium", "leaderboard_key": "ett2/H/medium", "dataset": "ett2/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.2847900281433562, "wql": 0.1476510065866977, "wsql_by_level": [0.10910900890512192, 0.15529118459641364, 0.1819653640586392, 0.1913806168208345, 0.1858115279411601, 0.1710364968619861, 0.14881233298825255, 0.11580681341690481, 0.0696457136909665], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 11.451942405441619, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 1.0022553016535802, "wql": 0.64824365036072}}, {"config_id": "ett2__H__long", "leaderboard_key": "ett2/H/long", "dataset": "ett2/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 0.8979591627120591, "wql": 0.10928966783870943, "wsql_by_level": [0.07601515889840231, 0.11175223903784692, 0.13147008165804627, 0.1382616531113939, 0.1340717527308429, 0.12559414048009354, 0.1119791473601466, 0.09135724648200182, 0.06310559078961053], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 8.216585392958997, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9100354689715255, "wql": 0.44309698768119626}}, {"config_id": "ett2__D__short", "leaderboard_key": "ett2/D/short", "dataset": "ett2/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.022710476565899, "wql": 0.08571220836430982, "wsql_by_level": [0.06961399704427605, 0.09282097047628182, 0.101026802533916, 0.09767543120760304, 0.09061522495494707, 0.08568563819259305, 0.08402818907453616, 0.08253035381401871, 0.06741326798061655], "n_valid_labels": 210, "n_masked_labels": 0, "mae_median": 133.17818326609475, "n_mase_elements": 210, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9712828802468455, "wql": 0.5033638182193978}}, {"config_id": "ett2__W__short", "leaderboard_key": "ett2/W/short", "dataset": "ett2/W", "term": "short", "freq": "W-THU", "prediction_length": 8, "seasonality": 1, "n_variates": 7, "n_instances": 1, "domain": "Energy", "n_cohorts": 1, "metrics": {"mase": 1.4876685668409757, "wql": 0.11951459050115701, "wsql_by_level": [0.051666036971811755, 0.0689555716174706, 0.10047224327312931, 0.13767464749914238, 0.15745899330415508, 0.16632721002079978, 0.15866770002712827, 0.1374571839017068, 0.09695172789506916], "n_valid_labels": 56, "n_masked_labels": 0, "mae_median": 2210.6731781278336, "n_mase_elements": 56, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8226945465478942, "wql": 0.7581105816648592}}, {"config_id": "jena_weather__T__short", "leaderboard_key": "jena_weather/10T/short", "dataset": "jena_weather/10T", "term": "short", "freq": "10T", "prediction_length": 48, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.17283917280642122, "wql": 0.011274075976301126, "wsql_by_level": [0.004190315907400383, 0.008358343309081931, 0.01212666500777335, 0.014242825750575457, 0.015028476895567503, 0.014806443430653023, 0.014161790799763702, 0.011685523897972644, 0.006866298787922164], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 2.3502964941370816, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.33981830359096293, "wql": 0.08197060799265798}}, {"config_id": "jena_weather__T__medium", "leaderboard_key": "jena_weather/10T/medium", "dataset": "jena_weather/10T", "term": "medium", "freq": "10T", "prediction_length": 480, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.9359756012619731, "wql": 0.06251301260081452, "wsql_by_level": [0.04030677468480963, 0.05710356400441254, 0.06595931213499077, 0.07091396741116544, 0.07228599892715848, 0.07163377429598924, 0.06801967892693718, 0.06419218737018752, 0.05220185565167988], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 12.437287454637477, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.891443941337575, "wql": 0.301860017340692}}, {"config_id": "jena_weather__T__long", "leaderboard_key": "jena_weather/10T/long", "dataset": "jena_weather/10T", "term": "long", "freq": "10T", "prediction_length": 720, "seasonality": 144, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.9317266387722616, "wql": 0.14882085566681172, "wsql_by_level": [0.06784464623768538, 0.11331229099730114, 0.14445958315725885, 0.1656997865515866, 0.17842666197213566, 0.18220283521081568, 0.18093277352149875, 0.1703187884639328, 0.1361903348890907], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 30.86520005103876, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8838609587201758, "wql": 0.5038400918455571}}, {"config_id": "jena_weather__H__short", "leaderboard_key": "jena_weather/H/short", "dataset": "jena_weather/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 0.6107823588570258, "wql": 0.07669683228192102, "wsql_by_level": [0.04666547322770843, 0.07339487497444658, 0.08650145971410184, 0.08990786506049749, 0.08958417753912905, 0.0869146391932048, 0.0816856024567423, 0.07325550107593726, 0.06236189729552142], "n_valid_labels": 1008, "n_masked_labels": 0, "mae_median": 15.185915632592884, "n_mase_elements": 1008, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8137232307811588, "wql": 0.4378086066199777}}, {"config_id": "jena_weather__H__medium", "leaderboard_key": "jena_weather/H/medium", "dataset": "jena_weather/H", "term": "medium", "freq": "H", "prediction_length": 480, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.1913123647234558, "wql": 0.11209131866002037, "wsql_by_level": [0.06604408496557185, 0.1065844128505221, 0.13075097992069085, 0.14098647359860592, 0.14015487506524252, 0.1334371384086362, 0.12044367424201248, 0.0997580674535337, 0.07066216143536748], "n_valid_labels": 10080, "n_masked_labels": 0, "mae_median": 27.629648347108834, "n_mase_elements": 10080, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7852571106345393, "wql": 0.31847760283253534}}, {"config_id": "jena_weather__H__long", "leaderboard_key": "jena_weather/H/long", "dataset": "jena_weather/H", "term": "long", "freq": "H", "prediction_length": 720, "seasonality": 24, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.1582470478607643, "wql": 0.10991399672500349, "wsql_by_level": [0.07211148557111993, 0.10751573996782803, 0.12784974811795977, 0.13673691650509825, 0.13633691733660547, 0.1296792694492055, 0.11675839960038996, 0.09643154149308036, 0.06580595248374412], "n_valid_labels": 15120, "n_masked_labels": 0, "mae_median": 29.32110430865546, "n_mase_elements": 15120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9783182793839802, "wql": 0.2978120885271558}}, {"config_id": "jena_weather__D__short", "leaderboard_key": "jena_weather/D/short", "dataset": "jena_weather/D", "term": "short", "freq": "D", "prediction_length": 30, "seasonality": 1, "n_variates": 21, "n_instances": 1, "domain": "Nature", "n_cohorts": 1, "metrics": {"mase": 1.169232124719657, "wql": 0.08263878579567557, "wsql_by_level": [0.05035811391017428, 0.07745369201187415, 0.093523806890676, 0.10119608368204751, 0.10393133512837573, 0.09946228434855345, 0.09043205971875563, 0.07484276620877442, 0.052548930261848786], "n_valid_labels": 630, "n_masked_labels": 0, "mae_median": 22.120076842580474, "n_mase_elements": 630, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8993452976498786, "wql": 0.4235376735067755}}, {"config_id": "bitbrains_fast_storage__T__short", "leaderboard_key": "bitbrains_fast_storage/5T/short", "dataset": "bitbrains_fast_storage/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 189, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5775079655580716, "wql": 0.2003865645400581, "wsql_by_level": [0.057581083723544625, 0.0881114449259535, 0.122510531686695, 0.16534422109678518, 0.210537010260304, 0.27209070169916355, 0.3052127538046056, 0.3120231595396627, 0.2700681741238087], "n_valid_labels": 18144, "n_masked_labels": 0, "mae_median": 84.10285570596922, "n_mase_elements": 17472, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 2}, "relative": {"mase": 0.6263304129352975, "wql": 0.11344683650428948}}, {"config_id": "bitbrains_fast_storage__T__medium", "leaderboard_key": "bitbrains_fast_storage/5T/medium", "dataset": "bitbrains_fast_storage/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 182, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6901348857829284, "wql": 0.3690107213720071, "wsql_by_level": [0.2394821605659565, 0.3765867192719276, 0.4373699012404232, 0.4672045371031635, 0.4625693322492428, 0.445653120013799, 0.39670337398190186, 0.3086371862982958, 0.18689016162335328], "n_valid_labels": 174720, "n_masked_labels": 0, "mae_median": 333.437771724836, "n_mase_elements": 173760, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7580440319692938, "wql": 0.6636975592817896}}, {"config_id": "bitbrains_fast_storage__T__long", "leaderboard_key": "bitbrains_fast_storage/5T/long", "dataset": "bitbrains_fast_storage/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 182, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.9868312775335087, "wql": 0.5691717412593821, "wsql_by_level": [0.1828466210858052, 0.34869782511028885, 0.49381012858918694, 0.6222312402659418, 0.7322196443407388, 0.8100066639410942, 0.8320495756195957, 0.7273056661836043, 0.3733783061981832], "n_valid_labels": 259510, "n_masked_labels": 2570, "mae_median": 647.4131234153801, "n_mase_elements": 248816, "n_seasonal_error_zero": 14, "n_seasonal_error_nan": 4}, "relative": {"mase": 0.8593137135599643, "wql": 1.0890087001299449}}, {"config_id": "bitbrains_fast_storage__H__short", "leaderboard_key": "bitbrains_fast_storage/H/short", "dataset": "bitbrains_fast_storage/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 188, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.9121125488117836, "wql": 0.3020528598958529, "wsql_by_level": [0.17952938021818973, 0.2925645070444723, 0.36247531793442833, 0.38969727421325245, 0.3817279180563985, 0.35904048291781365, 0.32029901406979105, 0.2636516852898642, 0.16949015931846617], "n_valid_labels": 18046, "n_masked_labels": 2, "mae_median": 297.34607857405393, "n_mase_elements": 17376, "n_seasonal_error_zero": 12, "n_seasonal_error_nan": 2}, "relative": {"mase": 0.7808303490333722, "wql": 0.6130798320221182}}, {"config_id": "bitbrains_rnd__T__short", "leaderboard_key": "bitbrains_rnd/5T/short", "dataset": "bitbrains_rnd/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 2, "n_instances": 186, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6116898085802783, "wql": 0.42191622608687807, "wsql_by_level": [0.15741022590636347, 0.2806321699485745, 0.37907485985623507, 0.45605955153627137, 0.5084182259368423, 0.5347493952683592, 0.533884997613639, 0.5094612702121236, 0.43755533850349426], "n_valid_labels": 17852, "n_masked_labels": 4, "mae_median": 77.61263406785552, "n_mase_elements": 17372, "n_seasonal_error_zero": 10, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7106670928425681, "wql": 0.3310458527503943}}, {"config_id": "bitbrains_rnd__T__medium", "leaderboard_key": "bitbrains_rnd/5T/medium", "dataset": "bitbrains_rnd/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 2, "n_instances": 186, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 2.5272951374448316, "wql": 0.4741736014365157, "wsql_by_level": [0.159968494166483, 0.2923112225822017, 0.40287267674048294, 0.4945387763965621, 0.5653422778782251, 0.6185353688016403, 0.6447388529399369, 0.6288295104417871, 0.4604252329813219], "n_valid_labels": 178546, "n_masked_labels": 14, "mae_median": 233.5457129488998, "n_mase_elements": 177586, "n_seasonal_error_zero": 2, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9330031433613323, "wql": 0.6121586408927034}}, {"config_id": "bitbrains_rnd__T__long", "leaderboard_key": "bitbrains_rnd/5T/long", "dataset": "bitbrains_rnd/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 2, "n_instances": 181, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 1.1053764003353481, "wql": 0.6697040550925483, "wsql_by_level": [0.18371166619539286, 0.37607132655599246, 0.5599576240982479, 0.6861712982110791, 0.7812030446717791, 0.8598786819806716, 0.9094358238031027, 0.9090658558450779, 0.7618411744715904], "n_valid_labels": 135432, "n_masked_labels": 125208, "mae_median": 152.67101505556622, "n_mase_elements": 125728, "n_seasonal_error_zero": 4, "n_seasonal_error_nan": 22}, "relative": {"mase": 0.7757110898961324, "wql": 0.2951096369992216}}, {"config_id": "bitbrains_rnd__H__short", "leaderboard_key": "bitbrains_rnd/H/short", "dataset": "bitbrains_rnd/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 2, "n_instances": 180, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 3.0096275310538014, "wql": 0.7518463657852327, "wsql_by_level": [0.38281130738336255, 0.6003541475766203, 0.7589626924917248, 0.8618057853404499, 0.9208951307196822, 0.9411039272231803, 0.9095647235282212, 0.8086026286770345, 0.5825169491268176], "n_valid_labels": 17280, "n_masked_labels": 0, "mae_median": 286.53255175107023, "n_mase_elements": 16320, "n_seasonal_error_zero": 6, "n_seasonal_error_nan": 14}, "relative": {"mase": 0.7775211881304942, "wql": 0.7617587014570445}}, {"config_id": "bizitobs_application__S__short", "leaderboard_key": "bizitobs_application/10S/short", "dataset": "bizitobs_application", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7318707225660919, "wql": 0.011281935885806905, "wsql_by_level": [0.008002952977089394, 0.012216445889839864, 0.014686335829542527, 0.015516230895705337, 0.015197434804566525, 0.013521153057479978, 0.01107071802032153, 0.007616451470211374, 0.0037097000275056217], "n_valid_labels": 120, "n_masked_labels": 0, "mae_median": 273.68488483428956, "n_mase_elements": 120, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8909428002602146, "wql": 0.7847250474451015}}, {"config_id": "bizitobs_application__S__medium", "leaderboard_key": "bizitobs_application/10S/medium", "dataset": "bizitobs_application", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.6319621067448185, "wql": 0.010551142170748325, "wsql_by_level": [0.008911790600579, 0.011083299612751915, 0.011366365425819949, 0.01110912057453741, 0.011002333712473809, 0.01097793218961999, 0.011199751093972607, 0.0109601698426615, 0.008349516484318753], "n_valid_labels": 1200, "n_masked_labels": 0, "mae_median": 263.9901331138611, "n_mase_elements": 1200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7743391009935632, "wql": 0.7965834991628736}}, {"config_id": "bizitobs_application__S__long", "leaderboard_key": "bizitobs_application/10S/long", "dataset": "bizitobs_application", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.5720653459306403, "wql": 0.012138446231322628, "wsql_by_level": [0.008623859466472211, 0.009611433300550209, 0.009459482680717134, 0.01004388243342679, 0.012582167540513662, 0.015076849738837201, 0.01661950834678241, 0.0158053799855722, 0.011423452589031817], "n_valid_labels": 1800, "n_masked_labels": 0, "mae_median": 299.4340139155918, "n_mase_elements": 1800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.9567305254553605, "wql": 0.8227330180228468}}, {"config_id": "bizitobs_service__S__short", "leaderboard_key": "bizitobs_service/10S/short", "dataset": "bizitobs_service", "term": "short", "freq": "10S", "prediction_length": 60, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7324628601848132, "wql": 0.012468266168907526, "wsql_by_level": [0.008215030129070992, 0.012485755828051727, 0.014889145286160158, 0.016000871359545917, 0.016105768183720788, 0.015278630292856189, 0.013275651753476963, 0.010118624988524415, 0.005844917698760588], "n_valid_labels": 2520, "n_masked_labels": 0, "mae_median": 16.491911796350326, "n_mase_elements": 2520, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.7696556880179742, "wql": 0.503318066478902}}, {"config_id": "bizitobs_service__S__medium", "leaderboard_key": "bizitobs_service/10S/medium", "dataset": "bizitobs_service", "term": "medium", "freq": "10S", "prediction_length": 600, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.7984312321992689, "wql": 0.011001039924959608, "wsql_by_level": [0.007518777611379767, 0.010577598061715378, 0.012318945521906922, 0.013262129629493939, 0.013534719675842093, 0.013194749673509063, 0.01211883979469059, 0.01007703901860633, 0.006406560337492398], "n_valid_labels": 25200, "n_masked_labels": 0, "mae_median": 17.09932730270047, "n_mase_elements": 25200, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8673632301139702, "wql": 0.45992525896546305}}, {"config_id": "bizitobs_service__S__long", "leaderboard_key": "bizitobs_service/10S/long", "dataset": "bizitobs_service", "term": "long", "freq": "10S", "prediction_length": 900, "seasonality": 360, "n_variates": 2, "n_instances": 21, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.646613369495283, "wql": 0.010402683917260002, "wsql_by_level": [0.0062267995817844955, 0.008538692518941748, 0.010108725971076577, 0.011376764214893436, 0.012436127694055487, 0.013155873427271378, 0.012787249144287667, 0.011013426596545082, 0.007980496106484125], "n_valid_labels": 37800, "n_masked_labels": 0, "mae_median": 15.606604814255048, "n_mase_elements": 37800, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8002403081371326, "wql": 0.3728878713837755}}, {"config_id": "bizitobs_l2c__T__short", "leaderboard_key": "bizitobs_l2c/5T/short", "dataset": "bizitobs_l2c/5T", "term": "short", "freq": "5T", "prediction_length": 48, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.28996107175004043, "wql": 0.08935709313411225, "wsql_by_level": [0.03476836707761851, 0.05700713165647231, 0.0733345462727266, 0.08690633538697647, 0.10064485729347158, 0.11181830219704957, 0.11767262198806329, 0.11786800047570861, 0.10419367585892322], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 2.548459583804721, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3641853237606104, "wql": 0.4278913576057856}}, {"config_id": "bizitobs_l2c__T__medium", "leaderboard_key": "bizitobs_l2c/5T/medium", "dataset": "bizitobs_l2c/5T", "term": "medium", "freq": "5T", "prediction_length": 480, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.4321503031836867, "wql": 0.18432258806548052, "wsql_by_level": [0.09018466538428084, 0.14253605337405711, 0.18038778677145245, 0.20804248017819088, 0.22944895995378836, 0.2356383014527587, 0.22753973179059417, 0.19975734445073456, 0.1453679692334674], "n_valid_labels": 3360, "n_masked_labels": 0, "mae_median": 4.786018498880523, "n_mase_elements": 3360, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.8225710682193722, "wql": 0.7122892501188703}}, {"config_id": "bizitobs_l2c__T__long", "leaderboard_key": "bizitobs_l2c/5T/long", "dataset": "bizitobs_l2c/5T", "term": "long", "freq": "5T", "prediction_length": 720, "seasonality": 288, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.699228756292291, "wql": 0.34073021038707835, "wsql_by_level": [0.1277722036256575, 0.22579297019476952, 0.31174281595824704, 0.37821302407612, 0.4231092894326387, 0.45462519155466463, 0.4514393600779259, 0.4146039750481884, 0.27927306351549336], "n_valid_labels": 5040, "n_masked_labels": 0, "mae_median": 6.934133305663746, "n_mase_elements": 5040, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.4479447069213554, "wql": 0.4461418940946688}}, {"config_id": "bizitobs_l2c__H__short", "leaderboard_key": "bizitobs_l2c/H/short", "dataset": "bizitobs_l2c/H", "term": "short", "freq": "H", "prediction_length": 48, "seasonality": 24, "n_variates": 7, "n_instances": 1, "domain": "Web/CloudOps", "n_cohorts": 1, "metrics": {"mase": 0.47224914020222897, "wql": 0.182787381279163, "wsql_by_level": [0.1240704270771492, 0.20018397060257917, 0.2164037952932672, 0.22330980998235528, 0.21512922606792495, 0.20148822613798775, 0.18792831045147373, 0.1614166682162592, 0.11515599768347046], "n_valid_labels": 336, "n_masked_labels": 0, "mae_median": 4.900850257703236, "n_mase_elements": 336, "n_seasonal_error_zero": 0, "n_seasonal_error_nan": 0}, "relative": {"mase": 0.3716596580112479, "wql": 0.47618212083808953}}], "cpu_seconds": 1.03408993803896, "members": ["/workspace/research/backcast3_evals/weekly_slow_ar_delta3k", "/workspace/research/backcast3_evals/patch8_ema6000", "/workspace/research/backcast3_evals/split_patch_ema12000"], "member_checkpoint_hashes": ["094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe"], "weights": [0.3333333333333333, 0.3333333333333333, 0.3333333333333333], "selection_only": true, "cutoff": "valid_backcast3", "E102skill": 0.38962589808404846, "difference": -6.989045150118667e-05} +Main+0.000560751 and firstearlier+0.000432658; secondearlier-0.000137495 and thirdearlier-0.000069890. Mixed cutoff evidence, positive average diagnostic gain; select this one fixed candidate for full public replay and relocation/composition checks. No coefficient sweep. Publish only if fullscore exceeds E102 and all replay checks pass; do not claim held-out significance. +E107 audits passed before launch. CPU seed503:1.633014seconds; independent float64 NumPy feature reference, per-cycle-offset invariance, sampler byte identity, inherited parameters and CPU forward outputs bitwise preserved. Added49,184zero-initialized parameters,total36,849,984. Initialcheckpoint SHA470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b. GPU seed509: initial BF16 outputs bitwise identical; maxB64/C4096/H1024 paired objective0.314552695 and finite gradients; new query/head gradient norms0.00467448/0.01857908,headbias0.00118291. Peakreserved6290MiB/allocated5785.632MiB including EMA and Adam placeholders. Check wall45.549493seconds includes waiting on global evaluation lock;0optimizerupdates/no validationread. Model embeds its helper function directly, so generic standalone/ensemble publishers need no extra runtime module. Queued after E105queue12006; unchanged control stream and full-model optimizer. + +## E108 complete eligible-series corpus packing — resource preparation, no model training +Hypothesis for later data scaling: repeated training on the first approximately1B or5.35B packed points may limit fresh larger models even with fixed source balancing. Prepare every allowed series of length>=16 whose deterministic crop has a finite observation, using the already audited stratified_corpus/pack.py with a nonbinding1e12per-directory pointcap. Preserve the exact shuffled global series order, min length16, maximum deterministic crop131072, row-specific frequency, and95allowlisted directories. This extends packed_stratified_large as an exact prefix; it does not imply retaining every observation of series longer than131072. Use2CPUworkers, no GPU/model optimization. Audit every directory's exact binary/record prefix against the5.35Bpoint pack, independent Arrow replays, and bitwise original source probabilities before any training. No data downloads, no validation reads. Any fresh-model training recipe will be declared separately after current E94/E101 evidence. + +## Training exposure diagnostic for fresh capacity +Allowed-corpus/local-generator audit seed521,20480windows,3.303616CPU seconds,0optimizerupdates/no validationread. Meanfinite context1599.5786,target444.9583,total2044.537points per sampled row. Thus fresh96k/B48 presents approximately9.421Bfinite observations over4.608Mrows before sign duplication, including resampled/overlapping windows and synthetic values. Published E102ancestry contains22.848Msampled rows when taking each unique trained-run maximum; this includes subtracted-control branches and is compute invested, not an equivalent single-model trajectory. Complete per-run audit training_exposure_audit.json. Fresh146M currently has substantially less training exposure than the mature lineage; early capacity comparisons should not be interpreted as a scaling limit. Full eligible-series pack E108 is preparation for later longer training; no new training recipe selected by this audit alone. + +## E104 weekly matched-delta ensemble full public replay +- Checkpoint SHA-256: `1669bc65e42eaf879ed99fab670b8c12a950c4245c341a6f0bd8354c8494a2b8`. +- Evaluation: 97 configurations, 151170 instances, 0 failed configurations; not separately timed seconds. +- Overall skill 0.381736; relative MASE 0.738984; relative WQL 0.517264. +- term skill: long=0.4005, medium=0.4074, short=0.3642. +- domain skill: Econ/Fin=0.1238, Energy=0.2398, Healthcare=0.4894, Nature=0.4421, Sales=0.3581, Transport=0.4683, Web/CloudOps=0.4962. +- frequency skill: A=0.2968, D=0.3688, H=0.3955, M=0.1458, Q=0.1868, S=0.4250, T=0.4377, W=0.2400. +- variates skill: multivariate=0.3951, univariate=0.3709. +- Outcome: Fixed equal1/3 ensemble E104weekly correction/E71patch8_6000/E93splitpatch_12000. Full skill0.381736117455058 exceeds E102full0.38116304998662165 by0.00057306746843635. RelativeMASE0.7389844981008465 and WQL0.517264204380349 both improve;97configurations/151170instances/0failures,inference358.357500shared-H100 seconds. Two of four diagnostic cutoffs improve and two slightly decline; fullscore supports selecting this candidate after independent component/composition checks. No held-out reward or significance claim. + +E105 nested corpus volume seed197 training started at 2026-10-23T05:42:47Z, after the preceding trainer exited with its final checkpoint. Settings are unchanged from the declared comparison. + +## E99 early cooldown final36000 +- Checkpoint SHA-256: `b985ce73ed119243ef51e5f0579bc43633419ce375eb7ce2fad7d1a1103acb51`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 26.4186589717865 seconds. +- Overall skill 0.363307; relative MASE 0.758030; relative WQL 0.534779. +- term skill: long=0.3893, medium=0.3898, short=0.3425. +- domain skill: Econ/Fin=0.1268, Energy=0.2221, Healthcare=0.4006, Nature=0.4132, Sales=0.3453, Transport=0.4557, Web/CloudOps=0.4925. +- frequency skill: A=0.3909, D=0.3370, H=0.3814, M=0.1134, Q=0.1976, S=0.4152, T=0.4195, W=0.2100. +- variates skill: multivariate=0.3805, univariate=0.3493. +- Outcome: Final0.363306598 trails original E79at36000 0.364859034 by0.001552437. The30k gain did not persist. Declared cooldown branch complete; no schedule replacement and no standalone publication. Exact24000state restored, same seed307/B48; only learning-rate schedule differs. + +## E79 fresh146M original schedule at24000 +- Checkpoint SHA-256: `e03ce08a9c1c357bce9d0aca3871c8817627cc660d16706cd85fddba9b5fe5eb`. +- Evaluation: 97 configurations, 9473 instances, 0 failed configurations; 34.343666791915894 seconds. +- Overall skill 0.354494; relative MASE 0.763098; relative WQL 0.546035. +- term skill: long=0.3782, medium=0.3903, short=0.3308. +- domain skill: Econ/Fin=0.1204, Energy=0.2113, Healthcare=0.3859, Nature=0.4116, Sales=0.3203, Transport=0.4432, Web/CloudOps=0.4876. +- frequency skill: A=0.3886, D=0.3283, H=0.3717, M=0.0151, Q=0.1916, S=0.4207, T=0.4085, W=0.2469. +- variates skill: multivariate=0.3720, univariate=0.3402. +- Outcome: Skill0.354493848 improves on16000 0.349499286 but trails matched37M24000 0.357901602. Continue declared schedule; await halfLR at matched checkpoints. All own random initialization, seed307/B48/LR2e-4. + +E104 final replay suite passed in438.071371wall seconds including lock waits. Relocated examples bitwise identical,finite/ordered,31.678684seconds. Public inference358.357500seconds. Independently replayed changed first member and orderedfloat32 component average match allthree complete actual configurations exactly; receipts weekly_slow_ar_composition_replay.json and weekly_slow_ensemble_composition_checks.json. Descriptor1669bc65e42eaf879ed99fab670b8c12a950c4245c341a6f0bd8354c8494a2b8,110,068,216parameters. Selected for atomic publication over E102. Descriptive comparison: {"improved_configs": 42, "dataset_cluster_delta_percentiles": {"p025": -0.00031799803137674555, "p50": 0.0005000199376024583, "p975": 0.002059979380489236}, "bootstrap_seed": 317, "bootstrap_samples": 5000}. No held-out significance claim; two earlier diagnostic cutoffs have small regressions. E101teacher stays frozen E96. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/README.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a3b10145aa18aa229fb289754b8c28c80f70ee8b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/README.md @@ -0,0 +1,9 @@ +# Three-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains three locally trained models totaling 110,068,216 parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed equal weights of 1/3 each. + +The three members use up to 4,096 history observations. Their history/forecast patch sizes are 16/16, 8/8, 8/4, in member order. Each member retains its own original model implementation and normalization; the first has a float64 fallback for nonfinite float32 context statistics. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary uses a fixed width of 128 observations. The zero projection threshold is 0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/config.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/config.json new file mode 100644 index 0000000000000000000000000000000000000000..23638743de98cd9290d9daf7c755f753b7afca33 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/config.json @@ -0,0 +1,65 @@ +{ + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", + "parameters": 36800800, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + }, + { + "weights": "member2.pt", + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "parameters": 36601928, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "model_code": "model2.py" + } + ], + "weights": [ + 0.3333333333333333, + 0.3333333333333333, + 0.3333333333333333 + ], + "composition": "mean after each member applies its fixed inference rules" +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/continuity.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/continuity.py new file mode 100644 index 0000000000000000000000000000000000000000..bebb06b9c20f322b9d5564650889e2236ae94494 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/continuity.py @@ -0,0 +1,18 @@ +"""Fixed continuity prior for histories whose adjacent samples change slowly.""" +import numpy as np + +def apply_continuity(ctx,quant,tau=24.): + b,_,h=quant.shape + bias=np.zeros(b,np.float32) + positive=((ctx>=0)|~np.isfinite(ctx)).all(-1) + for i in range(b): + x=ctx[i,-512:].astype(np.float64) + if len(x)<8 or not np.isfinite(x[-1]):continue + diff=np.diff(x) + if np.isfinite(diff).sum()<8 or not np.isfinite(diff[-8:]).any():continue + ratio=np.nanmean(diff*diff)/(np.nanvar(x)+1e-12) + weight=float(np.clip(1-ratio/.5,0,.95)) + bias[i]=weight*(x[-1]+np.nanmedian(diff[-8:])-quant[i,4,0]) + out=quant+bias[:,None,None]*np.exp(-np.arange(h)/tau)[None,None,:] + out=np.where(positive[:,None,None],np.maximum(0,out),out) + return out.astype(np.float32) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model0.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model0.py new file mode 100644 index 0000000000000000000000000000000000000000..014b585df72cc69852a8eedf302320b52fe55aad --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model0.py @@ -0,0 +1,216 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model1.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model1.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model1.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model2.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model2.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model2.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..e49a7676f3e609bcbab9471493bb7bedf8153bc5 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/model_manifest.json @@ -0,0 +1,899 @@ +{ + "name": "direct-seasonal-three-patch-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 110068216, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/AR/intermittent/changepoint generator at weekly periods52,1, replacing a Bernoulli1/11 share of the original synthetic rows with unchanged total synthetic fraction; independent seed 1000200", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404" + ], + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", + "parameters": 36800800, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + }, + { + "weights": "member2.pt", + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "parameters": 36601928, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "model_code": "model2.py" + } + ], + "checkpoint_sha256": "1669bc65e42eaf879ed99fab670b8c12a950c4245c341a6f0bd8354c8494a2b8", + "checkpoint_digest_method": "SHA-256 of config.json, including ordered member weight hashes", + "training_lineage": [ + { + "checkpoint": "weekly_slow_ar_delta3k.pt", + "sha256": "094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema003000.pt": "a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305", + "/workspace/research/runs/overflow_control/ema003000.pt": "2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12" + }, + "seconds": 1.3925756399985403 + }, + "parents": [ + "postloss_slow_ar_delta6k.pt", + "runs/weekly_synth/ema003000.pt", + "runs/overflow_control/ema003000.pt" + ] + }, + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/weekly_synth/ema003000.pt", + "sha256": "a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "weekly_synthetic_seed": 1000200, + "weekly_replacement_probability": 0.09090909090909091, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema003000.pt", + "sha256": "2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + } + ], + "ensemble_weights": [ + 0.3333333333333333, + 0.3333333333333333, + 0.3333333333333333 + ], + "every_member_forecasts_every_instance": true, + "postprocessing_order": "each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4; then equal quantile average", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "model2.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "model0.py": "d4b76fb1a63789e091b114dd947abe30be3e47c2e2e9d41cecb3e3353af86ac5", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "predict.py": "2bc3f083ff5b866f0e95bd24f51c0f72dbfbbd37de2ee7f73be5f814260b2e5f", + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "model1.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e" + }, + "notes": "All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation." +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..6926069805f1b7d22bf3040445315bf6820e0fb1 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/predict.py @@ -0,0 +1,68 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import importlib.util +from seasonal import apply_gate +from continuity import apply_continuity +from zero_mass import project +import ts_io + +def load_model(checkpoint,device='cuda'): + from types import SimpleNamespace + path=Path(checkpoint);descriptor=json.loads(path.read_text());members=[] + for entry in descriptor['members']: + ck=torch.load(path.parent/entry['weights'],map_location='cpu',weights_only=False) + spec=importlib.util.spec_from_file_location('member_model_'+str(len(members)),path.parent/entry['model_code']) + module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) + model=module.DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval();members.append(model) + assert len(members)==3 + return SimpleNamespace(models=members,max_context=max(m.max_context for m in members)) + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + forecasts=[] + for member in model.models: + member_ctx=ctx[:,-member.max_context:] + member_x=x[:,-member.max_context:] + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16): + qq,mu,scale=member(torch.cat((member_x,-member_x),0),p.repeat(2,1),h) + qq=qq*scale[:,:,None]+mu[:,:,None] + qq=(qq[:len(ids)]-qq[len(ids):].flip(-1))*.5 + recent=member_x[:,-4096:] + positive=((recent>=0)|~torch.isfinite(recent)).all(-1) + qq=torch.where(positive[:,None,None],qq.clamp(min=0),qq) + q=qq.transpose(1,2).float().cpu().numpy() + q=apply_gate(member_ctx[:,-4096:],p.cpu().numpy(),q) + q=project(member_ctx,apply_continuity(member_ctx,q)) + forecasts.append(q) + q=(forecasts[0]+forecasts[1]+forecasts[2])/3 + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'config.json'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..5fef17c22b0601b9e2a4a1ffae364e89e46f0011 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/model_manifest.json @@ -0,0 +1,781 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36800800, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/AR/intermittent/changepoint generator at weekly periods52,1, replacing a Bernoulli1/11 share of the original synthetic rows with unchanged total synthetic fraction; independent seed 1000200", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "weights_sha256": "094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "weekly_slow_ar_delta3k.pt", + "sha256": "094c7c694406075967f392a0d9ac1146bac984a90ab468c59d660a1b92fa7ba2", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema003000.pt": "a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305", + "/workspace/research/runs/overflow_control/ema003000.pt": "2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12" + }, + "seconds": 1.3925756399985403 + }, + "parents": [ + "postloss_slow_ar_delta6k.pt", + "runs/weekly_synth/ema003000.pt", + "runs/overflow_control/ema003000.pt" + ] + }, + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/weekly_synth/ema003000.pt", + "sha256": "a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "weekly_synthetic_seed": 1000200, + "weekly_replacement_probability": 0.09090909090909091, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema003000.pt", + "sha256": "2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "model.py": "d4b76fb1a63789e091b114dd947abe30be3e47c2e2e9d41cecb3e3353af86ac5", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef" + }, + "checkpoint_composition": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema003000.pt": "a5619c3da9cb9049d92c9582e7fd74dea3e3d474bf5cf8499522e739cd202305", + "/workspace/research/runs/overflow_control/ema003000.pt": "2084f1888f8d9e5afe2c740769ea2b4167086cdd62dfb4014bc3a338c00d4c12" + }, + "seconds": 1.3925756399985403 + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 32768, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..95410ba700e638fc2e1375b14dece4df57c10110 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=np.exp(-10**(-r.uniform(0,4)));noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/train.py new file mode 100644 index 0000000000000000000000000000000000000000..61de733eea03837247278d9010c2ed8b955d7359 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/long_memory_synth/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + a.synthetic_ar_time_constants=[1,10000] + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/overflow_control/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/overflow_control/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/overflow_control/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/overflow_control/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/overflow_control/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/overflow_control/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/model.py new file mode 100644 index 0000000000000000000000000000000000000000..014b585df72cc69852a8eedf302320b52fe55aad --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/model.py @@ -0,0 +1,216 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/torch_post.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/torch_post.py new file mode 100644 index 0000000000000000000000000000000000000000..e19586bcc1677d56cedb6ce02c2f57797157f5f3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/postloss/torch_post.py @@ -0,0 +1,112 @@ +"""Differentiable forecast transforms with the package's fixed context rules. + +Context statistics are constants with respect to model parameters. Gradients +flow only through the forecast, including the continuity correction's anchor. +""" +import torch + + +@torch.no_grad() +def context_statistics(ctx, periods, horizon): + x=ctx.double(); finite=torch.isfinite(x); clean=torch.where(finite,x,0.) + b,c=x.shape; device=x.device + pos=torch.arange(c,device=device)[None,:] + count=finite.sum(-1).clamp(min=1) + mean=clean.sum(-1)/count + variance=(torch.where(finite,x-mean[:,None],0.).square()).sum(-1)/count + positive=((x>=0)|~finite).all(-1) + zeros=((x==0)&finite).sum(-1) + zero_active=positive&(zeros>=4)&(zeros/count>=.1) + cutoff=torch.where(zero_active,.4*variance.sqrt(),0.) + first=torch.where(finite,pos,c).min(-1).values + length=c-first + phase=torch.arange(max(1,c//3),device=device)[None,:] + future=torch.arange(horizon,device=device)[None,:] + z=torch.tensor([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0, + .2533471031,.5244005127,.8416212336,1.2815515655],device=device) + best_weight=torch.zeros(b,device=device,dtype=torch.float64) + prior=torch.zeros(b,horizon,9,device=device,dtype=torch.float64) + prior_valid=torch.zeros(b,horizon,device=device,dtype=torch.bool) + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + cycles=(length[:,None]//p).clamp(max=8) + history=finite&(pos>=c-cycles*p) + n=history.sum(-1).clamp(min=1) + center=(clean*history).sum(-1)/n + var=torch.where(history,x-center[:,None],0.).square().sum(-1)/n + previous=pos-p;safe=previous.clamp(min=0) + pairs=(previous>=c-cycles*p)&(previous>=0)&finite&finite.gather(1,safe) + pairs_count=pairs.sum(-1) + difference=clean-clean.gather(1,safe) + mse=(difference.square()*pairs).sum(-1)/pairs_count.clamp(min=1) + weight=(1-mse/(var+1e-12)/.25).clamp(0,.98) + eligible=(p[:,0]>=2)&(cycles[:,0]>=3)&(pairs_count>=p[:,0]) + weight=torch.where(eligible,weight,0.) + values=[];observed=[] + for cycle in range(4): + idx=c-p+phase-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(phase=0)&(cycle0 + template=(values*observed).sum(0)/nphase.clamp(min=1) + ntemplate=phase_valid.sum(-1).clamp(min=1) + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent=finite&(pos>=c-p) + nr=recent.sum(-1).clamp(min=1) + recent_mean=(clean*recent).sum(-1)/nr + template=template+(recent_mean-template_mean)[:,None] + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent_var=torch.where(recent,x-recent_mean[:,None],0.).square().sum(-1)/nr + template_var=((template-template_mean[:,None]).square()*phase_valid).sum(-1)/ntemplate + used_cycles=cycles[:,0].clamp(min=1,max=4) + noise=mse/2 + target_var=(recent_var-noise).clamp(min=0) + base_var=(template_var-noise/used_cycles).clamp(min=0) + ratio=(target_var/base_var.clamp(min=1e-12)).sqrt().clamp(.5,2.) + align=nr>=torch.maximum(torch.full_like(nr,2),.75*p[:,0]) + ratio=torch.where(align,ratio,1.) + template=template_mean[:,None]+(template-template_mean[:,None])*ratio[:,None] + sigma=(noise*(1+1/used_cycles)).sqrt() + index=(future%p).clamp(max=phase.shape[-1]-1) + selected=template.gather(1,index) + valid=phase_valid.gather(1,index) + q=selected[:,:,None]+sigma[:,None,None]*z[None,None,:] + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + choose=weight>best_weight + prior=torch.where(choose[:,None,None],q,prior) + prior_valid=torch.where(choose[:,None],valid,prior_valid) + best_weight=torch.maximum(best_weight,weight) + seasonal_weight=best_weight[:,None]*prior_valid + + recent=x[:,-512:];seen=torch.isfinite(recent) + n=seen.sum(-1).clamp(min=1);clean_recent=torch.where(seen,recent,0.) + center=clean_recent.sum(-1)/n + var=torch.where(seen,recent-center[:,None],0.).square().sum(-1)/n + differences=recent[:,1:]-recent[:,:-1] + diff_seen=torch.isfinite(differences);nd=diff_seen.sum(-1) + mse=torch.where(diff_seen,differences,0.).square().sum(-1)/nd.clamp(min=1) + tail=differences[:,-8:] + tail_seen=torch.isfinite(tail);nt=tail_seen.sum(-1) + sorted_tail=torch.where(tail_seen,tail,float('inf')).sort(-1).values + if tail.shape[-1]: + lo=((nt-1).clamp(min=0)//2)[:,None];hi=(nt//2).clamp(max=tail.shape[-1]-1)[:,None] + median=(sorted_tail.gather(1,lo)+sorted_tail.gather(1,hi))[:,0]/2 + else:median=torch.zeros(b,device=device,dtype=x.dtype) + continuity_weight=(1-mse/(var+1e-12)/.5).clamp(0,.95) + active=(nd>=8)&(nt>0)&seen[:,-1] + continuity_weight=torch.where(active,continuity_weight,0.) + anchor=torch.where(active,recent[:,-1]+median,0.) + return seasonal_weight,prior,continuity_weight,anchor,positive,cutoff + + +def apply_fixed(ctx,periods,quant): + """Quantiles are raw-scale tensors of shape (batch,horizon,9).""" + weight,prior,cweight,anchor,positive,cutoff=context_statistics(ctx,periods,quant.shape[1]) + q=torch.where(positive[:,None,None],quant.clamp(min=0),quant) + q=((1-weight[:,:,None])*q+weight[:,:,None]*prior).float() + bias=(cweight*(anchor-q[:,0,4])).float() + decay=torch.exp(-torch.arange(q.shape[1],device=q.device,dtype=torch.float64)/24) + q=(q.double()+bias[:,None,None]*decay[None,:,None]).float() + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return torch.where((q>=0)&(q8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..dcbbbe7bf2efb54839810aeb432d4c6f420e6142 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/recovery/train.py @@ -0,0 +1,190 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='long_seasonal': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/weekly_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/weekly_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..81f0f018cb212a6e2125543e0d4efa2f31b9d8fb --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/weekly_synth/data.py @@ -0,0 +1,113 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + self.weekly_rng=np.random.default_rng(seed+1000003) + self.weekly_probability=1/11 + def synthetic(self,n,p): + # Always consume the control generator first, preserving its complete RNG stream. + original=super().synthetic(n,p) + if self.weekly_rng.random()>=self.weekly_probability: + return original + original_rng=self.rng + try: + self.rng=self.weekly_rng + result=super().synthetic(n,[52,1]) + finally: + self.rng=original_rng + p[:]=[52,1] + self.last_weekly_rows.append(self._synthetic_row) + return result + + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/weekly_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/weekly_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member0/training/weekly_synth/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9894508a5711da3218d3c11f8e038427757c2270 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/model_manifest.json @@ -0,0 +1,572 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36665488, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 16384, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..59444191c77e10f6bbad7d5a3c54d0c0aca5f55c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member1/training/recovery/train.py @@ -0,0 +1,132 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +a=ap.parse_args();sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='overflow_control':a.normalization_overflow_fallback=True +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':[a.initialize_ema] if a.initialize_ema else []} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=0 and step>a.reset_at else step + lr=a.lr*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/a.steps))) + for group in opt.param_groups:group['lr']=lr*group['lr_multiplier'] + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16): + loss=objective(model,x,y,p,paired=a.loss_mode=='paired') if a.loss_mode else objective(model,x,y,p) + loss.backward();norm=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(norm): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.monotonic()-started,1), + 'lr':lr,'grad_norm':float(norm),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with (out/'log.jsonl').open('a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=(a.stop_file and Path(a.stop_file).exists()) or (a.halt_after and step>=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..6f6d33214074e6d30f01bfd72b918a07caac71a3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/model_manifest.json @@ -0,0 +1,647 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36601928, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404" + ], + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "training_lineage": [ + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 8192, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3b3f245d67e92b6c65f92dabee2e389c9e3dbffc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/recovery/train.py @@ -0,0 +1,175 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':([a.initialize_ema] if a.initialize_ema else [])+(teacher.checkpoints if teacher else [])} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + if selection_checkpoint or step%a.recovery_every==0:save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..9a16c87c0cf45b0efb1b2e56008a821c8391b471 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/convert.py @@ -0,0 +1,13 @@ +"""Convert the already locally trained patch8 model to input8/output4 without external assets.""" +import argparse,hashlib,json,time +from pathlib import Path +import torch +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +torch.set_num_threads(1);started=time.monotonic();ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==8 +x=state['query.0.weight'].reshape(d,8,9);state['query.0.weight']=(x[:,:4]+x[:,4:]).reshape(d,36) +x=state['recency.weight'].reshape(d,8,4);state['recency.weight']=(x[:,:4]+x[:,4:]).reshape(d,16) +state['head.weight']=state['head.weight'].reshape(8,18,d)[:4].reshape(72,d).clone();state['head.bias']=state['head.bias'].reshape(8,18)[:4].reshape(72).clone() +ck['config']['patch']=4;ck['config']['input_patch']=8 +conversion={'method':'retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates','exact_function_preservation':False,'parent_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest()} +ck.update(step=0,args={'packed':ck['args']['packed'],'initialize_from':str(Path(a.input).resolve()),'converted':True},parent_checkpoints=[str(Path(a.input).resolve())],conversion=conversion) +torch.save(ck,a.output);receipt={**conversion,'checkpoint_sha256':hashlib.sha256(Path(a.output).read_bytes()).hexdigest(),'parameters':sum(v.numel() for v in state.values()),'cpu_seconds':time.monotonic()-started,'optimizer_updates':0};Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2));print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/model.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/member2/training/split_patch/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..8579e276dd57a0c103bd91cc0ef918b0314ed7cc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/provenance/publish.py @@ -0,0 +1,103 @@ +"""Assemble and atomically publish a complete three-member, fixed-weight package.""" +import argparse +import ctypes +import hashlib +import json +import os +import shutil +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ap = argparse.ArgumentParser() +ap.add_argument('--member', action='append', required=True) +ap.add_argument('--out', required=True) +ap.add_argument('--report') +ap.add_argument('--experiments', default='/workspace/research/direct_v1/EXPERIMENTS.md') +a = ap.parse_args() +assert len(a.member) == 3 +final = Path(a.out) +stage = final.parent / f'.{final.name}-staging-{os.getpid()}' +shutil.rmtree(stage, ignore_errors=True) +stage.mkdir(parents=True) + +def digest(path): + h = hashlib.sha256() + with Path(path).open('rb') as f: + for block in iter(lambda: f.read(8 * 1024 * 1024), b''): + h.update(block) + return h.hexdigest() + +for name in ('infer.sh', 'predict.py', 'model.py', 'seasonal.py', 'continuity.py', + 'zero_mass.py', 'ts_io.py'): + shutil.copy2(HERE / 'runtime' / name, stage / name) +shutil.copy2('/opt/runtime/requirements.txt', stage / 'requirements.txt') +shutil.copy2(a.experiments, stage / 'EXPERIMENTS.md') +members, sources, lineage = [], set(), {} +for i, source in enumerate(map(Path, a.member)): + manifest = json.loads((source / 'model_manifest.json').read_text()) + assert manifest['pretrained_assets'] == [] + for shared in ['seasonal.py','continuity.py','zero_mass.py']: + assert digest(source/shared)==digest(stage/shared),'Members must retain identical fixed postprocessing rules' + name = f'member{i}.pt' + model_code = f'model{i}.py' + shutil.copy2(source / 'model.py', stage / model_code) + assert digest(stage / model_code) == manifest['runtime_code_sha256']['model.py'] + shutil.copy2(source / 'weights.pt', stage / name) + assert digest(stage / name) == manifest['weights_sha256'] + members.append({'weights': name, 'weights_sha256': manifest['weights_sha256'], + 'parameters': manifest['parameters'], 'config': manifest['config'], 'model_code': model_code}) + sources.update(manifest['sources_used']) + for item in manifest['training_lineage']: + lineage.setdefault(item['sha256'], item) + dst = stage / 'provenance' / f'member{i}' + dst.mkdir(parents=True) + shutil.copy2(source / 'model_manifest.json', dst / 'model_manifest.json') + shutil.copytree(source / 'provenance', dst / 'training') +shutil.copy2(__file__, stage / 'provenance' / 'publish.py') +descriptor = {'members': members, 'weights': [1/3]*3, + 'composition': 'mean after each member applies its fixed inference rules'} +(stage / 'config.json').write_text(json.dumps(descriptor, indent=2) + '\n') +identifier = digest(stage / 'config.json') +manifest = { + 'name': 'direct-seasonal-three-patch-foundation', 'contract': 'timeseries-forecast/v1', + 'parameters': sum(m['parameters'] for m in members), 'pretrained_assets': [], + 'sources_used': sorted(sources), 'members': members, + 'checkpoint_sha256': identifier, + 'checkpoint_digest_method': 'SHA-256 of config.json, including ordered member weight hashes', + 'training_lineage': list(lineage.values()), 'ensemble_weights': [1/3]*3, + 'every_member_forecasts_every_instance': True, + 'postprocessing_order': 'each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4; then equal quantile average', + 'runtime_code_sha256': {p.name: digest(p) for p in stage.iterdir() if p.suffix in ('.py', '.sh')}, + 'notes': 'All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation.', +} +(stage / 'model_manifest.json').write_text(json.dumps(manifest, indent=2) + '\n') +if a.report: + report = json.loads(Path(a.report).read_text()) + assert report['checkpoint_sha256'] == identifier + shutil.copy2(a.report, stage / 'validation_report.json') +else: + report = {'status': 'candidate validation pending'} + (stage / 'validation_report.json').write_text(json.dumps(report) + '\n') +if final.resolve() == Path('/workspace/submission').resolve(): + assert a.report and report['n_configs'] == 97 and report['n_instances'] == 151170 + assert report['n_failed'] == 0 +patch_sizes = ', '.join(str(m['config'].get('input_patch', m['config']['patch'])) + '/' + str(m['config']['patch']) for m in members) +(stage / 'README.md').write_text(f'''# Three-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains three locally trained models totaling {manifest['parameters']:,} parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed equal weights of 1/3 each. + +The three members use up to 4,096 history observations. Their history/forecast patch sizes are {patch_sizes}, in member order. Each member retains its own original model implementation and normalization; the first has a float64 fallback for nonfinite float32 context statistics. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary uses a fixed width of 128 observations. The zero projection threshold is 0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. +''') +if final.exists(): + libc = ctypes.CDLL(None, use_errno=True) + if libc.renameat2(-100, os.fsencode(stage), -100, os.fsencode(final), 2): + raise OSError(ctypes.get_errno(), os.strerror(ctypes.get_errno())) + shutil.rmtree(stage) +else: + os.replace(stage, final) +print(json.dumps({'out': str(final), 'checkpoint_sha256': identifier, + 'parameters': manifest['parameters']})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/requirements.txt b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca733199990e5dc8e6a90509cc691f00ab8e9f5d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/requirements.txt @@ -0,0 +1,12 @@ +# Runtime pins recorded from the contributor's working environment on 2026-09-17 (Python 3.11). +# torch comes from the pytorch/pytorch:2.14.0-cuda12.6-cudnn9-runtime base image (cu130 needs driver >= 580). +torch==2.14.0 +numpy==2.4.6 +h5py==3.16.0 +pandas==2.3.3 +scipy==1.17.1 +pyarrow==25.0.1 +huggingface-hub==0.36.2 +einops==0.8.2 +safetensors==0.8.0 +pytest==9.1.1 diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/seasonal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/seasonal.py new file mode 100644 index 0000000000000000000000000000000000000000..cd8d8ebbf65c59c69f3d1c537e8cd5cb024d0330 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/seasonal.py @@ -0,0 +1,51 @@ +"""A fixed confidence gate for highly repeatable history; no fitted parameters.""" +import numpy as np + +def apply_gate(ctx,periods,quant,threshold=.25,strength=1.,cycles=4,mode='aligned'): + # Each row uses only its own context. Quantile blending preserves ordering. + b,_,h=quant.shape + out=quant.copy() + for i in range(b): + x=ctx[i];valid=np.isfinite(x) + if not valid.any():continue + x=x[np.flatnonzero(valid)[0]:] + best=None + for p in periods[i]: + p=int(p) + if p<2 or len(x)<3*p:continue + k=min(len(x)//p,8);history=x[-k*p:] + pairs=np.isfinite(history[p:])&np.isfinite(history[:-p]) + if pairs.sum()0) + if mode in ('centered','aligned'): + mu=mu+np.nanmean(seasons[-1])-np.nanmean(mu) + if mode=='aligned' and np.isfinite(seasons[-1]).sum()>=max(2,.75*p): + noise=float(np.mean(err.astype(np.float64)**2)/2) + target_var=max(0.,float(np.nanvar(seasons[-1]))-noise) + template_var=max(0.,float(np.nanvar(mu))-noise/min(k,cycles)) + ratio=float(np.clip(np.sqrt(target_var/max(template_var,1e-12)),.5,2.)) + center=float(np.nanmean(mu));mu=center+(mu-center)*ratio + if mode=='exponential': + w=.5**np.arange(len(recent)-1,-1,-1,dtype=np.float32) + den=(w[:,None]*np.isfinite(recent)).sum(0) + mu=np.divide((w[:,None]*np.nan_to_num(recent)).sum(0),den,out=np.full(p,np.nan,np.float32),where=den>0) + # Error of a season relative to the previous one, corrected for averaging. + sigma=float(np.sqrt(np.mean(err.astype(np.float64)**2)/2*(1+1/min(k,cycles)))) + idx=np.arange(h)%p;median=mu[idx] + z=np.array([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0,.2533471031,.5244005127,.8416212336,1.2815515655]) + sq=median[None]+z[:,None]*sigma + sq=np.where(np.isfinite(sq),sq,quant[i]) + if np.nanmin(x)>=0:sq=np.maximum(0,sq) + best=(weight,sq) + if best is not None:out[i]=(1-best[0])*quant[i]+best[0]*best[1] + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..a8d55e7124a6df200e06f19e33dbe7e09e411f38 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.381736117455058, + "skill_score": 0.381736117455058, + "rel_mase_gmean": 0.7389844981008465, + "rel_wql_gmean": 0.517264204380349, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.7384838161854174, + "rel_wql_gmean": 0.48661218647467647 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7044632053574043, + "rel_wql_gmean": 0.4985493912651677 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.7528019863855246, + "rel_wql_gmean": 0.5369731342834664 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.8997299509606314, + "rel_wql_gmean": 0.8533338902051169 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.895784974599937, + "rel_wql_gmean": 0.6450715387325657 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.5362868540205529, + "rel_wql_gmean": 0.4861780365208599 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.8020709848259292, + "rel_wql_gmean": 0.3880890717181704 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8204539375779583, + "rel_wql_gmean": 0.5021381112696105 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.6438281814568623, + "rel_wql_gmean": 0.43912598277923315 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5665319805323127, + "rel_wql_gmean": 0.4480155357192517 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6809641725344189, + "rel_wql_gmean": 0.7261833050360283 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7638379113723957, + "rel_wql_gmean": 0.5215735005208151 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7352581283157367, + "rel_wql_gmean": 0.49700402923094666 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 0.9378541933971584, + "rel_wql_gmean": 0.7779252473213191 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.7960060588549801, + "rel_wql_gmean": 0.8307985337393358 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.6567816041637097, + "rel_wql_gmean": 0.5034677715924216 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.686613943372624, + "rel_wql_gmean": 0.4604665462391711 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.8791116093570265, + "rel_wql_gmean": 0.6569410938538096 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7120936609484017, + "rel_wql_gmean": 0.5139182174219356 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.7611219941619087, + "rel_wql_gmean": 0.5199441748762191 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2215075754762914, + "wql": 0.11330166559764732, + "wsql_by_level": [ + 0.06387044020839809, + 0.09816847013904323, + 0.12010078915913207, + 0.13292366824329413, + 0.13832159081264273, + 0.1384431922135203, + 0.13091050187376777, + 0.11401300950024318, + 0.08296332822878448 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 718.0146730020389, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6809641725344189, + "wql": 0.7261833050360283 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.266373468255667, + "wql": 0.08274677253667398, + "wsql_by_level": [ + 0.04831157518668572, + 0.07331398120177351, + 0.088809587350754, + 0.0978834803724556, + 0.10189922920364156, + 0.10078933346472865, + 0.09449443700561272, + 0.08125537747398943, + 0.057963951570424714 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 580.2437866124267, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7960060588549801, + "wql": 0.8307985337393358 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.99639522457295, + "wql": 0.09253891145748822, + "wsql_by_level": [ + 0.053827506995658414, + 0.08185335721447333, + 0.09957369687903962, + 0.11002005933748205, + 0.11473928580749464, + 0.11346509219766494, + 0.10560739927326554, + 0.09010176143088924, + 0.0636620439814263 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 544.0577826504282, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8057088267330048, + "wql": 0.7854847594172867 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2295960505718586, + "wql": 0.0499797675656577, + "wsql_by_level": [ + 0.025889521079515306, + 0.040354022089176975, + 0.051092068544427646, + 0.05814415046903297, + 0.06239763015469548, + 0.0640175101934378, + 0.06062196939890203, + 0.05176290814869365, + 0.03553812801303744 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 324.77070415988646, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.115527669404877, + "wql": 0.7678899047004556 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.348884260293558, + "wql": 0.022186831493009165, + "wsql_by_level": [ + 0.013873438682101391, + 0.020159518547708904, + 0.024031124143754627, + 0.026297463344753226, + 0.027233171479253238, + 0.026932595083814823, + 0.025065690200515488, + 0.021239953831056407, + 0.014848528124124358 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 174.48968979805827, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0412820419888371, + "wql": 0.9604016838334154 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2844928501466848, + "wql": 0.0380878066187623, + "wsql_by_level": [ + 0.019492587515084432, + 0.032492021206529546, + 0.041416473427492585, + 0.04652959662814684, + 0.048650315598912426, + 0.04805364915212353, + 0.04442559857752201, + 0.03682605144663208, + 0.024903966016417253 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 366.48285629516454, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0456963299903763, + "wql": 1.1047966497567254 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9753407524640808, + "wql": 0.04806633530737341, + "wsql_by_level": [ + 0.030381781325605716, + 0.04618207861120729, + 0.05596768076491137, + 0.06117113756713911, + 0.06246050613553365, + 0.05920287091263299, + 0.051461303794082196, + 0.039622321013478796, + 0.026147337641769575 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 63.444420938418766, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8934290688002793, + "wql": 0.7754055962338503 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9589154669416124, + "wql": 0.08945248880776728, + "wsql_by_level": [ + 0.041684748571238536, + 0.06677316454613144, + 0.08497301215019495, + 0.09913457682720739, + 0.10943635777585427, + 0.11404088466207508, + 0.11183950445065675, + 0.10089319115227002, + 0.07629695913427692 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 78.70895380064856, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.6350460083249556, + "wql": 0.7420818374558202 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.881381070621536, + "wql": 0.08612850293116894, + "wsql_by_level": [ + 0.04020304863429075, + 0.06456785553192237, + 0.08171671460733475, + 0.09409982746275271, + 0.10350847119952872, + 0.10809076735830424, + 0.1073288376983683, + 0.0984291864161167, + 0.07721181747190191 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 74.63441749345903, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8055706233028445, + "wql": 0.8007161491848174 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0304555778193527, + "wql": 0.07446645529345303, + "wsql_by_level": [ + 0.04756485219320747, + 0.06812557197783554, + 0.08216415941893296, + 0.0898129894530066, + 0.09277118794273471, + 0.0911706959463994, + 0.08430637812824136, + 0.06996336258836096, + 0.044318899992358295 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 281.7489298528141, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0449179578041634, + "wql": 1.101066747853461 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9742346852520584, + "wql": 0.078324564419516, + "wsql_by_level": [ + 0.042585833161386234, + 0.06435983182404931, + 0.07797745751652868, + 0.08719019704364568, + 0.09452184505503783, + 0.09734687309271152, + 0.09443846227193858, + 0.08419518536419046, + 0.06230539444615568 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 254.3739736301575, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.7807354303806935, + "wql": 0.6362081929622684 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1936211958247203, + "wql": 0.09164627607673251, + "wsql_by_level": [ + 0.043281085014942905, + 0.06893718328578212, + 0.08722919752792783, + 0.10021429179599162, + 0.10865287155355187, + 0.1125932453875033, + 0.11179457126303369, + 0.10526702513969223, + 0.086847013722167 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 297.7954631124033, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8797976597911146, + "wql": 0.6245110242730161 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4987966921626292, + "wql": 0.06710792566994978, + "wsql_by_level": [ + 0.02905254240724751, + 0.04708312310047368, + 0.06322630731053731, + 0.0748872699974749, + 0.08278418049220682, + 0.08623127925919007, + 0.08447611397135968, + 0.07689321828160262, + 0.05933729620945548 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 5445.47118217818, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.9107535309783451, + "wql": 0.7245997744838494 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4472780632858235, + "wql": 0.06737922543206687, + "wsql_by_level": [ + 0.02662532476065557, + 0.04674032675657382, + 0.06527925202801961, + 0.07712455572136573, + 0.08560334263696678, + 0.0878242113279069, + 0.0849396747020463, + 0.07545740713672515, + 0.056818933818342014 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 36864.05396491467, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0990197378378768, + "wql": 1.0328014952375373 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.01781347502043181, + "wql": 0.42143977766900104, + "wsql_by_level": [ + 0.17504993687835133, + 0.3294048479026965, + 0.42535470871197667, + 0.47927406289283053, + 0.5120761379588328, + 0.5104829060919627, + 0.5115224252725261, + 0.4839584145927364, + 0.36583455871909654 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.04948667653070405, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1120657611865516, + "wql": 0.03477638127025891 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6985151810314955, + "wql": 0.2855006101463456, + "wsql_by_level": [ + 0.2169575653904273, + 0.3172811042774564, + 0.3523149180545522, + 0.35215603486356883, + 0.3379716322295703, + 0.318100703509344, + 0.28609829522194585, + 0.2334167585437219, + 0.15520847922652367 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.6148956313713991, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8384101144161774, + "wql": 0.5052721781327353 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6978424350693991, + "wql": 0.22233494197166248, + "wsql_by_level": [ + 0.166332992574431, + 0.2595059797989555, + 0.29659837268966455, + 0.29931074035142674, + 0.27858571503504526, + 0.24242162336894557, + 0.19627915034004179, + 0.1502371646644031, + 0.11174273892204904 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.6368925869296436, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.32577257090458905, + "wql": 0.24615579268877133 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8617467091885954, + "wql": 0.3293434646453593, + "wsql_by_level": [ + 0.21653214324107156, + 0.3608860084185891, + 0.4238913877404794, + 0.4319325450630538, + 0.4078626713071489, + 0.3677051265706955, + 0.31726362737950115, + 0.25946595473130807, + 0.1785517173563864 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 11.249563878051452, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8153283079097247, + "wql": 0.546812071142352 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2022744177567275, + "wql": 0.4450076691075868, + "wsql_by_level": [ + 0.45330812773553775, + 0.5680630656352184, + 0.5907064246201226, + 0.5694126752918893, + 0.523723531935585, + 0.46059598495992393, + 0.38173554779181534, + 0.28563632923846516, + 0.1718873347597239 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 15.694438455592719, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8723069938406994, + "wql": 0.45972699007357887 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0399757532265896, + "wql": 0.3554566364255842, + "wsql_by_level": [ + 0.4236411108275793, + 0.4641399602000191, + 0.4632445721303884, + 0.44104649567727083, + 0.40539762952064134, + 0.35730628180110435, + 0.2962660494071995, + 0.2203389636641255, + 0.12772866460192975 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.666343091270907, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9698189740538452, + "wql": 0.3937320083199028 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1393415951992427, + "wql": 0.28779881110159267, + "wsql_by_level": [ + 0.246847555738178, + 0.35144868180361505, + 0.3848117555811675, + 0.3828138817256278, + 0.3563405183132376, + 0.3142248147378668, + 0.25713374018742813, + 0.18831075367532824, + 0.1082575981518845 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 288.3019393257271, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9762506655223895, + "wql": 0.6104917515406019 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0268852032580833, + "wql": 0.12052706700107489, + "wsql_by_level": [ + 0.05818950699285998, + 0.11595881963990586, + 0.14642893441175975, + 0.15527060942685042, + 0.15356069013241036, + 0.14427571098979933, + 0.12882774565443475, + 0.1071060410364652, + 0.0751255447251884 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 942.9758961252923, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0188790216573897, + "wql": 0.8676660533162098 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7958559882046659, + "wql": 0.05508592739896546, + "wsql_by_level": [ + 0.030053196411705903, + 0.046746339341199636, + 0.05777613563373036, + 0.06549351572981553, + 0.06951329244344669, + 0.06893303779396552, + 0.06428926194091213, + 0.054597557052614744, + 0.03837101024329857 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 19.29975691470101, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8532974921216172, + "wql": 0.868957690990023 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 43.07227517062501, + "wql": 0.0753154794925132, + "wsql_by_level": [ + 0.06523837905236822, + 0.09345339312376463, + 0.10770978502279678, + 0.10347900985501256, + 0.0860448207915064, + 0.05314574486812491, + 0.04403631744878412, + 0.05850696181581408, + 0.06622490345444713 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 174.80499184996563, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8519801663022855, + "wql": 0.600167776493978 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4683471073212719, + "wql": 0.02690163787960409, + "wsql_by_level": [ + 0.012519404448211847, + 0.018547585448283086, + 0.024551840767867615, + 0.02741222552467023, + 0.030394372626209108, + 0.03538051003031574, + 0.037291790440225105, + 0.03347683644816188, + 0.022540175182492208 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 309.30022786458335, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.2011708799119241, + "wql": 0.20603760414131309 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.2632496713784672, + "wql": 0.007624636894155283, + "wsql_by_level": [ + 0.005740636266914142, + 0.00669562959867952, + 0.006415264111996609, + 0.007365210476773466, + 0.007865769392696903, + 0.007709336643382707, + 0.009020174329738895, + 0.009829421143081944, + 0.007980290084133368 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 2469.2708333333335, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8707902315739978, + "wql": 0.686792676525858 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3439668302592565, + "wql": 0.015538928857283843, + "wsql_by_level": [ + 0.008149730706929493, + 0.015485149708547646, + 0.018908646300848733, + 0.01980101172362688, + 0.019660444668581117, + 0.0187701796519375, + 0.016784749749211507, + 0.013938410631079623, + 0.0083520365747921 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 1462.5478515625, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3483189786698818, + "wql": 0.3680723759322161 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2379394826019117, + "wql": 0.32258585175584387, + "wsql_by_level": [ + 0.15009877492359122, + 0.2699071963054936, + 0.36480964084176287, + 0.429573899167784, + 0.45823803356515874, + 0.42717553516290857, + 0.3351583385200374, + 0.2215160947494623, + 0.24679515256639606 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 14.235928344726563, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8305675631954952, + "wql": 0.5953264411491401 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.447265017966201, + "wql": 0.2307741278381414, + "wsql_by_level": [ + 0.11948748410211966, + 0.20558068850434347, + 0.25366673650790045, + 0.2711589268222958, + 0.2666016298699337, + 0.25080164410889916, + 0.2536812298869933, + 0.2631835026219238, + 0.19280530811886343 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 7.753377676010132, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.346044379035233, + "wql": 0.882496776385616 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7330330272586232, + "wql": 0.24147546142758547, + "wsql_by_level": [ + 0.10751263398587159, + 0.18331227585741458, + 0.2502510695301909, + 0.3133840201557028, + 0.3592666151397, + 0.36245011569972874, + 0.2884292388494765, + 0.13843016727866211, + 0.1702430163515221 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.785351753234863, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2892549439821193, + "wql": 0.4028557997401655 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.124279932043286, + "wql": 0.5288851760090116, + "wsql_by_level": [ + 0.1808857075024463, + 0.3406244044679828, + 0.4775659264451774, + 0.587727135688091, + 0.6651640305236486, + 0.7074312662691167, + 0.7040639609458319, + 0.6341461409692357, + 0.4623580112695743 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.682878002940674, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6454373622760391, + "wql": 0.4811620053667908 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5392779791383235, + "wql": 0.38364625465416163, + "wsql_by_level": [ + 0.15001728713238957, + 0.2533619116294346, + 0.3435846823790059, + 0.4214782777970886, + 0.4786313295468418, + 0.5033029632321998, + 0.49944027125003176, + 0.4608059529927861, + 0.3421936159276762 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.302013044627396, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7917485823743414, + "wql": 0.6122521062220176 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.927154492102201, + "wql": 0.46083608871278003, + "wsql_by_level": [ + 0.18018491486803845, + 0.33065460988260664, + 0.4518392345465937, + 0.5427981653166628, + 0.5990427776563487, + 0.6132965414781215, + 0.5811839936014417, + 0.4983306417045542, + 0.35019391936065253 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 20.07771923137129, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7253906510613115, + "wql": 0.4389337618945245 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8695803310432392, + "wql": 0.47113347091324836, + "wsql_by_level": [ + 0.1835458471936371, + 0.32982821608489943, + 0.45103296019069494, + 0.5436560192258795, + 0.6049310895706219, + 0.6280152779376479, + 0.6084807073241378, + 0.5316985595705173, + 0.3590125611211996 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.449284014111235, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.886376564373432, + "wql": 0.3811069627206816 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0290605004344486, + "wql": 0.3985039810625717, + "wsql_by_level": [ + 0.1679887978032005, + 0.29586385635782336, + 0.3897982064848364, + 0.4573701639144701, + 0.498957712647403, + 0.5156578718552773, + 0.503932677499426, + 0.44794299393882064, + 0.30902354906188795 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 15.485890556224621, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8481612047385236, + "wql": 0.4430354391538915 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4017198658664995, + "wql": 1.1114611715659342, + "wsql_by_level": [ + 0.2800722966391486, + 0.546197915157562, + 0.8136706828066148, + 1.0722094405376421, + 1.3020045496537762, + 1.4879226773855536, + 1.6030331061956713, + 1.5820784287832128, + 1.3159614469342267 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6161039862799704, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.9003784771427971, + "wql": 0.688674742832167 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.698703954787198, + "wql": 0.26421205321414765, + "wsql_by_level": [ + 0.13392264522750805, + 0.21782730991389182, + 0.2771009285060299, + 0.31591161278488905, + 0.3353452922511018, + 0.33539358125971663, + 0.31339007776988664, + 0.26611123290767147, + 0.1829057983066333 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.172489375833764, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6967405469903808, + "wql": 0.39079055097798043 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9601874654243095, + "wql": 0.6321255477753337, + "wsql_by_level": [ + 0.19862388530516814, + 0.3730169278374515, + 0.5264879563294177, + 0.6595736148618315, + 0.7652012576813627, + 0.8399677859584039, + 0.8725574744659007, + 0.8262736512102663, + 0.6274273763282014 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 3.000821033830937, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8763760759910977, + "wql": 0.4333250079859994 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8202442974975183, + "wql": 0.40248813326840344, + "wsql_by_level": [ + 0.1461635361113414, + 0.2613576072043297, + 0.3528116270399404, + 0.4256032260565851, + 0.4830573802552875, + 0.5212339277970817, + 0.5351582677907385, + 0.5065778532959115, + 0.3904297738644151 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 11.794992176784298, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8241952573447494, + "wql": 0.5451559736781498 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4112854966359946, + "wql": 0.030124534659797, + "wsql_by_level": [ + 0.019527960761243527, + 0.027927786900032666, + 0.033222516603597776, + 0.03628034467034123, + 0.03747896244846844, + 0.036675811377828764, + 0.03367939781740829, + 0.02797771651446565, + 0.018350314844786688 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.4308313858398343, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6755207477627803, + "wql": 0.525173082979566 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6109119490004906, + "wql": 0.0507796816643549, + "wsql_by_level": [ + 0.04010044915467301, + 0.05382360152442518, + 0.060802302019489496, + 0.06343967149905112, + 0.06270439544353361, + 0.05856666538308649, + 0.05134694730297571, + 0.04063016370513555, + 0.025602938946823833 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.809535680349889, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38362194644275266, + "wql": 0.3598889253471719 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6788921984166894, + "wql": 0.057523080945618504, + "wsql_by_level": [ + 0.044962168036473245, + 0.0617907381593232, + 0.07000326040826144, + 0.07275499917041249, + 0.07118601748969752, + 0.06598519682661391, + 0.05743968204832923, + 0.045187425341231935, + 0.028398241030223575 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.187664297204638, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4267014761998933, + "wql": 0.3898831940017445 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6843780571757867, + "wql": 0.044034706261494416, + "wsql_by_level": [ + 0.03581149637452957, + 0.0475586711187935, + 0.05276330300275231, + 0.054551128676715126, + 0.0534873175215362, + 0.05058664745640411, + 0.044858415323828484, + 0.03518344440945791, + 0.021511932469432504 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.239834608462081, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.34046162853187484, + "wql": 0.3222283889741808 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.731147407677232, + "wql": 0.05201189781689689, + "wsql_by_level": [ + 0.043825394909383114, + 0.05771395205806843, + 0.06334523612131396, + 0.06425727520335138, + 0.06211196940750205, + 0.057441990200497756, + 0.0506255847713455, + 0.041328796015215045, + 0.02745688166539485 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.4652768581252165, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6338341594863739, + "wql": 0.3488090008262688 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7209031815236618, + "wql": 0.0508529923606572, + "wsql_by_level": [ + 0.04271810201549826, + 0.05551968591408709, + 0.060811973685927286, + 0.061921078589498024, + 0.06032485910671051, + 0.05646406617287292, + 0.05037322207120979, + 0.04152742801716043, + 0.028016515672950475 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.3858428873272954, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5791066246285701, + "wql": 0.290151129728308 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6127000632647708, + "wql": 0.02855889871597037, + "wsql_by_level": [ + 0.020664257298477408, + 0.029459576568182863, + 0.033954456507058334, + 0.03571179537423792, + 0.03529778536655863, + 0.03309348900957199, + 0.029338111034327808, + 0.023875952188946448, + 0.015634665096371923 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 1.9811526669560324, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5168665605249906, + "wql": 0.30768943345074 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5228579784923939, + "wql": 0.1970768936004838, + "wsql_by_level": [ + 0.10235310180573008, + 0.16716537193245276, + 0.21124872256221705, + 0.2388910729780476, + 0.2508754203710049, + 0.24788375961668113, + 0.22992413632960368, + 0.19350285463576386, + 0.13184760217285352 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.807908297890408, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.721074961455623, + "wql": 0.6518174809201931 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4667788179289419, + "wql": 0.19457245178550936, + "wsql_by_level": [ + 0.10116326516600097, + 0.16112263364312396, + 0.20181353850447256, + 0.22790857986297222, + 0.24114373914778028, + 0.24148401288875812, + 0.22849603678209912, + 0.20024771765220972, + 0.14777254242216753 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.6688034212137905, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7350787932775339, + "wql": 0.49685998962622685 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4980129818863368, + "wql": 0.21872471124890402, + "wsql_by_level": [ + 0.115304589447597, + 0.1808413247621152, + 0.2239024911223661, + 0.25036149025498944, + 0.2633789287653999, + 0.26498570979372804, + 0.2558955406474298, + 0.23366484942790997, + 0.18018747701860072 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.92501272927982, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.818532286161662, + "wql": 0.4804784573972439 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4818650986186548, + "wql": 0.13137636241942816, + "wsql_by_level": [ + 0.07027531157556749, + 0.10955661008410027, + 0.13567807139460025, + 0.15209392037294905, + 0.15971802754840733, + 0.15941767608567592, + 0.15145593641185795, + 0.13686964832319354, + 0.10732205997850143 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7657058466388544, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7916113352519928, + "wql": 0.6361103130073918 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.70816880088421, + "wql": 0.12777595583992035, + "wsql_by_level": [ + 0.0940416557167201, + 0.12730103163408915, + 0.14547232558437032, + 0.15496933303481944, + 0.15639081556034648, + 0.14938035993420723, + 0.13527714716477465, + 0.11226154476456596, + 0.07488938916538992 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 98.50395038790172, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8098302153525787, + "wql": 0.6730978396901373 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7813052589383122, + "wql": 0.13916150958667817, + "wsql_by_level": [ + 0.0839468237473706, + 0.12200603082797291, + 0.1442479668226164, + 0.1581304855238339, + 0.16666886566377695, + 0.16843687032708576, + 0.1611353821990735, + 0.14238774187967418, + 0.10549341928869949 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 97.8280440486802, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6668565885084394, + "wql": 0.39789275746283403 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0764692554309299, + "wql": 0.17809570501739747, + "wsql_by_level": [ + 0.08815323250629209, + 0.1410735540862456, + 0.17854143324240113, + 0.20517321300852073, + 0.22310047192928828, + 0.2285954304677697, + 0.2190965517658008, + 0.18834030598237086, + 0.13078715216788814 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 130.75150047112393, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9962526555087059, + "wql": 0.4636470652582325 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.033643950960055, + "wql": 0.09542454774756803, + "wsql_by_level": [ + 0.06347547236550455, + 0.09393188407318352, + 0.11335914009161366, + 0.12391438627455373, + 0.12531051830391837, + 0.1169795823579093, + 0.10132838913546541, + 0.07562780002886973, + 0.04489375709709404 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 73.44017768436008, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.025757335852437, + "wql": 0.47901057475682746 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7877373638727412, + "wql": 0.27766561273673457, + "wsql_by_level": [ + 0.17115798799986884, + 0.26325074213497096, + 0.31732494743666456, + 0.3486148190888516, + 0.35724245077913813, + 0.35352405536602427, + 0.31859189379715164, + 0.24150481804585935, + 0.12777879998208178 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.3056446033006068, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6534624112178543, + "wql": 0.577214746526443 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9498380421522724, + "wql": 0.3705354577532055, + "wsql_by_level": [ + 0.18479904170851444, + 0.3262891631785495, + 0.43720298942516617, + 0.4902123894444339, + 0.49835194618526213, + 0.4725493348123783, + 0.410498000302961, + 0.3181601290123875, + 0.19675612570919634 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.6250812006056377, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2262810923768237, + "wql": 0.8446611031596755 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.307144751187593, + "wql": 0.484231353164451, + "wsql_by_level": [ + 0.32044519379308123, + 0.4796127755126053, + 0.5892257298256933, + 0.6426452886050719, + 0.6392561091822294, + 0.5873755132834569, + 0.49750931033550294, + 0.37792387166450886, + 0.22408838627790922 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.1915924136447886, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9849832397532534, + "wql": 0.8353424856889321 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7726356581245624, + "wql": 0.34251968289765683, + "wsql_by_level": [ + 0.19759934766088905, + 0.3031639190338136, + 0.3731717231822459, + 0.42378386420456776, + 0.44475795105448696, + 0.44057830291431305, + 0.40092626065039877, + 0.31933512444671125, + 0.17936065293148531 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.374857471989734, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7399586764835896, + "wql": 0.6790479669247866 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3991428670417723, + "wql": 0.4332363035852189, + "wsql_by_level": [ + 0.30410618415640356, + 0.4704771858545054, + 0.5392114172157767, + 0.5576007510909506, + 0.5436870557396306, + 0.5015203970655315, + 0.43198146856622777, + 0.33937526714055377, + 0.21116700543738964 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.319531202429374, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1434762057287606, + "wql": 0.7877949971718228 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.436061394009377, + "wql": 0.4187041967200971, + "wsql_by_level": [ + 0.3100586483740042, + 0.47347088300421175, + 0.5447297538736405, + 0.5578969570024439, + 0.5319711553700133, + 0.4751547539889456, + 0.3955262397911802, + 0.2974199205118426, + 0.18210945856459188 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 8.957151509213837, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0027919313374156, + "wql": 0.7239955943608372 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.7379944124041118, + "wql": 0.33756847378928573, + "wsql_by_level": [ + 0.1620133170878742, + 0.2962002627857162, + 0.3988072918909074, + 0.4513767846788654, + 0.4528711596212441, + 0.4241558967561161, + 0.36387028038267033, + 0.2908148576147514, + 0.19800641328542687 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 143.75229959487916, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9558890891083643, + "wql": 0.6956112870175899 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0401542904755747, + "wql": 0.19655578741796256, + "wsql_by_level": [ + 0.1417659685354361, + 0.19202323511237912, + 0.23171246827783198, + 0.23833150059355862, + 0.2226324734280471, + 0.21453460320583057, + 0.21010518507123527, + 0.1822399923304321, + 0.13565666020691236 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 555.6324206760952, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8358595974022779, + "wql": 0.7614204440831972 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0694336064769143, + "wql": 0.1300259440329757, + "wsql_by_level": [ + 0.07024619154982942, + 0.10910481518272273, + 0.1369538766922629, + 0.1554215670776755, + 0.16554360726393702, + 0.16515344449365948, + 0.15417793517110404, + 0.13000491823775007, + 0.08362714062784012 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.6415581504503884, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.403778404354072, + "wql": 1.3842912839493247 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8013788268197071, + "wql": 0.09589557037266866, + "wsql_by_level": [ + 0.062442344077559137, + 0.09532673585996267, + 0.11402786174212132, + 0.1225096423836964, + 0.12218240427468238, + 0.11474202571235899, + 0.1006774633802991, + 0.07950371576259843, + 0.051647940160739494 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.8594081902516164, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8877389913113496, + "wql": 0.7025782241924592 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0070280976302255, + "wql": 0.12508008701264237, + "wsql_by_level": [ + 0.0861425888728795, + 0.1261291943561307, + 0.15091368842654168, + 0.1631320691714223, + 0.16156487527481217, + 0.1485440862740269, + 0.12629619158849958, + 0.09799194762903372, + 0.06500614152043467 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.4367197962529543, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9530875983260918, + "wql": 0.7464822626784796 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7005212020970276, + "wql": 0.0760180875396463, + "wsql_by_level": [ + 0.05297798128578211, + 0.07899861436753486, + 0.09249208354052788, + 0.09768586778808594, + 0.09564036146174022, + 0.08604012801734809, + 0.0730743783629783, + 0.06183555113359217, + 0.045417821899227155 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.863916364454088, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7064821802191489, + "wql": 0.637125813789166 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.6997179603989685, + "wql": 0.26034717331086205, + "wsql_by_level": [ + 0.10473916331099253, + 0.18863697282489295, + 0.26186317542946996, + 0.3193415719452675, + 0.35743111979962355, + 0.36208092114892465, + 0.330859277439312, + 0.2626379885729415, + 0.15553436932633372 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 20.329321246146268, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0191178708314248, + "wql": 0.7528429238363763 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2217239655101504, + "wql": 0.3559165218046931, + "wsql_by_level": [ + 0.2900237568768538, + 0.39104001404476496, + 0.43848327271807586, + 0.4553130903730483, + 0.44681216585979033, + 0.4122155914838351, + 0.35228942504880745, + 0.26646637709171755, + 0.15060500274534422 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.212170086302315, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0157463673452953, + "wql": 0.9611658017781922 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.734661744814033, + "wql": 0.32867900858724947, + "wsql_by_level": [ + 0.3016735859700118, + 0.39890578527586945, + 0.4314240723591547, + 0.430661558111209, + 0.40573626215401437, + 0.3589212649061593, + 0.29505514020428636, + 0.21482601335951942, + 0.1209073949450205 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 548.6558208556403, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.006424061452747, + "wql": 1.031392816210494 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6321554468961936, + "wql": 0.17309921274194798, + "wsql_by_level": [ + 0.10348270441451943, + 0.17462612359193827, + 0.20931293600096204, + 0.22361376288623414, + 0.22312351495354324, + 0.20781433434280577, + 0.1750220314962269, + 0.14161511914865027, + 0.09928238784265167 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2171.5529644829885, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9231329960664922, + "wql": 0.8190583801256105 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4136366926205477, + "wql": 0.01826307160877487, + "wsql_by_level": [ + 0.0066087252793233554, + 0.011898878670890902, + 0.015671763715629672, + 0.018800183444110972, + 0.021650031026221712, + 0.02338061649971047, + 0.024199116963668072, + 0.022989197851183103, + 0.01916913102823559 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.411707038030265, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5427111850349482, + "wql": 0.1336250356188434 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8092460761827927, + "wql": 0.08302469555381571, + "wsql_by_level": [ + 0.023866667411919253, + 0.04969422934316776, + 0.07292001673125874, + 0.09019619510717572, + 0.10190225442268169, + 0.10859629677824016, + 0.10887568558944763, + 0.10266840189325654, + 0.08850251270719396 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.233196419801576, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8275817045838775, + "wql": 0.3642966052609432 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.71085785589237, + "wql": 0.07753375982735178, + "wsql_by_level": [ + 0.026517810899215753, + 0.05158263867650761, + 0.07151602829720438, + 0.08621359050795607, + 0.09551192887993631, + 0.0986228221593162, + 0.09749944405281147, + 0.09151698890186007, + 0.07882258607135817 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.328159357761105, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7849992115784338, + "wql": 0.31921246064856895 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.501028407452742, + "wql": 0.05475492069058009, + "wsql_by_level": [ + 0.021104770494709237, + 0.04377233789533583, + 0.057354816974309435, + 0.06463419667570057, + 0.06637619051863189, + 0.06578395304758333, + 0.06397621320592457, + 0.06058291153542194, + 0.04920889586760403 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 11.091345129694442, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6599621484749805, + "wql": 0.29836444197683304 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8128829413765802, + "wql": 0.08957674510059367, + "wsql_by_level": [ + 0.041600030760003424, + 0.07088384477188964, + 0.088614759505003, + 0.09871587715928565, + 0.10349411265634889, + 0.10705025355950666, + 0.1073536633919154, + 0.10222347904294532, + 0.08625468505844502 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.826358951349487, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7591849551593689, + "wql": 0.246023059258878 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9833592005773739, + "wql": 0.11928175584415124, + "wsql_by_level": [ + 0.06021289491839813, + 0.10980343022798765, + 0.13527727841893505, + 0.14548322832648072, + 0.14471711673100054, + 0.1395123022974652, + 0.12994232757621146, + 0.11532789130025589, + 0.09325933280062645 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 25.224927203146795, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.658841755665935, + "wql": 0.2687262784398826 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4535239618710496, + "wql": 0.11146099179186322, + "wsql_by_level": [ + 0.05772887196401991, + 0.1000696255021768, + 0.12447077518288599, + 0.13643453611532597, + 0.14036779213683404, + 0.13622245910614034, + 0.12708195479253323, + 0.1064783364660867, + 0.074294574860766 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 24.466817761288073, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7823702149104226, + "wql": 0.48171649762027424 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0569707107810535, + "wql": 0.466797673564828, + "wsql_by_level": [ + 0.19500686589011698, + 0.33039159150932684, + 0.43041728865262585, + 0.5029505426976651, + 0.5572429052533742, + 0.5948917731582577, + 0.6004984978597492, + 0.5547486119754602, + 0.4350309850868756 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 163.7018933847088, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5358062637701075, + "wql": 0.24590826361797335 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1068768318410371, + "wql": 0.6876744145275107, + "wsql_by_level": [ + 0.5516512688353683, + 0.9124736298634308, + 0.9659252700487109, + 0.9207086014542023, + 0.8338680096941103, + 0.7197661487141386, + 0.5866895457664433, + 0.43522497462347126, + 0.26276228174772087 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 518.295171717889, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8307979417298298, + "wql": 0.8632988628595557 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2540940364652442, + "wql": 0.505597110503955, + "wsql_by_level": [ + 0.3569002002208137, + 0.5719341805265288, + 0.6459300076867238, + 0.6611632109769654, + 0.637019457677877, + 0.575693847383265, + 0.4911322293587502, + 0.37824638989009746, + 0.23235447081457275 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 465.0344855647571, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8322598246884586, + "wql": 0.7244493735006032 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.358420038495963, + "wql": 0.48645956434731663, + "wsql_by_level": [ + 0.3535825616667645, + 0.5672363631381698, + 0.6436034960044489, + 0.64799533278099, + 0.6065627930947822, + 0.5373310419861533, + 0.4531992376434522, + 0.3512842333726652, + 0.21734101943842304 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 428.2363798727773, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8723577963916986, + "wql": 0.7806809197319673 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5526114744485184, + "wql": 0.21751851264051555, + "wsql_by_level": [ + 0.11470803985434372, + 0.17283933400634374, + 0.21058281369181722, + 0.23666890542596927, + 0.24820958721759673, + 0.25527812938466654, + 0.2551062215640009, + 0.24795719016974727, + 0.21631639245015433 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 133.00971117146003, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6602522179712205, + "wql": 0.24287838987232016 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8202496014912319, + "wql": 0.8925827407527185, + "wsql_by_level": [ + 0.38541161822645614, + 0.7524162708412553, + 0.9307851221053045, + 1.0216040228675105, + 1.0617553976256673, + 1.0615020268668696, + 1.0248027857699271, + 0.9551463663635624, + 0.8398210561079135 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 318.8647982090948, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8421388872403938, + "wql": 0.8081378396577985 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.964919532429805, + "wql": 0.7461543665124617, + "wsql_by_level": [ + 0.2834500663819634, + 0.44264602628401556, + 0.5796412818318122, + 0.7057195336755311, + 0.8200411129236903, + 0.9266927718637723, + 1.011763436495855, + 1.0524662701287637, + 0.8929687990267516 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 268.25490213651614, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.8275410126283994, + "wql": 0.7478343150673853 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9134564798297874, + "wql": 0.6175883363050122, + "wsql_by_level": [ + 0.16890765860697587, + 0.33091200516419633, + 0.5092900856442216, + 0.6603666301434383, + 0.7875947734338622, + 0.8481655810811615, + 0.8421071684458294, + 0.7816293203758332, + 0.6293218038495915 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 255.1309755733924, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.817385317103711, + "wql": 0.6630305085567499 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5365259750149728, + "wql": 0.009654993860777627, + "wsql_by_level": [ + 0.005724845362497532, + 0.00920887429438802, + 0.011466729962842885, + 0.01266084206423771, + 0.012951872384924368, + 0.012313010096105564, + 0.010544246709686766, + 0.00775752984075642, + 0.004266994031559382 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 335.13487946192424, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38500187920526924, + "wql": 0.52459756299694 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.670653392134585, + "wql": 0.008981826130304946, + "wsql_by_level": [ + 0.0053366038757372, + 0.008049966794615416, + 0.00992207713123076, + 0.011052931794968844, + 0.01154130838274721, + 0.011256373314944335, + 0.010204657507417605, + 0.008291323572934061, + 0.005181192798149096 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 276.3001642068227, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7302938272520174, + "wql": 0.6535816313232373 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7073717633687269, + "wql": 0.00936897182344085, + "wsql_by_level": [ + 0.0056248523183692915, + 0.008790223831655883, + 0.010743770191326657, + 0.011757188151021558, + 0.011915729308279865, + 0.011455608273473097, + 0.010329936196961464, + 0.008389199827276088, + 0.00531423831260375 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 290.33115371280246, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9447672897600948, + "wql": 0.7238819059421883 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5056253458415603, + "wql": 0.008997030137135983, + "wsql_by_level": [ + 0.005544246292032471, + 0.008735699680501302, + 0.01078215627564844, + 0.011832983659387085, + 0.012001755131681273, + 0.011368232217467607, + 0.009836286187428203, + 0.007227603780454877, + 0.0036443080096225976 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 16.092892949141206, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4788533738841219, + "wql": 0.352616776583892 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6760128108560223, + "wql": 0.00981458802096833, + "wsql_by_level": [ + 0.0060991305699777745, + 0.009245982524425041, + 0.011209319536050581, + 0.012253208488651208, + 0.012497058851992919, + 0.012008801468687425, + 0.010785806750653507, + 0.00873847968665123, + 0.0054935043116252965 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.762687789265598, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7081158524164899, + "wql": 0.4174036444620968 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7411342906991989, + "wql": 0.010556989822489177, + "wsql_by_level": [ + 0.006410213440200779, + 0.009894457883444204, + 0.012035222781647042, + 0.013195692023143005, + 0.013489119352055726, + 0.013023600495377506, + 0.011666882061255542, + 0.009323164267890002, + 0.0059745560973887835 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 17.23687046433836, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8911148567780734, + "wql": 0.4458379328384122 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.18322311795554455, + "wql": 0.054518895403781596, + "wsql_by_level": [ + 0.036908051629222303, + 0.055444112480953024, + 0.06565553562335827, + 0.06940281424515697, + 0.06840994660832993, + 0.06426975462043978, + 0.0553060782947343, + 0.04397503126257423, + 0.031298733869265495 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.7574006347429185, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.2372922751834896, + "wql": 0.24675367177697805 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4610753969735693, + "wql": 0.1528605630177465, + "wsql_by_level": [ + 0.12384610134301514, + 0.1678060742527983, + 0.18818114349117637, + 0.18628440521650788, + 0.1788416975151349, + 0.17203827233629065, + 0.15227199762905824, + 0.11956653494393596, + 0.08690884043180094 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.9802337528694243, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3198153451739089, + "wql": 0.324605479579304 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7459196494649294, + "wql": 0.28002923026495735, + "wsql_by_level": [ + 0.14189577835254674, + 0.22637030369472252, + 0.289039711240719, + 0.3354423425265624, + 0.37103875275917725, + 0.37788119691475053, + 0.3580260520587308, + 0.27691033483740524, + 0.1436586000000015 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.787637180119517, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.44346423004685526, + "wql": 0.41450854587151004 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7505402275148327, + "wql": 0.2262536880109035, + "wsql_by_level": [ + 0.13227568214422789, + 0.2326930988529389, + 0.30614538883800735, + 0.329868513126158, + 0.3282708313225938, + 0.28868459830168486, + 0.20890769001996812, + 0.13036976360724126, + 0.07906762588531176 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.868164217365639, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4736514683215731, + "wql": 0.4059262777826502 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.35672871360610625, + "wql": 0.2151929516544161, + "wsql_by_level": [ + 0.11857116283033574, + 0.1845369054539126, + 0.21966346683797974, + 0.24345271425312393, + 0.2562009800788367, + 0.25523936841907074, + 0.24786605846265178, + 0.23175813842136378, + 0.17944777013246996 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.5065599092326702, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.22075296885394705, + "wql": 0.19268863222793592 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4325885606544303, + "wql": 0.21763516941937858, + "wsql_by_level": [ + 0.11999215158299158, + 0.19215285432455603, + 0.2356988499450652, + 0.2593403749509408, + 0.26444359568403997, + 0.25745491168733164, + 0.24400614746013263, + 0.21989427543055365, + 0.16573336370879574 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.9954311957050646, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3379006855428726, + "wql": 0.21475638959074228 + } + } + ], + "checkpoint_sha256": "1669bc65e42eaf879ed99fab670b8c12a950c4245c341a6f0bd8354c8494a2b8", + "inference_seconds": 358.3575002211146 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/zero_mass.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/zero_mass.py new file mode 100644 index 0000000000000000000000000000000000000000..7e9c7067950c67da130e2c2538ffb42f34537402 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S053/zero_mass.py @@ -0,0 +1,12 @@ +"""Fixed zero-mass projection from the supplied history only.""" +import numpy as np + +def project(ctx,q,threshold=.4): + finite=np.isfinite(ctx);n=finite.sum(-1).clip(min=1) + x=np.where(finite,ctx,0.) + mean=x.sum(-1)/n + scale=np.sqrt((np.where(finite,ctx-mean[...,None],0.)**2).sum(-1)/n) + zero=((ctx==0)&finite).sum(-1) + active=((ctx>=0)|~finite).all(-1)&(zero>=4)&(zero/n>=.1) + cutoff=np.where(active,threshold*scale,0.) + return np.where((q>=0)&(q=0)|~torch.isfinite(recent)).all(-1) + qq=torch.where(positive[:,None,None],qq.clamp(min=0),qq) + q=qq.transpose(1,2).float().cpu().numpy() + q=apply_gate(member_ctx[:,-4096:],p.cpu().numpy(),q) + q=project(member_ctx,apply_continuity(member_ctx,q)) + forecasts.append(q) + q=(forecasts[0]+forecasts[1]+forecasts[2])/3 + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'config.json'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/provenance/member2/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/provenance/member2/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/provenance/member2/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/seasonal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/seasonal.py new file mode 100644 index 0000000000000000000000000000000000000000..cd8d8ebbf65c59c69f3d1c537e8cd5cb024d0330 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/seasonal.py @@ -0,0 +1,51 @@ +"""A fixed confidence gate for highly repeatable history; no fitted parameters.""" +import numpy as np + +def apply_gate(ctx,periods,quant,threshold=.25,strength=1.,cycles=4,mode='aligned'): + # Each row uses only its own context. Quantile blending preserves ordering. + b,_,h=quant.shape + out=quant.copy() + for i in range(b): + x=ctx[i];valid=np.isfinite(x) + if not valid.any():continue + x=x[np.flatnonzero(valid)[0]:] + best=None + for p in periods[i]: + p=int(p) + if p<2 or len(x)<3*p:continue + k=min(len(x)//p,8);history=x[-k*p:] + pairs=np.isfinite(history[p:])&np.isfinite(history[:-p]) + if pairs.sum()0) + if mode in ('centered','aligned'): + mu=mu+np.nanmean(seasons[-1])-np.nanmean(mu) + if mode=='aligned' and np.isfinite(seasons[-1]).sum()>=max(2,.75*p): + noise=float(np.mean(err.astype(np.float64)**2)/2) + target_var=max(0.,float(np.nanvar(seasons[-1]))-noise) + template_var=max(0.,float(np.nanvar(mu))-noise/min(k,cycles)) + ratio=float(np.clip(np.sqrt(target_var/max(template_var,1e-12)),.5,2.)) + center=float(np.nanmean(mu));mu=center+(mu-center)*ratio + if mode=='exponential': + w=.5**np.arange(len(recent)-1,-1,-1,dtype=np.float32) + den=(w[:,None]*np.isfinite(recent)).sum(0) + mu=np.divide((w[:,None]*np.nan_to_num(recent)).sum(0),den,out=np.full(p,np.nan,np.float32),where=den>0) + # Error of a season relative to the previous one, corrected for averaging. + sigma=float(np.sqrt(np.mean(err.astype(np.float64)**2)/2*(1+1/min(k,cycles)))) + idx=np.arange(h)%p;median=mu[idx] + z=np.array([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0,.2533471031,.5244005127,.8416212336,1.2815515655]) + sq=median[None]+z[:,None]*sigma + sq=np.where(np.isfinite(sq),sq,quant[i]) + if np.nanmin(x)>=0:sq=np.maximum(0,sq) + best=(weight,sq) + if best is not None:out[i]=(1-best[0])*quant[i]+best[0]*best[1] + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..9c0bcfbc57b9013a099dfcec8ae99b365271f3d4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S059/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.38390727622107634, + "skill_score": 0.38390727622107634, + "rel_mase_gmean": 0.7364611052383948, + "rel_wql_gmean": 0.5153975431879257, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.7353607167985686, + "rel_wql_gmean": 0.4851808712049651 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.702906617588522, + "rel_wql_gmean": 0.4974769090623787 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.7501194315611718, + "rel_wql_gmean": 0.5346001417420667 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.8911922244452082, + "rel_wql_gmean": 0.8479489642438038 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.8943659679369832, + "rel_wql_gmean": 0.6442776787431007 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.5434503330756825, + "rel_wql_gmean": 0.4876999737589551 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.797661616559228, + "rel_wql_gmean": 0.38690980553230125 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8198404631372848, + "rel_wql_gmean": 0.5017926725111029 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.6396039739761772, + "rel_wql_gmean": 0.4359354208804363 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5635436273485116, + "rel_wql_gmean": 0.44508765721177335 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6814079327953554, + "rel_wql_gmean": 0.7256749968040445 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7578777663572629, + "rel_wql_gmean": 0.5162953412550242 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7321181616865257, + "rel_wql_gmean": 0.4948591730074238 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 0.94095568892899, + "rel_wql_gmean": 0.7765958270612637 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.7930845754886291, + "rel_wql_gmean": 0.8287306153767986 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.6558135213616251, + "rel_wql_gmean": 0.5029291174835147 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.6845077705765354, + "rel_wql_gmean": 0.45906184425761 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.8797620437262459, + "rel_wql_gmean": 0.6607117989604714 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7095657276161669, + "rel_wql_gmean": 0.512112871888587 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.7586050364246273, + "rel_wql_gmean": 0.5180281757152492 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2236069179967384, + "wql": 0.11322235756492145, + "wsql_by_level": [ + 0.06363857264683051, + 0.09796111150812378, + 0.12001400334400184, + 0.13295079809593915, + 0.13838807583181742, + 0.13845974794085797, + 0.130850880057089, + 0.11390235052275094, + 0.08283567813688238 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 718.3597906298929, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6814079327953554, + "wql": 0.7256749968040445 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2617256531015728, + "wql": 0.08254080976300476, + "wsql_by_level": [ + 0.04824010402256026, + 0.07315964817028137, + 0.08860608087997288, + 0.09764518308966534, + 0.1016351288029079, + 0.10047704083859364, + 0.09418388414661409, + 0.08099774883497676, + 0.05792246908147061 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 578.7399222773853, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7930845754886291, + "wql": 0.8287306153767986 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9900650538463878, + "wql": 0.09213810013661962, + "wsql_by_level": [ + 0.05358165075993346, + 0.08150101413362285, + 0.09917530748567781, + 0.10960746231596678, + 0.11431230413580037, + 0.11299503195569756, + 0.10512566886840971, + 0.08963889789723631, + 0.06330556367723168 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 542.0331691982921, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8005901004451464, + "wql": 0.782082610213394 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.098293399615711, + "wql": 0.04901739801369985, + "wsql_by_level": [ + 0.02551834905819655, + 0.03957998309892137, + 0.05002232528050256, + 0.05685452028450161, + 0.061139829636347814, + 0.06275054176766173, + 0.05941395685699297, + 0.050638293909111315, + 0.03523878223106273 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 318.22403309203173, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.070174709494656, + "wql": 0.7531040443506904 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.3243786586400033, + "wql": 0.021928153151403063, + "wsql_by_level": [ + 0.01358663947469836, + 0.01980090535914892, + 0.023716266045999655, + 0.026043476304612085, + 0.0270185763293991, + 0.026714076705171275, + 0.02483768047876899, + 0.021004101362857276, + 0.014631656301971893 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 173.11472540367097, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.033662416780368, + "wql": 0.9492042708577043 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2858316923179847, + "wql": 0.03811527551966756, + "wsql_by_level": [ + 0.01941326699049684, + 0.03242137828189149, + 0.04136194500133341, + 0.046496641065185945, + 0.04866200903710681, + 0.048137919534160405, + 0.04455196418949251, + 0.036974507204315075, + 0.025017848373025627 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 366.5709429720264, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.046786271709246, + "wql": 1.1055934283687467 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9749625638310676, + "wql": 0.048138728324876416, + "wsql_by_level": [ + 0.030685276311271648, + 0.046630186997381085, + 0.05637278012548932, + 0.061470549897305174, + 0.0625017826590037, + 0.059010692274538736, + 0.05104068201816403, + 0.03931433030992028, + 0.026222274330813804 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 63.48634767407836, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8930826414441269, + "wql": 0.7765734396015861 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9583997559979213, + "wql": 0.08939884832856487, + "wsql_by_level": [ + 0.04170821569633275, + 0.06676099203147558, + 0.08493630602440297, + 0.09908747665583961, + 0.10937870385888167, + 0.11399290733956137, + 0.1118010959619054, + 0.10083502782168839, + 0.07608890956699614 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 78.66748787853959, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.6347044764720122, + "wql": 0.7416368456406224 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8807233347122071, + "wql": 0.08596813508243525, + "wsql_by_level": [ + 0.040259274001677794, + 0.06461469536108591, + 0.08173065779646745, + 0.09405681399939524, + 0.10340633373578069, + 0.1079230281409517, + 0.10707589655409046, + 0.09803436545658055, + 0.07661215069588743 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 74.5607716360451, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8049694613944396, + "wql": 0.799225247544582 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0320996231064559, + "wql": 0.07476656941958622, + "wsql_by_level": [ + 0.04753340741138988, + 0.06822216905951686, + 0.08239347054785863, + 0.09017088129562412, + 0.09324324854967332, + 0.09167030172282793, + 0.08474375337815199, + 0.07037079376815333, + 0.04455109904307992 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 283.1825923269081, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0465850771646823, + "wql": 1.1055042584553039 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9726483893509065, + "wql": 0.07825518074005297, + "wsql_by_level": [ + 0.0425353518615627, + 0.0643096239140422, + 0.07791338141032679, + 0.08706457873853732, + 0.09442449299583416, + 0.097262831696502, + 0.09437293165801845, + 0.08413902955996398, + 0.0622744048256891 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 254.11198308049887, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.7794641992986503, + "wql": 0.6356446090386372 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1943215394785218, + "wql": 0.09174540753593688, + "wsql_by_level": [ + 0.04342635912679036, + 0.06913886857376114, + 0.08742507665138134, + 0.100396985609341, + 0.10881593539833866, + 0.11270631009377688, + 0.11184049906889566, + 0.10525794517964514, + 0.08670068812150168 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 298.2423880070779, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8803138710563129, + "wql": 0.625186542054814 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.493124524709932, + "wql": 0.06738419285761756, + "wsql_by_level": [ + 0.02882579452086664, + 0.047005599559411526, + 0.063192951444694, + 0.0749475813137993, + 0.08312812459498432, + 0.08674003091409549, + 0.08507985048458305, + 0.07760286000000277, + 0.059934942886120876 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 5468.095525244926, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.9073068016368289, + "wql": 0.7275827774582805 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.434155725110746, + "wql": 0.0667802375536562, + "wsql_by_level": [ + 0.026692601235835996, + 0.046557528301114134, + 0.06361425980119545, + 0.0758062186304174, + 0.0839668230668192, + 0.08701955871284697, + 0.08473779299502968, + 0.0756216974470926, + 0.05700565779255423 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 36159.306417796026, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0890550261305416, + "wql": 1.0236200958895227 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.01784711141416852, + "wql": 0.42361823467050047, + "wsql_by_level": [ + 0.17584927251463844, + 0.33269829860929534, + 0.427174589244793, + 0.48515283726372455, + 0.5131436494584852, + 0.5162746847308041, + 0.513996264634057, + 0.48600363534878604, + 0.3622708802299211 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.04958984008854269, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1141656255735666, + "wql": 0.03495614325590733 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7011338388265469, + "wql": 0.2860072750655306, + "wsql_by_level": [ + 0.2144047034480382, + 0.31635345522542324, + 0.35214143053543323, + 0.3523438384574089, + 0.33923939918370266, + 0.3202309877646438, + 0.28825180193635863, + 0.23506631237567277, + 0.15603354666309394 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.620953273849614, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8415532231719868, + "wql": 0.5061688616360344 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6896361268533105, + "wql": 0.220984449278081, + "wsql_by_level": [ + 0.16567812113971023, + 0.25838269882163056, + 0.2946714692239815, + 0.29660192989709017, + 0.27513780709123464, + 0.23911415077633233, + 0.19469602328959207, + 0.15090430241248876, + 0.11367354085066883 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.6166336337635436, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3219416343050904, + "wql": 0.24466060890631705 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8565461936385579, + "wql": 0.32765347890758983, + "wsql_by_level": [ + 0.21602876927547768, + 0.3587815079727259, + 0.4212090937427774, + 0.4293958162508004, + 0.40516894691974015, + 0.36548710749253144, + 0.3156456295535695, + 0.2583649717198151, + 0.17879946724087123 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 11.175266260991027, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8104079206329774, + "wql": 0.5440061718284979 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2016978450970257, + "wql": 0.4440307563491125, + "wsql_by_level": [ + 0.44876544772777244, + 0.5663970068123771, + 0.590072626305495, + 0.5691826276549431, + 0.5234938378581371, + 0.4602804440955539, + 0.3809143946540997, + 0.2846229334533539, + 0.17254748858028016 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 15.687555206431089, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.871888663086849, + "wql": 0.45871776440580886 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0397501295290796, + "wql": 0.3552729874278188, + "wsql_by_level": [ + 0.42254366451382047, + 0.4637738748118629, + 0.4631344185639624, + 0.4410552636207507, + 0.4053206292594932, + 0.3572427193998004, + 0.2962677435988331, + 0.2203202035669761, + 0.12779836951487028 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.663747338581844, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9696085709341932, + "wql": 0.3935285841007259 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1388189128942978, + "wql": 0.28761863201603854, + "wsql_by_level": [ + 0.24810490817937045, + 0.35162018048389304, + 0.3845905498637247, + 0.38252598345808236, + 0.35612742931025015, + 0.3138038155982683, + 0.25657093359475314, + 0.1874611476996979, + 0.10776273995630697 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 288.12953689138965, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9758028025195733, + "wql": 0.6101095475797519 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.02684894407004, + "wql": 0.12074879396491461, + "wsql_by_level": [ + 0.05842717315835182, + 0.11527217190836928, + 0.14582984832217116, + 0.15492136323279174, + 0.15354665486796729, + 0.14467381494306275, + 0.1296969424861603, + 0.1082505365305008, + 0.0761206402348565 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 942.8897092499002, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0188430451666168, + "wql": 0.8692622504561177 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7961290774708137, + "wql": 0.055086600586501756, + "wsql_by_level": [ + 0.03009514365853897, + 0.04679635559474307, + 0.057831993911850385, + 0.06554363819799909, + 0.06953458914894728, + 0.06892958351827402, + 0.06424861499553308, + 0.05451998332242974, + 0.03827950293020018 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 19.305669758486676, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8535902918107356, + "wql": 0.8689683102446087 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 43.27481986260363, + "wql": 0.07469554942915715, + "wsql_by_level": [ + 0.06430290386188647, + 0.09257019753221643, + 0.10715824434581048, + 0.10372541826201219, + 0.08765231800701055, + 0.05540165654144759, + 0.04233208223211574, + 0.05569271180070374, + 0.06342441227921114 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 178.07071470312755, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8559865499834818, + "wql": 0.5952277289736916 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.45535019207731425, + "wql": 0.025534527933562427, + "wsql_by_level": [ + 0.011510616892362761, + 0.01674436805571478, + 0.022066532757495406, + 0.024804899262824816, + 0.02955091041892547, + 0.03447000153748768, + 0.036345928431688865, + 0.032469679657993945, + 0.021847814387568085 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 300.7169596354167, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.1955882664295393, + "wql": 0.19556701275424587 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.27063687582482693, + "wql": 0.007595258008591664, + "wsql_by_level": [ + 0.005222686717205798, + 0.0060312980971640355, + 0.00572175078853467, + 0.0075768877713814865, + 0.008086495391432275, + 0.007971490244255948, + 0.00963511291402384, + 0.010099262990182932, + 0.008012337163143986 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 2538.5625, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8952259903608792, + "wql": 0.68414635989076 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.429614093567798, + "wql": 0.016831382849521116, + "wsql_by_level": [ + 0.009867954817743559, + 0.017306873957148354, + 0.020511190543803546, + 0.02123411357820148, + 0.020913350055366705, + 0.019884403098183068, + 0.01778057330165361, + 0.014825832222918622, + 0.009158154070671103 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 1555.751953125, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.370516377154595, + "wql": 0.3986868807076118 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.1704057389845905, + "wql": 0.31725504009655814, + "wsql_by_level": [ + 0.1469497012184946, + 0.263872474204719, + 0.35632733286267043, + 0.4207492765487572, + 0.44868055726247397, + 0.4186015062268603, + 0.33239499025921454, + 0.22255326999832847, + 0.24516625228750474 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 13.93900941212972, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8132444053134231, + "wql": 0.5854885232234621 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4431266412572541, + "wql": 0.22982298772403384, + "wsql_by_level": [ + 0.12151180283740175, + 0.20297524366506836, + 0.2506950827804444, + 0.26810987423667265, + 0.2641348642359077, + 0.24951217524594851, + 0.2534200113025785, + 0.2633948184228165, + 0.1946530167894662 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 7.6816385587056475, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.3335899314847894, + "wql": 0.8788595485366619 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7260771338150775, + "wql": 0.23832161036910796, + "wsql_by_level": [ + 0.10419911044052964, + 0.17889582718879693, + 0.24120411332592373, + 0.30949323449094385, + 0.35585746411947816, + 0.36104646921890654, + 0.2913643289063519, + 0.13546702106190722, + 0.16736692456913338 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.701985836029053, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2770209522267382, + "wql": 0.3975942001436146 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.1193272726018333, + "wql": 0.5277166212560096, + "wsql_by_level": [ + 0.18079306592968047, + 0.34008545492597847, + 0.47641481401479435, + 0.5860860019652557, + 0.6628093626137735, + 0.7054308519287826, + 0.7022653360687113, + 0.6331286668098774, + 0.4624360370472325 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.659220742991205, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6439325552127496, + "wql": 0.48009889342143774 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5379855721350405, + "wql": 0.3830163688985105, + "wsql_by_level": [ + 0.1499713506906128, + 0.2517475772917302, + 0.34236263748764734, + 0.42128885865880533, + 0.47916025168148957, + 0.5033696286007954, + 0.4986995728133731, + 0.45950782512593624, + 0.34103961773620434 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.31560765617568, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7898511167772202, + "wql": 0.6112468862416367 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9260503812539791, + "wql": 0.4602813912288302, + "wsql_by_level": [ + 0.18028539036854174, + 0.33058378969309743, + 0.4514244622349265, + 0.541975759694457, + 0.5980285997596717, + 0.612266124271867, + 0.580671012088774, + 0.4979484601772978, + 0.3493489227708396 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 20.04372770385499, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7245268126246129, + "wql": 0.4384054277225554 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8681989445504633, + "wql": 0.4699511899305036, + "wsql_by_level": [ + 0.18270561287336115, + 0.32851404788442845, + 0.4497649349711009, + 0.5423712381648246, + 0.6036698774045236, + 0.6267508284570313, + 0.6071557411315197, + 0.5304044652817593, + 0.35822396320598365 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.410819366061958, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8849684959410773, + "wql": 0.3801505978214889 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.017409984941018, + "wql": 0.3921863056266759, + "wsql_by_level": [ + 0.16256892749522536, + 0.287620821129683, + 0.38065450666633505, + 0.44855751470769245, + 0.4914281924131376, + 0.5090986401130768, + 0.49875271426887213, + 0.4442379270969703, + 0.3067575067490901 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 15.252200759808726, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8385587418584878, + "wql": 0.43601178507718513 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4075612820577477, + "wql": 1.1156560851758992, + "wsql_by_level": [ + 0.2833189944107999, + 0.5500528211267083, + 0.8176940038263553, + 1.0760929819230718, + 1.3065363664744574, + 1.4934655435980915, + 1.6083371719827477, + 1.586821636719213, + 1.3185852465216485 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6182484261047427, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.9041306429946965, + "wql": 0.6912739618831354 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6925671341871356, + "wql": 0.26182635967501305, + "wsql_by_level": [ + 0.13260732945657036, + 0.215608538276871, + 0.2741817989184704, + 0.31269201532258656, + 0.3321873723182639, + 0.33230065608098974, + 0.31078762882490735, + 0.2642107223022257, + 0.18186117557423276 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.104946614115034, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6906209712925853, + "wql": 0.3872619212985942 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9606794946042344, + "wql": 0.6323631307257183, + "wsql_by_level": [ + 0.19939973093522737, + 0.3736334255749662, + 0.5262365609630534, + 0.6596543726232341, + 0.7652848263409087, + 0.838610739836798, + 0.8725777168098013, + 0.8275948570463184, + 0.6282759464011568 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 3.0011487575360634, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8768251576730639, + "wql": 0.4334878722053543 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8211954837548844, + "wql": 0.4033644501473364, + "wsql_by_level": [ + 0.14768651977355982, + 0.26251782837038184, + 0.3535695637267996, + 0.42609062990242386, + 0.48357924589624635, + 0.5217832111164185, + 0.536010472980342, + 0.5077621906057097, + 0.3912803889541461 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 11.807734764733556, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8251510252843309, + "wql": 0.5463429139675589 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4088673143107352, + "wql": 0.02986088630431542, + "wsql_by_level": [ + 0.01954382409033786, + 0.027922809400683073, + 0.03316819128852406, + 0.03614964398593209, + 0.037231963892891434, + 0.03629573898342771, + 0.03318785909819875, + 0.0274115868329295, + 0.01783635916591433 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.414811416184078, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6715489754879321, + "wql": 0.5205767955602109 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6102429706497773, + "wql": 0.05071725440279795, + "wsql_by_level": [ + 0.0400910310396378, + 0.05378483343240217, + 0.06074613308578461, + 0.06337544546434935, + 0.06262607510534705, + 0.0584819163882286, + 0.05126443306432337, + 0.040544287685955804, + 0.025541134359152798 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.804777415467367, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3832018617194982, + "wql": 0.3594464869675341 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6791109601975381, + "wql": 0.05751671927028084, + "wsql_by_level": [ + 0.04480963432135593, + 0.06164357508385863, + 0.06993525224759353, + 0.07275125907020817, + 0.07121219546334391, + 0.06604207458062783, + 0.057511056830145825, + 0.04526442259953146, + 0.028481003235862383 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.1892042704954315, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4268389736921932, + "wql": 0.38984007547855215 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6710259773122021, + "wql": 0.04319534087407521, + "wsql_by_level": [ + 0.035534119418619996, + 0.0469926372706606, + 0.05196558689597259, + 0.053545681346647216, + 0.05234884902887347, + 0.04940886455841724, + 0.04375575818052106, + 0.03426104702514293, + 0.020945524141821784 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.1708752776508606, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.333819289831825, + "wql": 0.31608624838755706 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7216752985704228, + "wql": 0.051368279523546216, + "wsql_by_level": [ + 0.04330896227277046, + 0.05690455194179852, + 0.06244473891178152, + 0.06336540271286521, + 0.06128861033121738, + 0.056734429876384426, + 0.050051751485874076, + 0.0409281102815488, + 0.02728795789767558 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.419340991331851, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6256227560795686, + "wql": 0.34449268353656926 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7180093159004761, + "wql": 0.05064630616014907, + "wsql_by_level": [ + 0.042614433590499885, + 0.05533120103370855, + 0.06057566479511708, + 0.06167803342934072, + 0.060089033133285494, + 0.0562004646927213, + 0.05009556694594551, + 0.041301122634967505, + 0.027931235185755614 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.3726067238850286, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5767819619053044, + "wql": 0.28897184347999116 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6016412629320838, + "wql": 0.02797910833201068, + "wsql_by_level": [ + 0.020358783460233405, + 0.028858819704704154, + 0.03318856382226054, + 0.03491452371746591, + 0.03458174339817768, + 0.03247838888605104, + 0.0287720103982582, + 0.02333401887364237, + 0.015325122727302812 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 1.9409635037952655, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5075374867510607, + "wql": 0.3014428559291431 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5219891701759771, + "wql": 0.1967346580428961, + "wsql_by_level": [ + 0.1022516243681432, + 0.16692264131107457, + 0.21085252128747844, + 0.23842342983473092, + 0.2504106621892677, + 0.24737984462522944, + 0.22952004858124447, + 0.19322928582388432, + 0.1316218643650121 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.802706519441637, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7198767853752294, + "wql": 0.6506855617238192 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46679483666066146, + "wql": 0.19463494844005255, + "wsql_by_level": [ + 0.10109422077725921, + 0.16095216275505567, + 0.20163792740060793, + 0.22780782304914016, + 0.24116971962717887, + 0.2416365584046212, + 0.2287709053737393, + 0.20058913164212083, + 0.14805608693074976 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.6690909542534156, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7351040194221874, + "wql": 0.4970195810115594 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4962586147777394, + "wql": 0.21836970693383212, + "wsql_by_level": [ + 0.11473554414855769, + 0.17976692014208126, + 0.22273950096886, + 0.24936432869370578, + 0.2627130434499272, + 0.26480776840419573, + 0.25614086514672163, + 0.23427211356860378, + 0.18078727788183607 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.9176175931801764, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8156488149020819, + "wql": 0.4796986098678945 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.48170381671415274, + "wql": 0.13118643160908658, + "wsql_by_level": [ + 0.07014184723843876, + 0.10942323744515683, + 0.1355981943215736, + 0.15199408945370388, + 0.15965884882530665, + 0.1592539070510536, + 0.15126793669687374, + 0.13650454296441533, + 0.10683528048525681 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7650516173137156, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7913463802176048, + "wql": 0.6351906883124226 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7066874823772943, + "wql": 0.1271449190297797, + "wsql_by_level": [ + 0.0933141099793893, + 0.12666359811899386, + 0.14476282294144088, + 0.15403036580440257, + 0.1556450667062166, + 0.14859805499951134, + 0.13459964606121935, + 0.11188130758277749, + 0.07480929907406579 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 98.03423477278815, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8081362456606586, + "wql": 0.6697736656631963 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7788948437370838, + "wql": 0.13891341338775462, + "wsql_by_level": [ + 0.08398174282000935, + 0.12196298189324906, + 0.14408166466360375, + 0.15787040011543338, + 0.16640697099744625, + 0.16816168769006082, + 0.16077855479240083, + 0.1419440703775461, + 0.10503264714004205 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 97.67432221915986, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6647992604160057, + "wql": 0.39718339694354293 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0673902478814827, + "wql": 0.17669771293005393, + "wsql_by_level": [ + 0.08864210768356422, + 0.14097106442050036, + 0.17798693304233007, + 0.20422253156787387, + 0.2216794144654155, + 0.22670522900381934, + 0.2167369819554405, + 0.18549846951973384, + 0.12783668471180776 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 129.91866764898654, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9878501996699653, + "wql": 0.46000758990711305 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0152605411844229, + "wql": 0.09317390896196959, + "wsql_by_level": [ + 0.062153259217598913, + 0.09207054607238987, + 0.11136858330295457, + 0.12176648227914816, + 0.12322536930879806, + 0.11416579004671683, + 0.0979616340037349, + 0.07241549479579222, + 0.043438021630592794 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 72.21814369413588, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0075141899240718, + "wql": 0.4677128552107896 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7860281890104223, + "wql": 0.27799758176697403, + "wsql_by_level": [ + 0.1717741185840582, + 0.26355468037141627, + 0.3173945722083172, + 0.348234199570191, + 0.3562614434947252, + 0.35317865620063393, + 0.3192694052060894, + 0.24264058665868618, + 0.1296705736086491 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.3020592318983593, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6520445763176117, + "wql": 0.5779048478960569 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9480845903966525, + "wql": 0.3696348131095393, + "wsql_by_level": [ + 0.18406100973818135, + 0.32336656414897513, + 0.4340113774886201, + 0.4887265181078068, + 0.4975317250732725, + 0.47284812006896304, + 0.4111023747053884, + 0.3184798868941409, + 0.19658574176050528 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.6224065327937882, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2240173119859696, + "wql": 0.8426080216465409 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3007150450354164, + "wql": 0.4801727971932796, + "wsql_by_level": [ + 0.3133756869345089, + 0.4724745150255529, + 0.5843352509778016, + 0.6368460655547372, + 0.633714645602711, + 0.5837280267424266, + 0.4956348693685385, + 0.37725760542134923, + 0.22418850911189153 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.172594347976089, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9801382118474468, + "wql": 0.8283411128717643 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7710946190015113, + "wql": 0.3411082661690451, + "wsql_by_level": [ + 0.19641629290093096, + 0.299417927244649, + 0.3696652865301106, + 0.42240580492319263, + 0.44373126502534066, + 0.4394144989495959, + 0.4009636130630087, + 0.320114917315615, + 0.17784478956896255 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.362450069126983, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7384828123322117, + "wql": 0.6762498221526692 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4016065207370876, + "wql": 0.4332203453183624, + "wsql_by_level": [ + 0.30512936640519067, + 0.4710352972675277, + 0.539329792795466, + 0.5576821017066876, + 0.5436170225662089, + 0.5013259882616811, + 0.4316824364890382, + 0.3388290743843349, + 0.2103520279891265 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.318459550703743, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.145489673721279, + "wql": 0.7877659787292567 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.427205523953454, + "wql": 0.4163084615533015, + "wsql_by_level": [ + 0.30415352104925203, + 0.46892713794886154, + 0.54119005064475, + 0.5551062700276748, + 0.5298967304347385, + 0.47389098423877346, + 0.3949562149529636, + 0.2970841105005863, + 0.1815711341821132 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 8.922223039404564, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9966079373423831, + "wql": 0.7198530476187636 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.7430020127251982, + "wql": 0.33726989205262115, + "wsql_by_level": [ + 0.1615875798423301, + 0.2941472695026232, + 0.3977603753798685, + 0.45153335036590764, + 0.4532575726249321, + 0.42475385989317843, + 0.3642371312670325, + 0.290227064394519, + 0.19792482520319854 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 143.8749564624968, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.958643246702531, + "wql": 0.6949960138441512 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.042782131947045, + "wql": 0.19713481612144942, + "wsql_by_level": [ + 0.14145266254193367, + 0.19162049765079447, + 0.2314255524422951, + 0.23765326839390638, + 0.22284180984778318, + 0.21700479173723902, + 0.21160811268887847, + 0.18355320376550258, + 0.1370534460247121 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 556.1548696245466, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8379713096112194, + "wql": 0.7636634932365064 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0730750905696749, + "wql": 0.1301929254486588, + "wsql_by_level": [ + 0.06917996957022442, + 0.10829847369885078, + 0.13639098189440077, + 0.15523649131176082, + 0.16569939606799045, + 0.16565182832385808, + 0.15519249427952522, + 0.1311822106294404, + 0.08490448326187833 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.6440440524546873, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.4085583520743015, + "wql": 1.3860690131558357 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8008325307762919, + "wql": 0.09572543708870497, + "wsql_by_level": [ + 0.06273504523861438, + 0.0956532755633955, + 0.11418720163066727, + 0.12256720636748515, + 0.12207714829706699, + 0.11431453877474493, + 0.0999937771322991, + 0.0786968300162507, + 0.051303910777820656 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.8578063734596417, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8871338239643867, + "wql": 0.7013317438799826 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0030252479602666, + "wql": 0.1249917089224562, + "wsql_by_level": [ + 0.08610983661686913, + 0.12611804199416723, + 0.1509190868183001, + 0.16300402273565934, + 0.1611790059987598, + 0.1481362204485057, + 0.12606087973358543, + 0.09814595055175293, + 0.06525233540450624 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.4309001197785762, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9492991574798242, + "wql": 0.7459548191955957 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6982913466122769, + "wql": 0.07565381971009134, + "wsql_by_level": [ + 0.052622614404818614, + 0.07884459408514406, + 0.09251407575460632, + 0.09762040672244564, + 0.09518288056299144, + 0.08551923784159562, + 0.07252249755398561, + 0.06115251775659403, + 0.04490555270864069 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.83586722612381, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7042333501198964, + "wql": 0.6340727977918696 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.6721010186270577, + "wql": 0.25776008162860253, + "wsql_by_level": [ + 0.10364528016570211, + 0.18570792847933548, + 0.2573846339370734, + 0.31446782070108736, + 0.3530982375937417, + 0.35887393833922904, + 0.3289410181113067, + 0.2619956075334666, + 0.15572626979648074 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 20.082883402864848, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0086927377951924, + "wql": 0.7453618606024789 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2135324087780415, + "wql": 0.35537245051127964, + "wsql_by_level": [ + 0.2908553124888785, + 0.3899255030750655, + 0.43682986863358486, + 0.4537949565324307, + 0.4457276419893818, + 0.41121011380006384, + 0.3519799854562405, + 0.2668139452467754, + 0.15121472737909578 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.15097390058347, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.013163730197415, + "wql": 0.9596965170192082 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.7505533164935505, + "wql": 0.32951355215970807, + "wsql_by_level": [ + 0.3008058288183074, + 0.3987573875878164, + 0.4321393847589433, + 0.4319091839332611, + 0.4072331655435234, + 0.3601964780700368, + 0.2959891746315314, + 0.2161257993951919, + 0.12246556669876067 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 550.6800046284993, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0098020556949094, + "wql": 1.034011609084271 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6331993347900255, + "wql": 0.17317803256154704, + "wsql_by_level": [ + 0.10243152310472835, + 0.1738830469881669, + 0.20854217085121973, + 0.22321571753657066, + 0.22321780948799586, + 0.2082516978760881, + 0.1754064399741102, + 0.14295906749305423, + 0.10069481974198934 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2172.4706874574936, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9237234100254219, + "wql": 0.8194313340676879 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.41289770795473413, + "wql": 0.018217173815583756, + "wsql_by_level": [ + 0.006625672656993152, + 0.011872005914249556, + 0.01564517749875923, + 0.018799246801799892, + 0.021639906174350212, + 0.023324093610156634, + 0.024117339063705178, + 0.02288408170256439, + 0.019047040917675596 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.4101115193750178, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5417416017004391, + "wql": 0.13328921619145628 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8062619681315838, + "wql": 0.08328091176242708, + "wsql_by_level": [ + 0.023761273062111166, + 0.04999487635203015, + 0.07339320547930943, + 0.09059309024879598, + 0.10223818494940626, + 0.10887255156132415, + 0.10902890809155337, + 0.1028366366728766, + 0.08880947944443651 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.290007299828225, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8245299836050981, + "wql": 0.36542083335220377 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.705389171082786, + "wql": 0.07742404869386899, + "wsql_by_level": [ + 0.026632879177338743, + 0.051697647937195515, + 0.07159085933417278, + 0.08604366786033459, + 0.09524770161856133, + 0.09831925707485412, + 0.0972196137334867, + 0.09136896786861266, + 0.07869584364026443 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.282988614368218, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7789601515493294, + "wql": 0.31876077146236714 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5009430031873633, + "wql": 0.054414055399222255, + "wsql_by_level": [ + 0.020704028499758984, + 0.04264830848206664, + 0.056493538697129426, + 0.06392819478813645, + 0.06623285943871944, + 0.06568905507651412, + 0.06386734927753936, + 0.060549790587623144, + 0.04961337374551276 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 11.06739475738926, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.659849652693045, + "wql": 0.2965070366301982 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8118503066141809, + "wql": 0.0903541103557254, + "wsql_by_level": [ + 0.0416851710847456, + 0.07182933401264081, + 0.08973702077306783, + 0.09995451616980883, + 0.10467346798819537, + 0.10779549882483362, + 0.10788695121757856, + 0.10283701031897025, + 0.08678802281168775 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 18.02949718730395, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7582205349016864, + "wql": 0.24815809752147944 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9835393729429871, + "wql": 0.1202305594824215, + "wsql_by_level": [ + 0.05957377136305452, + 0.11035088942633253, + 0.13655421268775944, + 0.14696263149601932, + 0.14615864705871415, + 0.14089055453937857, + 0.13108853561837017, + 0.11638960890335283, + 0.09410618424881213 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 25.476193248235948, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6589624695186282, + "wql": 0.27086380960613843 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4399002520277362, + "wql": 0.1117261173917013, + "wsql_by_level": [ + 0.057915873653609916, + 0.10059599161380958, + 0.12500550651428716, + 0.13690749436879018, + 0.14067719819460114, + 0.1368548353503047, + 0.12668884924295498, + 0.10649412265919554, + 0.07439518492775851 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 24.520748805684974, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7750371505251132, + "wql": 0.4828623278639344 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0566742790735535, + "wql": 0.4668021943811344, + "wsql_by_level": [ + 0.19525412295858555, + 0.3324280471543063, + 0.43084776638561234, + 0.5019827037898285, + 0.5576968748825899, + 0.5940841549633602, + 0.5994387734112449, + 0.5540938844417818, + 0.4353934214429002 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 163.83525656823463, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5356559947380156, + "wql": 0.2459106451767321 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1063798674026855, + "wql": 0.6882199867450729, + "wsql_by_level": [ + 0.5536009200124457, + 0.9139950387944059, + 0.9667209620256426, + 0.9209918141952126, + 0.8338890035293596, + 0.7196792605296486, + 0.5865489241607561, + 0.4354225058238108, + 0.26313145163437507 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 518.3082205497415, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.830424930911807, + "wql": 0.8639837681942305 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.25359871460461, + "wql": 0.5067268022878364, + "wsql_by_level": [ + 0.361348850959324, + 0.5736924332381104, + 0.6459651857893787, + 0.6608173449146676, + 0.6369880689552055, + 0.5756893919137944, + 0.4915732335524548, + 0.3796097388774587, + 0.2348569723901339 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 465.01157129059465, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8319311121095695, + "wql": 0.7260680625478289 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3582820297585345, + "wql": 0.485771287013808, + "wsql_by_level": [ + 0.348133693938677, + 0.5645218392086708, + 0.6430183216219211, + 0.6484773855927588, + 0.6072953290788077, + 0.5378492249193259, + 0.4535034773282474, + 0.3513968891731563, + 0.21774542226270713 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 428.75355395845617, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8722691691669417, + "wql": 0.7795763572541483 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5535562752552987, + "wql": 0.21860658743328934, + "wsql_by_level": [ + 0.11523729041202013, + 0.1732432433078884, + 0.21103502712375422, + 0.2371411634758021, + 0.24879008501836786, + 0.25581312446301296, + 0.2565722222593251, + 0.25065163438486476, + 0.21897549645456865 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 133.32078636271984, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6613810523459324, + "wql": 0.24409332027305483 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8188125642797144, + "wql": 0.887132924964408, + "wsql_by_level": [ + 0.3677928439282259, + 0.7412004937740091, + 0.924052099613813, + 1.0173057758388828, + 1.0591716853648903, + 1.0592774778807763, + 1.022336086692638, + 0.9519662001453668, + 0.8410936614410693 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 318.0888615945927, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8406635010700984, + "wql": 0.8032036165806369 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9637004635891747, + "wql": 0.7458390930558292, + "wsql_by_level": [ + 0.2819681940243087, + 0.4421555335829251, + 0.579488216648292, + 0.7057813717109573, + 0.8205201871329453, + 0.9275591901746778, + 1.01228954832903, + 1.0527200047918983, + 0.8900695911074276 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 268.41161867559504, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.8264955063152476, + "wql": 0.7475183317801712 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9128227550199478, + "wql": 0.6164503705061107, + "wsql_by_level": [ + 0.1667402996149958, + 0.3274685395647549, + 0.5059038706630438, + 0.6591369699366805, + 0.7881592974192265, + 0.8497647059205138, + 0.843637199139261, + 0.7815790093931251, + 0.6256634429033955 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 255.31384569896804, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8168182431750837, + "wql": 0.6618088111929687 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5360392063124512, + "wql": 0.009642639559099915, + "wsql_by_level": [ + 0.005733098133037854, + 0.009213655630078194, + 0.011467082364410573, + 0.012655751057562812, + 0.012940088022503838, + 0.012292415250496007, + 0.010516505966427551, + 0.007726232873004891, + 0.0042389267343775185 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 334.8299543698629, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38465258229526617, + "wql": 0.5239263003689041 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6696576684792231, + "wql": 0.008981385622448409, + "wsql_by_level": [ + 0.005331751778029055, + 0.008044294030808252, + 0.009915280005514787, + 0.011046090290877913, + 0.011535862070398608, + 0.011254723090430546, + 0.010210439000257771, + 0.008300229272782357, + 0.005193801062936393 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 276.1697789033254, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7292095550367602, + "wql": 0.6535495768346167 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7066967105107081, + "wql": 0.00936742451680361, + "wsql_by_level": [ + 0.005629511467968731, + 0.008793187584708612, + 0.010748579041822507, + 0.01175967887623714, + 0.01191136715682514, + 0.011446551080278523, + 0.010322059378670076, + 0.008383221853153894, + 0.005312664211567869 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 290.22486827850344, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9438656876717135, + "wql": 0.7237623552274727 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5069899451448083, + "wql": 0.008998344174234042, + "wsql_by_level": [ + 0.005556178087661617, + 0.008744033643495977, + 0.01078966467787696, + 0.011840189028966644, + 0.012005959022949405, + 0.01136685797178068, + 0.009827665119970401, + 0.007216350173407343, + 0.003638199841997361 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 16.09852985569409, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.480145720056509, + "wql": 0.3526682770811413 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6726600733145485, + "wql": 0.009792493856375113, + "wsql_by_level": [ + 0.0060933271150127016, + 0.009231077955106417, + 0.011183324045266303, + 0.01222064085807355, + 0.012462187635068222, + 0.011974562405824762, + 0.010758474087923327, + 0.008721485978516009, + 0.005487364626584703 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.718704311894992, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7046038973706925, + "wql": 0.4164640039185659 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7387476598323179, + "wql": 0.010527255726915583, + "wsql_by_level": [ + 0.006381981991703763, + 0.009860957967795495, + 0.012002492046517774, + 0.013161088761611315, + 0.013459224331144038, + 0.012996300986026126, + 0.011646934279306156, + 0.009299584810410719, + 0.005936736367724856 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 17.19866955666347, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8882452523759936, + "wql": 0.44458221620627997 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.17705087633047883, + "wql": 0.05187020355526987, + "wsql_by_level": [ + 0.03666006257635896, + 0.05439896275700055, + 0.06385191756227543, + 0.06675334017174897, + 0.06502119493233924, + 0.06013221483928606, + 0.05103352834332434, + 0.040425129356094575, + 0.028555481459000744 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.670346125250771, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.22929860454554402, + "wql": 0.23476563654285468 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4634832875562108, + "wql": 0.1518849950284743, + "wsql_by_level": [ + 0.12131976523055941, + 0.16636657372429647, + 0.18763146187425894, + 0.18659673073103195, + 0.17930613759701924, + 0.1707182852918252, + 0.1514670101540839, + 0.11829888075926877, + 0.08526010989392453 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.9905701571631997, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.32148552832157457, + "wql": 0.3225338221892736 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.732942942444992, + "wql": 0.27670848430694606, + "wsql_by_level": [ + 0.14370982606837665, + 0.2289612534070737, + 0.2902555028437663, + 0.33341335276373096, + 0.3660057166539181, + 0.37242302450285936, + 0.3505258583185037, + 0.2672593582175326, + 0.13782246598675293 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.695564794841976, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4357493167967912, + "wql": 0.4095930676660329 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7309399343281955, + "wql": 0.21976458707745083, + "wsql_by_level": [ + 0.1298971749439156, + 0.2269899101453313, + 0.29705628179128907, + 0.3198045610757395, + 0.3173974891573013, + 0.27747144680836966, + 0.20182512740825276, + 0.12888545179837035, + 0.07855384056848795 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.640669440318431, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.46128210115504026, + "wql": 0.39428405169904523 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3532867449049535, + "wql": 0.21296306109525595, + "wsql_by_level": [ + 0.11802098880687888, + 0.18213384332112473, + 0.21781830646367756, + 0.24152120825946233, + 0.25400420683828456, + 0.25337445074602283, + 0.24513251157407437, + 0.22764572484582185, + 0.17701630900195656 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.476493213263651, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.21862298945923864, + "wql": 0.19069193782619465 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.42788644607397197, + "wql": 0.21433571372620938, + "wsql_by_level": [ + 0.11756126198318499, + 0.18850345643100563, + 0.2318751680017934, + 0.25463812371361905, + 0.26090931231263986, + 0.254458363904119, + 0.24139446618968272, + 0.21616564831667198, + 0.1635156226831678 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.942032337623338, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.334227801225649, + "wql": 0.2115005776088368 + } + } + ], + "checkpoint_sha256": "2e4fd324abe8fae2bb2b0d93c132b48bc047985da4d05171edbff36d83edb76c", + "inference_seconds": 356.0625379490666 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/README.md b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d5f1a248c43636b5e1ca7879bba093159202fbf4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/README.md @@ -0,0 +1,9 @@ +# Four-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains four locally trained models totaling 256,594,744 parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed equal weights of 1/4 each. + +Each member retains its declared context limits, listed in model_manifest.json under member_history_caps. A model with a separate encoder_context uses longer history only for learned seasonal summaries; its encoder, normalization and fixed forecast rules use the shorter declared limit. Their history/forecast patch sizes are 16/16, 8/8, 8/4, 16/16, in member order. Each member retains its own original model implementation and normalization; overflow handling follows each member's own implementation. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary uses a fixed width of 128 observations. The zero projection threshold is 0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/config.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a8b1ac135fefe1af2fed2b776af98b61fa593f30 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/config.json @@ -0,0 +1,85 @@ +{ + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "parameters": 36849984, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + }, + { + "weights": "member2.pt", + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "parameters": 36601928, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "model_code": "model2.py" + }, + { + "weights": "member3.pt", + "weights_sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "parameters": 146477344, + "config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model3.py" + } + ], + "weights": [ + 0.25, + 0.25, + 0.25, + 0.25 + ], + "composition": "mean after each member applies its fixed inference rules" +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/continuity.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/continuity.py new file mode 100644 index 0000000000000000000000000000000000000000..bebb06b9c20f322b9d5564650889e2236ae94494 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/continuity.py @@ -0,0 +1,18 @@ +"""Fixed continuity prior for histories whose adjacent samples change slowly.""" +import numpy as np + +def apply_continuity(ctx,quant,tau=24.): + b,_,h=quant.shape + bias=np.zeros(b,np.float32) + positive=((ctx>=0)|~np.isfinite(ctx)).all(-1) + for i in range(b): + x=ctx[i,-512:].astype(np.float64) + if len(x)<8 or not np.isfinite(x[-1]):continue + diff=np.diff(x) + if np.isfinite(diff).sum()<8 or not np.isfinite(diff[-8:]).any():continue + ratio=np.nanmean(diff*diff)/(np.nanvar(x)+1e-12) + weight=float(np.clip(1-ratio/.5,0,.95)) + bias[i]=weight*(x[-1]+np.nanmedian(diff[-8:])-quant[i,4,0]) + out=quant+bias[:,None,None]*np.exp(-np.arange(h)/tau)[None,None,:] + out=np.where(positive[:,None,None],np.maximum(0,out),out) + return out.astype(np.float32) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model0.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model0.py new file mode 100644 index 0000000000000000000000000000000000000000..298ee3b840cbc8b7da585ee5e47a3822d06717b0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model0.py @@ -0,0 +1,260 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras = [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + return torch.stack(deltas, -1), torch.stack(extras, -1) + + + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,long_seasonal_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,long_seasonal_features=long_seasonal_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + self.long_query=nn.Linear(patch*4,d,bias=False) if long_seasonal_features else None + self.long_head=nn.Linear(d,patch*2) if long_seasonal_features else None + if long_seasonal_features: + nn.init.zeros_(self.long_query.weight) + nn.init.zeros_(self.long_head.weight);nn.init.zeros_(self.long_head.bias) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + if self.long_query is not None:long_delta,long_extra=centered_seasonal_difference(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + hidden=self.norm(q) + out=self.head(hidden).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + if self.long_head is not None: + gates=self.long_head(hidden).view(b,h,2).float().tanh() + median=median+(gates*long_delta).sum(-1) + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model1.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model1.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model1.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model2.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model2.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model2.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model3.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model3.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model3.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..101fc0c1749addc8404b43bf05865f220eb26a3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/model_manifest.json @@ -0,0 +1,1330 @@ +{ + "name": "direct-seasonal-four-member-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 256594744, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 307", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/AR/intermittent/changepoint generator at weekly periods52,1, replacing a Bernoulli1/11 share of the original synthetic rows with unchanged total synthetic fraction; independent seed 1000200", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 307", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,503", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 307", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300310", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404", + "synthetic:own stationary Gaussian residuals generated by FFT, equal Matern0.5/1.5/2.5 and RBF spectral families, length scale log-uniform1to10000, theoretical unit marginal variance, FFT size next power of two at least4times window; replacing half of original synthetic residuals with all other generator components unchanged; independent seed 1100200" + ], + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "parameters": 36849984, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + }, + { + "weights": "member2.pt", + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "parameters": 36601928, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "model_code": "model2.py" + }, + { + "weights": "member3.pt", + "weights_sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "parameters": 146477344, + "config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model3.py" + } + ], + "checkpoint_sha256": "fa97880dd132b1cdff459be4798f8f360d7df59b13e78026a9d74a95d63df0db", + "checkpoint_digest_method": "SHA-256 of config.json, including ordered member weight hashes", + "training_lineage": [ + { + "checkpoint": "long_seasonal_transfer12k.pt", + "sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "matched training delta after zero extension of new seasonal query/head parameters", + "formula": "extend_zero(base) + candidate - extend_zero(control)", + "coefficient": 1.0, + "new_parameters_from_candidate": [ + "long_head.bias", + "long_head.weight", + "long_query.weight" + ], + "parent_hashes": { + "/workspace/research/spectral_add_delta6k.pt": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "/workspace/research/runs/long_seasonal/ema012000.pt": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "/workspace/research/runs/overflow_control/ema012000.pt": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819" + }, + "base_extension_forward_bitwise_equal": true, + "check_seed": 571, + "seconds": 2.5279976530000567, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "spectral_add_delta6k.pt", + "runs/long_seasonal/ema012000.pt", + "runs/overflow_control/ema012000.pt" + ] + }, + { + "checkpoint": "spectral_add_delta6k.pt", + "sha256": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/weekly_slow_ar_delta6k.pt": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "/workspace/research/runs/spectral_synth/ema006000.pt": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 1.4204325219616294 + }, + "parents": [ + "weekly_slow_ar_delta6k.pt", + "runs/spectral_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/long_seasonal/ema012000.pt", + "sha256": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "parents": [ + "long_seasonal_initial.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema012000.pt", + "sha256": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "weekly_slow_ar_delta6k.pt", + "sha256": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema006000.pt": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 2.0751679679378867 + }, + "parents": [ + "postloss_slow_ar_delta6k.pt", + "runs/weekly_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/spectral_synth/ema006000.pt", + "sha256": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "spectral_synthetic_seed": 1100200, + "spectral_replacement_probability": 0.5, + "spectral_length_scale": [ + 1, + 10000 + ], + "spectral_families": [ + "Matern0.5", + "Matern1.5", + "Matern2.5", + "RBF" + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt", + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema006000.pt", + "sha256": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "long_seasonal_initial.pt", + "sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "step": 0, + "seed": 503, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "zero-initialized sixteen-cycle centered seasonal query/head additions", + "parent_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/weekly_synth/ema006000.pt", + "sha256": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "weekly_synthetic_seed": 1000200, + "weekly_replacement_probability": 0.09090909090909091, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/random_capacity_1024/ema048000.pt", + "sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "step": 48000, + "seed": 307, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 48, + "lr": 0.0002, + "steps": 96000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": true, + "synthetic_ar_time_constants": [ + 1, + 10000 + ], + "requested_horizon_seed": 300310, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "random_capacity_1024_initial.pt" + ] + }, + { + "checkpoint": "random_capacity_1024_initial.pt", + "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", + "step": 0, + "seed": 307, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "initialization": "random initialization in this workspace" + } + ], + "ensemble_weights": [ + 0.25, + 0.25, + 0.25, + 0.25 + ], + "every_member_forecasts_every_instance": true, + "member_history_caps": [ + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + } + ], + "postprocessing_order": "each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4, finite-value replacement; then equal quantile average", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "model2.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "model3.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "model0.py": "3eaa4aed0a1c62b80d94be6c3084b10a594e9fce17444eac17ca3f1b0b5c549e", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "predict.py": "15b86dbaa19128df1105b6dd4243f2aa1321aff3fc45685a0a9811d8862d7add", + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "model1.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e" + }, + "notes": "All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation." +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..818ba6ab67470c891c5f1eb3291b85bb39825c09 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/predict.py @@ -0,0 +1,72 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import importlib.util +from seasonal import apply_gate +from continuity import apply_continuity +from zero_mass import project +import ts_io + +def load_model(checkpoint,device='cuda'): + from types import SimpleNamespace + path=Path(checkpoint);descriptor=json.loads(path.read_text());members=[] + for entry in descriptor['members']: + ck=torch.load(path.parent/entry['weights'],map_location='cpu',weights_only=False) + spec=importlib.util.spec_from_file_location('member_model_'+str(len(members)),path.parent/entry['model_code']) + module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) + model=module.DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval();members.append(model) + assert len(members)==4 + return SimpleNamespace(models=members,max_context=max(m.max_context for m in members)) + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + forecasts=[] + for member in model.models: + member_ctx=ctx[:,-member.max_context:] + member_x=x[:,-member.max_context:] + rule_context=getattr(member,'rule_context',member.max_context) + rule_ctx=member_ctx[:,-rule_context:] + rule_x=member_x[:,-rule_context:] + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16): + qq,mu,scale=member(torch.cat((member_x,-member_x),0),p.repeat(2,1),h) + qq=qq*scale[:,:,None]+mu[:,:,None] + qq=(qq[:len(ids)]-qq[len(ids):].flip(-1))*.5 + recent=rule_x[:,-4096:] + positive=((recent>=0)|~torch.isfinite(recent)).all(-1) + qq=torch.where(positive[:,None,None],qq.clamp(min=0),qq) + q=qq.transpose(1,2).float().cpu().numpy() + q=apply_gate(rule_ctx[:,-4096:],p.cpu().numpy(),q) + q=project(rule_ctx,apply_continuity(rule_ctx,q)) + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + forecasts.append(q) + q=(forecasts[0]+forecasts[1]+forecasts[2]+forecasts[3])/4 + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'config.json'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..6791dbc71db3e966ce77e49b8abc2a6560ca8053 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/model_manifest.json @@ -0,0 +1,1205 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36849984, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/AR/intermittent/changepoint generator at weekly periods52,1, replacing a Bernoulli1/11 share of the original synthetic rows with unchanged total synthetic fraction; independent seed 1000200", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,503", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own stationary Gaussian residuals generated by FFT, equal Matern0.5/1.5/2.5 and RBF spectral families, length scale log-uniform1to10000, theoretical unit marginal variance, FFT size next power of two at least4times window; replacing half of original synthetic residuals with all other generator components unchanged; independent seed 1100200" + ], + "weights_sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "training_lineage": [ + { + "checkpoint": "long_seasonal_transfer12k.pt", + "sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "matched training delta after zero extension of new seasonal query/head parameters", + "formula": "extend_zero(base) + candidate - extend_zero(control)", + "coefficient": 1.0, + "new_parameters_from_candidate": [ + "long_head.bias", + "long_head.weight", + "long_query.weight" + ], + "parent_hashes": { + "/workspace/research/spectral_add_delta6k.pt": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "/workspace/research/runs/long_seasonal/ema012000.pt": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "/workspace/research/runs/overflow_control/ema012000.pt": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819" + }, + "base_extension_forward_bitwise_equal": true, + "check_seed": 571, + "seconds": 2.5279976530000567, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "spectral_add_delta6k.pt", + "runs/long_seasonal/ema012000.pt", + "runs/overflow_control/ema012000.pt" + ] + }, + { + "checkpoint": "spectral_add_delta6k.pt", + "sha256": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/weekly_slow_ar_delta6k.pt": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "/workspace/research/runs/spectral_synth/ema006000.pt": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 1.4204325219616294 + }, + "parents": [ + "weekly_slow_ar_delta6k.pt", + "runs/spectral_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/long_seasonal/ema012000.pt", + "sha256": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "parents": [ + "long_seasonal_initial.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema012000.pt", + "sha256": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "weekly_slow_ar_delta6k.pt", + "sha256": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema006000.pt": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 2.0751679679378867 + }, + "parents": [ + "postloss_slow_ar_delta6k.pt", + "runs/weekly_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/spectral_synth/ema006000.pt", + "sha256": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "spectral_synthetic_seed": 1100200, + "spectral_replacement_probability": 0.5, + "spectral_length_scale": [ + 1, + 10000 + ], + "spectral_families": [ + "Matern0.5", + "Matern1.5", + "Matern2.5", + "RBF" + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt", + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema006000.pt", + "sha256": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "long_seasonal_initial.pt", + "sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "step": 0, + "seed": 503, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "zero-initialized sixteen-cycle centered seasonal query/head additions", + "parent_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/weekly_synth/ema006000.pt", + "sha256": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "weekly_synthetic_seed": 1000200, + "weekly_replacement_probability": 0.09090909090909091, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "model.py": "3eaa4aed0a1c62b80d94be6c3084b10a594e9fce17444eac17ca3f1b0b5c549e" + }, + "checkpoint_composition": { + "method": "matched training delta after zero extension of new seasonal query/head parameters", + "formula": "extend_zero(base) + candidate - extend_zero(control)", + "coefficient": 1.0, + "new_parameters_from_candidate": [ + "long_head.bias", + "long_head.weight", + "long_query.weight" + ], + "parent_hashes": { + "/workspace/research/spectral_add_delta6k.pt": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "/workspace/research/runs/long_seasonal/ema012000.pt": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "/workspace/research/runs/overflow_control/ema012000.pt": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819" + }, + "base_extension_forward_bitwise_equal": true, + "check_seed": 571, + "seconds": 2.5279976530000567, + "optimizer_updates": 0, + "validation_data_read": false + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 32768, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "long_seasonal_features": { + "cycles": [ + 4, + 16 + ], + "each_cycle_centered": true, + "minimum_total_cycles": 8, + "minimum_recent_cycles": 2, + "query_features": [ + "centered16-minus4 phase mean", + "observed16-cycle fraction" + ], + "median_shift": "sum of two learned tanh gates times template differences", + "same_shift_all_quantiles": true, + "maximum_context": 4096, + "parameters_fixed_at_inference": true + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "confidence_query/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "confidence_query/model.py": "b4f11ba2018e2b50879cdc33acf0138301548971508b58035a7c96a29aaa6f2d", + "confidence_query/train.py": "fc8a7555a5a6b0a6f91e80ac8cc9cbbfddaa2b26468c57f49dfb17671b22ce93", + "direct_large/data.py": "6e6db217936f8dd79380d2ceff3eaa8598a44f1b60b17acae7bfde2363116847", + "direct_large/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "direct_large/model.py": "146d93a3f95b13bda8b1b437bc36621b91356cf946e94f62999f89e7fb348071", + "direct_large/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "direct_large/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "direct_large/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "direct_large/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "direct_large/train.py": "b9ad6b2adddeaf12961b529d6535dd33f6d044a31979b5c9e49dceafbadd3ac0", + "direct_large/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "direct_large/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "full_paired/check.py": "90ac1c78846439d51ab8acd62a19bd536c7c394bd02e94f6d5ff17c0af8bd116", + "full_paired/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "full_paired/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "horizon_jitter/data.py": "5044cf648323420095ed6058d29f837c07ff5559b606df8b00cc8d1e95c8b58e", + "horizon_jitter/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "horizon_jitter/train.py": "4e9cbca1293f18f7eea2c72dba127815c0934a13c86e8f6cc881a749676d41a6", + "large_corpus/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "large_corpus/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "large_corpus/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "large_sign/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "large_sign/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "large_sign/model.py": "3fff6445a1982a1b3c92f06a9b5f1bb627dda6a291b0b2364bcfb1a6457830d7", + "large_sign/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "large_sign/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "large_sign/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "large_sign/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "large_sign/train.py": "a597f40ab87cce04e96dc654d12e56cdf40ffd87f00034d8bc4d56dff4eb7c68", + "large_sign/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "large_sign/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "long_memory_synth/data.py": "2955ec414de97f7ec91c8863873b7ae50ebe8f0ccb7fe48c41599e69da88ec34", + "long_memory_synth/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "long_memory_synth/train.py": "75918ac02d30ad8289632bc8a3ce1386c949fd670522799af59536d4cab0b9e9", + "long_seasonal/check.py": "e55fe780892204889e210d1591ae3f0b964d72ec1916b9b5e768b938aba28fc1", + "long_seasonal/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "long_seasonal/launch.py": "68c56b8abde125eb8de866807f8deb946c30e4c52866bc0cafcab82198b58def", + "long_seasonal/long_features.py": "270d84ff1208085f65856e8c489998e6248af5c5ea1c3c47b5161f7d6b621b13", + "long_seasonal/model.py": "3eaa4aed0a1c62b80d94be6c3084b10a594e9fce17444eac17ca3f1b0b5c549e", + "long_seasonal/transfer.py": "301df5a793988edbe50b3384c5777d8679161142943578bc7723a552ed4f3d04", + "overflow_control/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "overflow_control/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "partial_delta/merge.py": "63984a0f46f7d48817037f5bf5a1c9319e45a9b1924cde62c667ac49ce47532e", + "partial_targets/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "partial_targets/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "partial_targets/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "patch16/convert.py": "11e1d30100ab25311020ac1f4ab8227ec66156836df5de613300867977091c45", + "patch16/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "patch16/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "patch16/model.py": "8031c597b354eb2cf464140bee40c3ec8dff86c775b5c55c5ce910302b443582", + "patch16/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "patch16/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "patch16/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "patch16/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "patch16/train.py": "3156710f76111a31447cbe638ee27fe2811d060917aa083aab0b5134d98accf8", + "patch16/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "patch16/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "postloss/check_numerical_fix.py": "527dffcd94ec1a02b214dd300261d189b06c386f0b8c4d4df3320098f5fc0e68", + "postloss/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "postloss/diagnose_nonfinite.py": "82d10c5751ea1d21ecd36cd5eb54c00aabcaf78a8562b259551d028d452be47b", + "postloss/gpu_check.py": "c0a7e23d9f74cdab4fa04e1a4b9f89c64bb58f5e24228aa5e0f2cf554fef2d1f", + "postloss/launch_completion.py": "ef584b22259e3bc741b16ef876a6120bfcee08e2b9237a7990ed560a0dbf77ae", + "postloss/model.py": "d4b76fb1a63789e091b114dd947abe30be3e47c2e2e9d41cecb3e3353af86ac5", + "postloss/model_before_numerical_fix.py": "1ad846ac7adc16298b9643a79f4ee1b94f4db82fa716c6db77a2fcbb2160c261", + "postloss/restart.py": "5baa9a0947a0d30f7773113c05bd1f53b8ed1817aeaa2365078b06df9ce2fbca", + "postloss/torch_post.py": "0762fc5d330a4039798a81788e4adb8bfe206aba2aa29a1b53ecad0bd3bff217", + "recency_features/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "recency_features/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "recency_features/train.py": "a654b9a27b6c27141e1d4e517ab28fcae3f2c23d061742fa2f6c01e3d23c8a00", + "recovery/brief.py": "ee9ea6b8e1778f4b735cf96ef890364866d58310b4cdd9296d374c0417593ceb", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/quantile_coverage.py": "7a4057d1aa38c5e7de0ca601db0003a8fd3a9a2e6123b2fdb81fa8aedbc34787", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/seasonal_history_support.py": "fe2da1a695715c3add9472f0bfebc946783b179b1a8415f85565a937885f7076", + "recovery/snapshot.py": "83f026b90a7dd9182da20f34bf206e6bd449b7c7ff7ea12ae2ad5e32024a5820", + "recovery/train.py": "5c486372fd12a84eee823f1a2c2de14d64bde6b7bd6adafd5e80339b9dd7a6bd", + "spectral_synth/check.py": "c308c87af0a6756fafefa460751cc370ed44ee98f3f52364b1ed6879a3c4e110", + "spectral_synth/data.py": "1780475ef9573c9731cf67f46c1a339ab2fa466c28bbbee5948322ae3f33ca29", + "spectral_synth/launch.py": "5888c115ae4b38b307ac1ac1bb4a9c200a1aa35850819dab55eaeb47946c38e2", + "spectral_synth/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "spectral_synth/spectral.py": "347aa6d352df72ff18ef35a267b8e0479546263b26174d5256d4e9903cce5f71", + "spectral_transfer/run.py": "33fb544faca0633cd96440e2e4fa3c0e38c8e8cde8a215bfaf8357ed224bfcd8", + "weekly_synth/check.py": "a122b553d9ddc01a506a36713a0df478b03d7fe0b3f9ee1fa34c22c3e982adbf", + "weekly_synth/data.py": "774d0d5216fa263db9d809289dd3daa877f0bcea6ed44a628dd9f8e53829815f", + "weekly_synth/launch.py": "b28347982ecf6d87b45970824d0961027297296e8a6d4372414caeae28427e9d", + "weekly_synth/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/direct_large/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fda928e16338305fd9912f7bc08cacff58bd8aa4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/check.py @@ -0,0 +1,34 @@ +import importlib.util,json,time +from pathlib import Path +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +r=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197);start=time.monotonic() +ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +spec=importlib.util.spec_from_file_location('parent_model',r/'confidence_inference/model.py') +old=importlib.util.module_from_spec(spec);spec.loader.exec_module(old) +parent=old.DirectForecaster(**ck['config']);parent.load_state_dict(ck['model']) +m=DirectForecaster(**ck['config']);m.load_state_dict(ck['model']) +x=torch.randn(4,512);x[0,:50]=float('nan');p=torch.tensor([[24,168]]*4);y=torch.randn(4,128);y[0,32:]=float('nan') +with torch.inference_mode(): + assert all(torch.equal(a,b) for a,b in zip(m(x,p,48),parent(x,p,48))) + short=m(x,p,32)[0];long=m(x,p,128,forecast_lengths=torch.full((4,),32))[0][:,:32] + assert torch.allclose(short,long,atol=3e-6,rtol=1e-6),(short-long).abs().max() + paired=float(loss_fn(m,x,y,p,paired=True));reverse=float(loss_fn(m,-x,-y,p,paired=True)) + assert abs(paired-reverse)<1e-7,(paired,reverse) +a=Sampler(r/'packed_sample',197);b=Sampler(r/'packed_sample',197) +for c,h in [(512,32),(4096,1024)]: + assert all(np.array_equal(v,w,equal_nan=True) for v,w in zip(a.sample(16,c,h),b.sample(16,c,h))) +assert a.rng.bit_generator.state==b.rng.bit_generator.state and a.horizon_rng.bit_generator.state==b.horizon_rng.bit_generator.state +cpu=time.monotonic()-start;del parent,ck,a,b +m=m.cuda();ema={k:v.detach().clone() for k,v in m.state_dict().items()} +moments=[torch.zeros_like(v) for v in m.parameters() for _ in range(2)] +torch.backends.cuda.matmul.allow_tf32=True;torch.cuda.reset_peak_memory_stats();start=time.monotonic() +x=torch.randn(64,4096,device='cuda');y=torch.randn(64,1024,device='cuda');p=torch.tensor([[24,168]]*64,device='cuda') +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +z={'cpu_seconds':cpu,'initial_forecast_bitwise_parent':True,'unused_future_tokens_do_not_change_requested_prefix':True,'paired_loss_sign_symmetric':True,'matched_sampler_main_and_horizon_rng':True,'gpu_fixture_seconds':time.monotonic()-start,'allocated_mib':torch.cuda.max_memory_allocated()/2**20,'reserved_mib':torch.cuda.max_memory_reserved()/2**20,'optimizer_updates':0} +(r/'full_paired_checks.json').write_text(json.dumps(z,indent=2));print(json.dumps(z),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/large_sign/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..95410ba700e638fc2e1375b14dece4df57c10110 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=np.exp(-10**(-r.uniform(0,4)));noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/train.py new file mode 100644 index 0000000000000000000000000000000000000000..61de733eea03837247278d9010c2ed8b955d7359 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_memory_synth/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + a.synthetic_ar_time_constants=[1,10000] + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/check.py new file mode 100644 index 0000000000000000000000000000000000000000..beba62576fae73576eef907b81c674e96622670d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/check.py @@ -0,0 +1,145 @@ +"""Check exact initialization, fixed feature arithmetic and allowed-data gradients.""" +import argparse +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path + +import numpy as np +import torch + +R = Path('/workspace/research') +sys.path.insert(0, str(R / 'long_seasonal')) +from model import DirectForecaster, centered_seasonal_difference, loss_fn +from data import Sampler + +ap = argparse.ArgumentParser() +ap.add_argument('--gpu', action='store_true') +a = ap.parse_args() +torch.set_num_threads(2) +torch.manual_seed(503) +started = time.monotonic() +spec = importlib.util.spec_from_file_location('long_control_model', R / 'overflow_control/model.py') +control_code = importlib.util.module_from_spec(spec) +spec.loader.exec_module(control_code) +parent_path = R / 'horizon_delta12k.pt' +parent = torch.load(parent_path, map_location='cpu', weights_only=False) +config = dict(parent['config'], long_seasonal_features=True) +candidate = DirectForecaster(**config) +missing, unexpected = candidate.load_state_dict(parent['model'], strict=False) +assert set(missing) == {'long_query.weight', 'long_head.weight', 'long_head.bias'} +assert not unexpected +assert all(torch.count_nonzero(candidate.state_dict()[key]) == 0 for key in missing) +control = control_code.DirectForecaster(**parent['config']) +control.load_state_dict(parent['model']) +assert all(torch.equal(value, candidate.state_dict()[key]) for key, value in parent['model'].items()) + +if a.gpu: + import fcntl + lock = open(R / '.evaluation.lock', 'a') + fcntl.flock(lock, fcntl.LOCK_EX) + device = 'cuda' + torch.backends.cuda.matmul.allow_tf32 = False + candidate = candidate.cuda() + control = control.cuda() + rng = np.random.default_rng(509) + x = torch.tensor(rng.normal(size=(8, 512)).astype(np.float32), device=device) + x[0, :23] = float('nan') + x[1] = 0 + p = torch.tensor([[24,168],[7,365],[12,1],[52,1],[4,1],[1,1],[96,672],[2,14]], device=device) + with torch.inference_mode(), torch.autocast('cuda', dtype=torch.bfloat16): + expected = control(x, p, 128) + actual = candidate(x, p, 128) + assert all(torch.equal(v, w) for v, w in zip(expected, actual)) + del control, expected, actual, x, p + torch.cuda.empty_cache() + torch.cuda.reset_peak_memory_stats() + sampler = Sampler(R / 'packed_sample', seed=509, source_weights_from=R / 'packed_sample') + arrays = sampler.sample(64, 4096, 1024) + tensors = [torch.from_numpy(v).cuda() for v in arrays] + placeholders = [torch.zeros_like(v) for v in candidate.parameters() for _ in range(3)] + with torch.autocast('cuda', dtype=torch.bfloat16): + loss = loss_fn(candidate, *tensors, paired=True) + loss.backward() + assert torch.isfinite(loss) + assert all(v.grad is None or torch.isfinite(v.grad).all() for v in candidate.parameters()) + gradients = {key: float(dict(candidate.named_parameters())[key].grad.norm()) for key in missing} + assert gradients['long_head.weight'] > 0 and gradients['long_query.weight'] > 0 + result = dict(seed=509, gpu_initial_function_bitwise_equal=True, + max_shape=[64,4096,1024], loss=float(loss.detach()), added_gradient_norms=gradients, + reserved_mib=torch.cuda.max_memory_reserved()/2**20, + allocated_mib=torch.cuda.max_memory_allocated()/2**20, + includes_ema_and_adam_placeholders=True, seconds=time.monotonic()-started, + optimizer_updates=0, validation_data_read=False) + (R / 'long_seasonal_gpu_checks.json').write_text(json.dumps(result, indent=2)) + print(json.dumps(result)) + raise SystemExit() + +rng = np.random.default_rng(503) +z = rng.normal(size=(4, 96)).astype(np.float32) +valid = rng.random(z.shape) > .12 +z[~valid] = 0 +periods = np.array([[4,7],[2,3],[12,1],[24,168]], dtype=np.int64) +delta, extra = centered_seasonal_difference(torch.from_numpy(z), torch.from_numpy(valid), + torch.from_numpy(periods), 23) +expected = np.zeros((4,23,2), np.float32) +support = np.zeros_like(expected) +for row in range(4): + for j in range(2): + period = int(periods[row,j]) + for t in range(23): + observations, recent = [], [] + for cycle in range(16): + end = max(0, 96-cycle*period) + start = max(0, 96-(cycle+1)*period) + index = 96-period+t%period-cycle*period + if index < 0 or not valid[row,index]: + continue + mean = z[row,start:end][valid[row,start:end]].mean(dtype=np.float64) + value = float(z[row,index])-mean + observations.append(value) + if cycle < 4: + recent.append(value) + if period>=2 and len(observations)>=8 and len(recent)>=2: + expected[row,t,j] = np.mean(observations)-np.mean(recent) + support[row,t,j] = len(observations)/16 +assert np.max(np.abs(delta.numpy()-expected)) < 1e-6 +assert np.array_equal(extra.numpy()[:,:,[1,3]], support) +# Adding a different constant to each complete cycle leaves centered templates unchanged. +z0 = torch.tensor(rng.normal(size=(1,64)).astype(np.float32)) +offsets = torch.tensor(rng.normal(size=(1,16,1)).astype(np.float32)) +z1 = (z0.view(1,16,4)+offsets).view(1,64) +p = torch.tensor([[4,4]]) +ones = torch.ones_like(z0,dtype=torch.bool) +v0 = centered_seasonal_difference(z0,ones,p,16)[0] +v1 = centered_seasonal_difference(z1,ones,p,16)[0] +assert torch.max(torch.abs(v0-v1)) < 1e-6 +for c,h in [(32,6),(96,23),(512,128)]: + ctx = torch.tensor(rng.normal(size=(4,c)).astype(np.float32)) + ctx[0,:c//3] = float('nan') + ctx[1] = 0 + ctx[2] = float('nan') + with torch.inference_mode(): + expected = control(ctx,torch.from_numpy(periods),h) + actual = candidate(ctx,torch.from_numpy(periods),h) + assert all(torch.equal(v,w) for v,w in zip(expected,actual)) +assert (R/'long_seasonal/data.py').read_bytes()==(R/'overflow_control/data.py').read_bytes() +out = R / 'long_seasonal_initial.pt' +assert not out.exists(), 'Do not overwrite an existing declared initial checkpoint' +checkpoint = dict(model=candidate.state_dict(), config=config, step=0, + args=dict(packed=str(R/'packed_sample'), seed=503), + parent_checkpoints=[str(parent_path)], + conversion=dict(method='zero-initialized sixteen-cycle centered seasonal query/head additions', + parent_sha256=hashlib.sha256(parent_path.read_bytes()).hexdigest(), + initial_function_bitwise_equal=True)) +torch.save(checkpoint,out) +result = dict(seed=503, independent_feature_arithmetic=True, centered_cycle_offset_invariance=True, + initial_function_bitwise_equal=True, inherited_weights_bitwise_equal=True, + sampler_byte_identical=True, added_parameters=sum(candidate.state_dict()[k].numel() for k in missing), + total_parameters=sum(v.numel() for v in candidate.parameters()), + checkpoint_sha256=hashlib.sha256(out.read_bytes()).hexdigest(), + seconds=time.monotonic()-started, optimizer_updates=0, validation_data_read=False) +(R/'long_seasonal_checks.json').write_text(json.dumps(result,indent=2)) +print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..d7fd732aae9def625f17a4d15dd2dbe3f4cd9317 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/launch.py @@ -0,0 +1,31 @@ +"""Queue the audited learned sixteen-cycle summary after nested-volume training.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + checks=json.loads((R/'long_seasonal_checks.json').read_text()) + assert checks['initial_function_bitwise_equal'] and checks['inherited_weights_bitwise_equal'] + assert checks['independent_feature_arithmetic'] and checks['sampler_byte_identical'] + gpu=json.loads((R/'long_seasonal_gpu_checks.json').read_text()) + assert gpu['gpu_initial_function_bitwise_equal'] and gpu['reserved_mib']<10000 + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'long_seasonal'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/long_seasonal'),'--initialize-from',str(R/'long_seasonal_initial.pt'), + '--steps','12000','--batch','64','--lr','.00002','--seed','197','--loss-mode','paired', + '--stop-file',str(R/'long_seasonal.stop')] + with (R/'long_seasonal_queue.log').open('w') as qlog,(R/'long_seasonal_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E107 learned sixteen-cycle summary seed197', + '--log',str(R/'long_seasonal_train.log'),'--receipt',str(R/'long_seasonal_queue.json'), + '--wait-pid','13470','--require-checkpoint',str(R/'runs/stratified_volume/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/long_seasonal'), + '--evaluator',str(R/'long_seasonal_inference/evaluate.py'),'--name','long_seasonal', + '--expected-packed',str(R/'packed_sample'),'--steps','1000,3000,6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/long_features.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/long_features.py new file mode 100644 index 0000000000000000000000000000000000000000..efc6e3ba327c6016d844148fcfcc29ac63863f23 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/long_features.py @@ -0,0 +1,37 @@ +"""Fixed within-context phase summaries; no estimated or adapted parameters.""" +import torch +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras = [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + return torch.stack(deltas, -1), torch.stack(extras, -1) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/model.py new file mode 100644 index 0000000000000000000000000000000000000000..298ee3b840cbc8b7da585ee5e47a3822d06717b0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/model.py @@ -0,0 +1,260 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras = [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + return torch.stack(deltas, -1), torch.stack(extras, -1) + + + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,long_seasonal_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,long_seasonal_features=long_seasonal_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + self.long_query=nn.Linear(patch*4,d,bias=False) if long_seasonal_features else None + self.long_head=nn.Linear(d,patch*2) if long_seasonal_features else None + if long_seasonal_features: + nn.init.zeros_(self.long_query.weight) + nn.init.zeros_(self.long_head.weight);nn.init.zeros_(self.long_head.bias) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + if self.long_query is not None:long_delta,long_extra=centered_seasonal_difference(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + hidden=self.norm(q) + out=self.head(hidden).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + if self.long_head is not None: + gates=self.long_head(hidden).view(b,h,2).float().tanh() + median=median+(gates*long_delta).sum(-1) + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/transfer.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/transfer.py new file mode 100644 index 0000000000000000000000000000000000000000..c20a4df852f5b150e634ae2c06510d01c7ea18b3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/long_seasonal/transfer.py @@ -0,0 +1,73 @@ +"""Apply one matched feature-learning difference with explicit zero-extension semantics.""" +import argparse +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path + +import numpy as np +import torch + +R = Path('/workspace/research') +parser = argparse.ArgumentParser() +for key in ['base','candidate','control','out']: + parser.add_argument('--'+key,required=True) +args = parser.parse_args() +torch.set_num_threads(2) +torch.manual_seed(571) +started = time.monotonic() +paths = [Path(args.base),Path(args.candidate),Path(args.control)] +base,candidate,control = [torch.load(p,map_location='cpu',weights_only=False) for p in paths] +extra = {'long_query.weight','long_head.weight','long_head.bias'} +assert set(base['model'])==set(control['model']) +assert set(candidate['model'])==set(base['model'])|extra +config = dict(candidate['config']) +assert config.pop('long_seasonal_features') is True +assert config==base['config']==control['config'] +sys.path.insert(0,str(R/'long_seasonal')) +from model import DirectForecaster +extended = DirectForecaster(**candidate['config']) +missing,unexpected = extended.load_state_dict(base['model'],strict=False) +assert set(missing)==extra and not unexpected +assert all(torch.count_nonzero(extended.state_dict()[k])==0 for k in extra) +spec = importlib.util.spec_from_file_location('transfer_original_model',R/'overflow_control/model.py') +code = importlib.util.module_from_spec(spec) +spec.loader.exec_module(code) +original = code.DirectForecaster(**base['config']) +original.load_state_dict(base['model']) +rng = np.random.default_rng(571) +periods = torch.tensor([[24,168],[7,365],[52,1],[1,1]]) +for c,h in [(32,6),(512,128)]: + ctx = torch.tensor(rng.normal(size=(4,c)).astype(np.float32)) + ctx[0,:c//3] = float('nan') + ctx[1] = 0 + ctx[2] = float('nan') + with torch.inference_mode(): + a = original(ctx,periods,h) + b = extended(ctx,periods,h) + assert all(torch.equal(v,w) for v,w in zip(a,b)) +weights = {k:v.clone() for k,v in extended.state_dict().items()} +for k in weights: + if k in extra: + weights[k].copy_(candidate['model'][k]) + else: + assert weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +out = Path(args.out) +assert not out.exists(),'Refuse to overwrite a declared fixed candidate' +conversion = dict(method='matched training delta after zero extension of new seasonal query/head parameters', + formula='extend_zero(base) + candidate - extend_zero(control)',coefficient=1.0, + new_parameters_from_candidate=sorted(extra), + parent_hashes={str(p):hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}, + base_extension_forward_bitwise_equal=True,check_seed=571, + seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) +checkpoint = dict(model=weights,config=candidate['config'],step=0,args={'packed':base['args']['packed']}, + parent_checkpoints=[str(p) for p in paths],conversion=conversion) +torch.save(checkpoint,out) +result = dict(conversion,checkpoint_sha256=hashlib.sha256(out.read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in weights.values())) +out.with_suffix('.json').write_text(json.dumps(result,indent=2)) +print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/overflow_control/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/overflow_control/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/overflow_control/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/overflow_control/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/overflow_control/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/overflow_control/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/patch16/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/check_numerical_fix.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/check_numerical_fix.py new file mode 100644 index 0000000000000000000000000000000000000000..0dd7f0b04a538020f59a4d4e8d6bc4884e0acd29 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/check_numerical_fix.py @@ -0,0 +1,26 @@ +"""Regression test for observed variance overflow in permitted training data.""" +import importlib.util +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster,loss_fn + +R=Path('/workspace/research');torch.set_num_threads(1);started=time.monotonic() +spec=importlib.util.spec_from_file_location('original',Path(__file__).with_name('model_before_numerical_fix.py')) +original=importlib.util.module_from_spec(spec);spec.loader.exec_module(original) +torch.manual_seed(331);normal=torch.randn(8,512);normal[0,:200]=float('nan');normal[1]=float('nan');normal[2]=0 +old=original.DirectForecaster.standardize(normal);new=DirectForecaster.standardize(normal) +assert all(torch.equal(a,b) for a,b in zip(old,new)) +f=torch.load(R/'postloss_nonfinite_fixture.pt',map_location='cpu',weights_only=False) +indices=torch.tensor([37]);ctx=f['ctx'][indices];target=f['target'][indices];periods=f['periods'][indices] +z,valid,mu,scale=DirectForecaster.standardize(ctx) +assert torch.isfinite(z).all() and torch.isfinite(mu).all() and torch.isfinite(scale).all() +ck=torch.load(R/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,ctx.cuda(),target.cuda(),periods.cuda(),paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +result={'ordinary_rows_bitwise_original':True,'observed_overflow_row_loss':float(loss.detach()), + 'all_gradients_finite':True,'optimizer_updates':0,'seconds':time.monotonic()-started} +(R/'postloss_numerical_fix_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/diagnose_nonfinite.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/diagnose_nonfinite.py new file mode 100644 index 0000000000000000000000000000000000000000..770ff91d0718cbb6b947fc91fd61697ea50cbfd6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/diagnose_nonfinite.py @@ -0,0 +1,42 @@ +"""Find nonfinite fixed-transform outputs on the unchanged allowed-corpus stream.""" +import json +from pathlib import Path +import time +import numpy as np +import torch +from model import DirectForecaster +from data import Sampler +from torch_post import apply_fixed,context_statistics + +R=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197) +torch.backends.cuda.matmul.allow_tf32=True +ck=torch.load(R/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']);m.eval() +sampler=Sampler(R/'packed_sample',seed=197,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(197);started=time.monotonic() +for step in range(1,251): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + arrays=sampler.sample(64,c,h);ctx,target,periods=[torch.from_numpy(v).cuda() for v in arrays] + with torch.no_grad(),torch.autocast('cuda',dtype=torch.bfloat16): + seen=torch.isfinite(target);pos=torch.arange(h,device=ctx.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + raw,mu,scale=m(torch.cat((ctx,-ctx),0),periods.repeat(2,1),h,forecast_lengths=lengths.repeat(2)) + q=(raw[:64]-raw[64:].flip(-1))*.5;mu=mu[:64];scale=scale[:64] + denormalized=q*scale[:,:,None]+mu[:,:,None] + post=apply_fixed(ctx,periods,denormalized) + bad=~torch.isfinite(post).all((1,2)) + if bad.any(): + stats=context_statistics(ctx,periods,h) + badids=torch.nonzero(bad)[:,0] + receipt={'step':step,'context':c,'horizon':h,'bad_rows':badids.tolist(), + 'raw_finite':bool(torch.isfinite(q).all()),'scale_finite':bool(torch.isfinite(scale).all()), + 'denormalized_finite':bool(torch.isfinite(denormalized).all()), + 'statistics_finite':[bool(torch.isfinite(v).all()) for v in stats], + 'bad_scale':scale[bad].tolist(),'bad_mu':mu[bad].tolist(), + 'bad_maximum_context':torch.nan_to_num(ctx[bad]).abs().max(-1).values.tolist(), + 'seconds':time.monotonic()-started,'optimizer_updates':0} + torch.save({'ctx':ctx.cpu(),'target':target.cpu(),'periods':periods.cpu(), + 'raw':denormalized.cpu(),'scale':scale.cpu(),'post':post.cpu(), + 'statistics':[v.cpu() for v in stats]},R/'postloss_nonfinite_fixture.pt') + (R/'postloss_nonfinite_diagnostic.json').write_text(json.dumps(receipt,indent=2));print(json.dumps(receipt));break +else:print(json.dumps({'no_nonfinite_fixed_parent_outputs_in_first_steps':250,'seconds':time.monotonic()-started})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/gpu_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/gpu_check.py new file mode 100644 index 0000000000000000000000000000000000000000..a457afa8d1dd55d2167434b70f4e1488e41e4049 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/gpu_check.py @@ -0,0 +1,24 @@ +"""Verify the new training loss at the largest scheduled bf16 shape.""" +import fcntl,json,sys,time +from pathlib import Path +import torch + +r=Path('/workspace/research');sys.path.insert(0,str(r/'postloss')) +from model import DirectForecaster,loss_fn +from data import Sampler +with open(r/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + torch.set_num_threads(1);torch.manual_seed(281);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic() + ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).cuda();model.load_state_dict(ck['model']) + x,y,p=[torch.from_numpy(a).cuda() for a in Sampler(r/'packed_sample',281).sample(64,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize() + assert torch.isfinite(loss) + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in model.parameters()) + result={'seed':281,'batch':64,'context':4096,'horizon':1024,'optimizer_updates':0, + 'loss':float(loss.detach()),'seconds':time.monotonic()-started, + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + (r/'postloss_gpu_check.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/launch_completion.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/launch_completion.py new file mode 100644 index 0000000000000000000000000000000000000000..8bdf1346b99ae846a2679a7494c9b88c1900bdce --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/launch_completion.py @@ -0,0 +1,30 @@ +"""Complete the original pruned schedule from its immutable exact training state.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + receipt=json.loads((R/'postloss_recovery003653.json').read_text()) + assert receipt['step']==3653 + assert json.loads((R/'postloss_completion_code_audit.json').read_text())['matches_original_E75_archived_training_code'] + assert (R/'postloss.stop').exists() + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'postloss'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/postloss_completion'),'--initialize-from',str(R/'horizon_delta12k.pt'), + '--resume',str(R/'postloss_recovery003653.pt'),'--steps','12000','--batch','64','--lr','.00002', + '--seed','197','--loss-mode','paired','--stop-file',str(R/'postloss_completion.stop')] + with (R/'postloss_completion_queue.log').open('w') as qlog,(R/'postloss_completion_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E98 complete original E75 schedule', + '--log',str(R/'postloss_completion_train.log'),'--receipt',str(R/'postloss_completion_queue.json'), + '--wait-pid','9274','--require-checkpoint',str(R/'runs/split_patch/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/postloss_completion'), + '--evaluator',str(R/'postloss_inference/evaluate.py'),'--name','postloss_completion', + '--steps','6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/model.py new file mode 100644 index 0000000000000000000000000000000000000000..014b585df72cc69852a8eedf302320b52fe55aad --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/model.py @@ -0,0 +1,216 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/model_before_numerical_fix.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/model_before_numerical_fix.py new file mode 100644 index 0000000000000000000000000000000000000000..1dab6e08582e4610693292e765d40a8b5392e97a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/model_before_numerical_fix.py @@ -0,0 +1,207 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/restart.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/restart.py new file mode 100644 index 0000000000000000000000000000000000000000..fa09bf30ead55ac10ca2d8c9a55277ddd71986f7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/restart.py @@ -0,0 +1,25 @@ +"""Restart corrected E75 from the declared parent and record process compute.""" +import json +import os +from pathlib import Path +import subprocess +import time + +R=Path('/workspace/research');run=R/'runs/postloss' +receipt=json.loads((R/'postloss_queue_before_recovery2.json').read_text()) +command=receipt['command'] +assert not (run/'recovery.pt').exists(),'This script is only for the documented pre-checkpoint numerical restart.' +env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') +with (R/'postloss_recovery3.log').open('w') as f: + p=subprocess.Popen(command,stdout=f,stderr=subprocess.STDOUT,env=env) +record={'command':command,'status':'running','pid':p.pid,'log':str(R/'postloss_recovery3.log'), + 'started_utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + 'note':'Restart own E62 initialization after verified float32 variance-overflow correction; original seed and recipe unchanged.'} +path=R/'postloss_recovery3_receipt.json';path.write_text(json.dumps(record,indent=2)) +watch=['python3',str(R/'watch_evaluate.py'),'--run',str(run),'--evaluator',str(R/'postloss_inference/evaluate.py'), + '--name','postloss','--steps','1000,3000,6000,12000'] +with (R/'postloss_watch_recovery3_fixed.log').open('w') as f: + subprocess.Popen(watch,stdout=f,stderr=subprocess.STDOUT,env=env) +started=time.monotonic();returncode=p.wait() +record.update(status='complete' if returncode==0 else 'failed',returncode=returncode,process_seconds=time.monotonic()-started) +path.write_text(json.dumps(record,indent=2));raise SystemExit(returncode) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/torch_post.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/torch_post.py new file mode 100644 index 0000000000000000000000000000000000000000..e19586bcc1677d56cedb6ce02c2f57797157f5f3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/postloss/torch_post.py @@ -0,0 +1,112 @@ +"""Differentiable forecast transforms with the package's fixed context rules. + +Context statistics are constants with respect to model parameters. Gradients +flow only through the forecast, including the continuity correction's anchor. +""" +import torch + + +@torch.no_grad() +def context_statistics(ctx, periods, horizon): + x=ctx.double(); finite=torch.isfinite(x); clean=torch.where(finite,x,0.) + b,c=x.shape; device=x.device + pos=torch.arange(c,device=device)[None,:] + count=finite.sum(-1).clamp(min=1) + mean=clean.sum(-1)/count + variance=(torch.where(finite,x-mean[:,None],0.).square()).sum(-1)/count + positive=((x>=0)|~finite).all(-1) + zeros=((x==0)&finite).sum(-1) + zero_active=positive&(zeros>=4)&(zeros/count>=.1) + cutoff=torch.where(zero_active,.4*variance.sqrt(),0.) + first=torch.where(finite,pos,c).min(-1).values + length=c-first + phase=torch.arange(max(1,c//3),device=device)[None,:] + future=torch.arange(horizon,device=device)[None,:] + z=torch.tensor([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0, + .2533471031,.5244005127,.8416212336,1.2815515655],device=device) + best_weight=torch.zeros(b,device=device,dtype=torch.float64) + prior=torch.zeros(b,horizon,9,device=device,dtype=torch.float64) + prior_valid=torch.zeros(b,horizon,device=device,dtype=torch.bool) + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + cycles=(length[:,None]//p).clamp(max=8) + history=finite&(pos>=c-cycles*p) + n=history.sum(-1).clamp(min=1) + center=(clean*history).sum(-1)/n + var=torch.where(history,x-center[:,None],0.).square().sum(-1)/n + previous=pos-p;safe=previous.clamp(min=0) + pairs=(previous>=c-cycles*p)&(previous>=0)&finite&finite.gather(1,safe) + pairs_count=pairs.sum(-1) + difference=clean-clean.gather(1,safe) + mse=(difference.square()*pairs).sum(-1)/pairs_count.clamp(min=1) + weight=(1-mse/(var+1e-12)/.25).clamp(0,.98) + eligible=(p[:,0]>=2)&(cycles[:,0]>=3)&(pairs_count>=p[:,0]) + weight=torch.where(eligible,weight,0.) + values=[];observed=[] + for cycle in range(4): + idx=c-p+phase-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(phase=0)&(cycle0 + template=(values*observed).sum(0)/nphase.clamp(min=1) + ntemplate=phase_valid.sum(-1).clamp(min=1) + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent=finite&(pos>=c-p) + nr=recent.sum(-1).clamp(min=1) + recent_mean=(clean*recent).sum(-1)/nr + template=template+(recent_mean-template_mean)[:,None] + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent_var=torch.where(recent,x-recent_mean[:,None],0.).square().sum(-1)/nr + template_var=((template-template_mean[:,None]).square()*phase_valid).sum(-1)/ntemplate + used_cycles=cycles[:,0].clamp(min=1,max=4) + noise=mse/2 + target_var=(recent_var-noise).clamp(min=0) + base_var=(template_var-noise/used_cycles).clamp(min=0) + ratio=(target_var/base_var.clamp(min=1e-12)).sqrt().clamp(.5,2.) + align=nr>=torch.maximum(torch.full_like(nr,2),.75*p[:,0]) + ratio=torch.where(align,ratio,1.) + template=template_mean[:,None]+(template-template_mean[:,None])*ratio[:,None] + sigma=(noise*(1+1/used_cycles)).sqrt() + index=(future%p).clamp(max=phase.shape[-1]-1) + selected=template.gather(1,index) + valid=phase_valid.gather(1,index) + q=selected[:,:,None]+sigma[:,None,None]*z[None,None,:] + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + choose=weight>best_weight + prior=torch.where(choose[:,None,None],q,prior) + prior_valid=torch.where(choose[:,None],valid,prior_valid) + best_weight=torch.maximum(best_weight,weight) + seasonal_weight=best_weight[:,None]*prior_valid + + recent=x[:,-512:];seen=torch.isfinite(recent) + n=seen.sum(-1).clamp(min=1);clean_recent=torch.where(seen,recent,0.) + center=clean_recent.sum(-1)/n + var=torch.where(seen,recent-center[:,None],0.).square().sum(-1)/n + differences=recent[:,1:]-recent[:,:-1] + diff_seen=torch.isfinite(differences);nd=diff_seen.sum(-1) + mse=torch.where(diff_seen,differences,0.).square().sum(-1)/nd.clamp(min=1) + tail=differences[:,-8:] + tail_seen=torch.isfinite(tail);nt=tail_seen.sum(-1) + sorted_tail=torch.where(tail_seen,tail,float('inf')).sort(-1).values + if tail.shape[-1]: + lo=((nt-1).clamp(min=0)//2)[:,None];hi=(nt//2).clamp(max=tail.shape[-1]-1)[:,None] + median=(sorted_tail.gather(1,lo)+sorted_tail.gather(1,hi))[:,0]/2 + else:median=torch.zeros(b,device=device,dtype=x.dtype) + continuity_weight=(1-mse/(var+1e-12)/.5).clamp(0,.95) + active=(nd>=8)&(nt>0)&seen[:,-1] + continuity_weight=torch.where(active,continuity_weight,0.) + anchor=torch.where(active,recent[:,-1]+median,0.) + return seasonal_weight,prior,continuity_weight,anchor,positive,cutoff + + +def apply_fixed(ctx,periods,quant): + """Quantiles are raw-scale tensors of shape (batch,horizon,9).""" + weight,prior,cweight,anchor,positive,cutoff=context_statistics(ctx,periods,quant.shape[1]) + q=torch.where(positive[:,None,None],quant.clamp(min=0),quant) + q=((1-weight[:,:,None])*q+weight[:,:,None]*prior).float() + bias=(cweight*(anchor-q[:,0,4])).float() + decay=torch.exp(-torch.arange(q.shape[1],device=q.device,dtype=torch.float64)/24) + q=(q.double()+bias[:,None,None]*decay[None,:,None]).float() + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return torch.where((q>=0)&(q8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/brief.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/brief.py new file mode 100644 index 0000000000000000000000000000000000000000..f9b0612d121dbc6b618909f6539ce19a871c2827 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/brief.py @@ -0,0 +1,31 @@ +"""Write a short, current recovery handoff; never modify training state.""" +import datetime +import json +from pathlib import Path + +R = Path('/workspace/research') +s = json.loads((R/'CURRENT_RESEARCH_STATE.json').read_text()) +lines = ['# Current recovery brief', '', datetime.datetime.now(datetime.timezone.utc).isoformat(), '', + 'Continuous research; no endpoint/final hand-in. One H10080GB,22CPUs,224GiB requested RAM; no network or pretrained assets. Do not inspect credentials or spawn agents.', '', + '## Published', '', json.dumps(s['published']), '', '## Pending selection', '', + json.dumps(s.get('next_candidate',{})), '', '## Active and queued training', ''] +for name, job in s.get('external_jobs',{}).items(): + if job['status'] not in ['running','waiting']: + continue + lines += [f'- {name}: {job["status"]}; receipt {job["receipt"]}; queue PID snapshot {job["queue_pid_at_snapshot"]}; children {job["child_pids_at_snapshot"]}.', + f' Last logged record: {json.dumps(job["last_phase_record"])}', + f' Complete recovery: {job["complete_recovery_checkpoint"]}; latest EMA: {job["latest_saved_ema"]}.'] +lines += ['', '## Recovery rules', '', + '- PIDs and launch-script dependencies are snapshots. After an operator restart, restore running jobs from each complete recovery.pt, preserving optimizer/EMA/RNG/prefetched batch and original schedules. Rewire waiting jobs to the newly launched dependency PIDs; do not blindly rerun old launch scripts.', + '- Waiting dependency chain: weekly_replication_control after long_seasonal; weekly_replication_candidate after that control; lowfreq_windows after that candidate; long_seasonal_replication after lowfreq_windows. phase_joint waits for random_capacity_512 final96000; seasonal_dispersion waits for phase_joint final12000.', + '- E101 distillation teacher is immutable /workspace/research/distill_teacher_E96, even after later publications. Do not substitute the current submission.', + '- Restore compiler_cache_backup to the same /tmp cache paths before restarting compiled trainers. Exact environment and commands are in CURRENT_RESEARCH_STATE.json.', + '- E105 output collision is documented in incidents/stratified_volume_output_collision. Correct E105 output is runs/stratified_volume. E95final and2k..12k weights survive, but E95optimizer recovery and original1k weights were lost. Do not resume completed E95.', + '- All previous negative/stopped branches stay stopped unless a new matched experiment explicitly revisits them. Never retrain the supplied baselines.', + '- Current training-source publisher archives all Python modules from explicitly declared directories, fixing earlier omissions of spectral.py and schedules.py. Complete-source members carry a -complete suffix when rebuilt. Runtime/weight hashes were unchanged.', + '- Full evaluation and GPU diagnostics use .evaluation.lock; the six trainers legitimately share the one H100. Dataset windows under data/valid and all earlier cutoffs are selection only, never training.', + '- Master journal direct_v1/EXPERIMENTS.md, chronological SESSION_20261023_PROGRESS.md, and RESEARCH_IDEAS.md contain decisions and rejected candidates. Recheck live processes and latest reports before acting.', + '', '## Time anchor', '', + 'Latest operator recovery allowance:151596research seconds at2026-10-23T02:45:51UTC. Pauses/preflight excluded. The goal remains active and has no requested token budget.', ''] +(R/'RECOVERY_BRIEF.md').write_text('\n'.join(lines)) +print('Wrote RECOVERY_BRIEF.md with '+str(sum(j['status'] in ['running','waiting'] for j in s.get('external_jobs',{}).values()))+' active/queued jobs.') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/quantile_coverage.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/quantile_coverage.py new file mode 100644 index 0000000000000000000000000000000000000000..d7f4958ae772a15c4a580eed59bb9257b065154d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/quantile_coverage.py @@ -0,0 +1,59 @@ +"""Validation-only quantile coverage, with separate strict/inclusive coverage at atoms.""" +import argparse +import json +import sys +import time +from pathlib import Path + +import numpy as np + +sys.path.insert(0,'/workspace/evaluation') +from ts_io import read_prediction_file, read_truth_file + +parser = argparse.ArgumentParser() +parser.add_argument('--valid',required=True) +parser.add_argument('--pred',required=True) +parser.add_argument('--report',required=True) +parser.add_argument('--out',required=True) +args = parser.parse_args() +started = time.monotonic() +root = Path(args.valid) +index = json.loads((root/'input/index.json').read_text()) +report = json.loads(Path(args.report).read_text()) +levels = np.arange(1,10)/10 +rows = [] +for cfg in index['configs']: + relative = Path('cases')/(cfg['config_id']+'.h5') + y,scale,_ = read_truth_file(root/'truth'/relative) + _,q = read_prediction_file(Path(args.pred)/relative) + valid = np.isfinite(y) + assert q.shape==(*y.shape[:2],9,y.shape[-1]) and np.isfinite(q).all() + count = int(valid.sum()) + assert count>0 + strict = ((y[:,:,None,:] anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/seasonal_history_support.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/seasonal_history_support.py new file mode 100644 index 0000000000000000000000000000000000000000..84314b30b22a4a761447fc5ee1cffb9301e725b9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/seasonal_history_support.py @@ -0,0 +1,23 @@ +"""Context-metadata diagnostic of potential 8-cycle support, with no targets read.""" +import importlib.util,json,time +from pathlib import Path +import h5py,numpy as np +R=Path('/workspace/research');started=time.monotonic() +spec=importlib.util.spec_from_file_location('support_model',R/'long_seasonal/model.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m) +root=Path('/workspace/data/valid/input');index=json.loads((root/'index.json').read_text());rows=[] +for cfg in index['configs']: + with h5py.File(root/'cases'/(cfg['config_id']+'.h5'),'r') as f:lengths=np.asarray(f['context_length']) + h=cfg['prediction_length'];periods=m.periods_for_freq(cfg['freq']);row={k:cfg[k] for k in ['config_id','freq','term','domain']};row['periods']=periods;row['n_instances']=len(lengths) + for cap in [4096,16384]: + support=[];cycles=[] + for p in periods: + count=np.clip(1+(np.minimum(lengths,cap)[:,None]-p+np.arange(h)[None,:]%p)//p,0,16) + support.append(float(np.mean((count>=8)&(p>=2))));cycles.append(float(np.mean(np.where(p>=2,count,0)))) + row[str(cap)]={'phase_support_fraction':support,'mean_available_cycles':cycles} + row['support_gain_sum']=sum(row['16384']['phase_support_fraction'])-sum(row['4096']['phase_support_fraction']);rows.append(row) +changed=[r for r in rows if r['support_gain_sum']>0] +result=dict(kind='optimistic potential support before missing-value masks; not measured forecast improvement',input_metadata_only=True,validation_targets_read=False,optimizer_updates=0,configs=rows, + changed_configurations=len(changed),changed_domains=sorted(set(r['domain'] for r in changed)),seconds=time.monotonic()-started) +(R/'seasonal_history_support.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='configs'})) +for r in sorted(changed,key=lambda x:x['support_gain_sum'],reverse=True)[:20]:print(json.dumps(r)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..7695f1a2fd58bde1c457a589e3162b9ba9f71988 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json'),str(R/'long_seasonal_replication_queue.json'),str(R/'seasonal_dispersion_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..211edc96d1ea1ee336190852fbff00fe60bef884 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/recovery/train.py @@ -0,0 +1,201 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint','seasonal_dispersion'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/check.py new file mode 100644 index 0000000000000000000000000000000000000000..18b155db82902843efdf6df4164d5ed87f249a47 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/check.py @@ -0,0 +1,79 @@ +"""Check spectral covariance and unchanged control streams without validation data.""" +import copy +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path + +import numpy as np + +R = Path('/workspace/research') +sys.path.insert(0, str(R / 'spectral_synth')) +from data import Sampler +from spectral import gaussian_residual, spectral_density + +spec = importlib.util.spec_from_file_location('spectral_control_data', R / 'overflow_control/data.py') +control_code = importlib.util.module_from_spec(spec) +spec.loader.exec_module(control_code) +started = time.monotonic() +seed = 499 +candidate = Sampler(R / 'packed_sample', seed=seed, source_weights_from=R / 'packed_sample') +control = control_code.Sampler(R / 'packed_sample', seed=seed, source_weights_from=R / 'packed_sample') +rng = np.random.default_rng(seed) +rows = synthetic_rows = replaced_rows = 0 +for _ in range(120): + c = int(rng.choice([512, 1024, 2048, 4096])) + h = int(rng.choice([32, 128, 512, 1024])) + expected = control.sample(64, c, h) + actual = candidate.sample(64, c, h) + replacements = np.array(candidate.last_spectral_rows, dtype=int) + unchanged = np.ones(64, dtype=bool) + unchanged[replacements] = False + for x, y in zip(expected, actual): + assert np.array_equal(x[unchanged], y[unchanged], equal_nan=True) + assert set(replacements) <= set(candidate.last_synthetic_rows) + assert np.array_equal(expected[2], actual[2]) + for x, y in zip(expected[:2], actual[:2]): + assert np.array_equal(np.isfinite(x), np.isfinite(y)) + assert candidate.rng.bit_generator.state == control.rng.bit_generator.state + assert candidate.horizon_rng.bit_generator.state == control.horizon_rng.bit_generator.state + rows += 64 + synthetic_rows += len(candidate.last_synthetic_rows) + replaced_rows += len(replacements) +sampler_seconds = time.monotonic() - started +states = {n: copy.deepcopy(v.bit_generator.state) for n, v in vars(candidate).items() + if isinstance(v, np.random.Generator)} +next_batch = candidate.sample(64, 4096, 1024) +for name, state in states.items(): + getattr(candidate, name).bit_generator.state = state +replayed = candidate.sample(64, 4096, 1024) +assert all(np.array_equal(x, y, equal_nan=True) for x, y in zip(next_batch, replayed)) + +covariances = [] +for family in range(4): + values = np.stack([gaussian_residual(512, rng, length_scale=8, family=family) + for _ in range(1024)]) + expected = np.fft.irfft(spectral_density(2048, 8, family), n=2048) + observed = [float(np.mean(values * values))] + observed += [float(np.mean(values[:, lag:] * values[:, :-lag])) for lag in [1, 8, 32]] + wanted = expected[[0, 1, 8, 32]] + assert np.max(np.abs(np.array(observed) - wanted)) < .045 + covariances.append(dict(family=family, observed=observed, theoretical=wanted.tolist())) +for family in range(4): + for n in [8, 40, 5120]: + for scale in [1., 1e4]: + assert np.isfinite(gaussian_residual(n, rng, scale, family)).all() +model_hash = hashlib.sha256((R / 'spectral_synth/model.py').read_bytes()).hexdigest() +assert model_hash == hashlib.sha256((R / 'overflow_control/model.py').read_bytes()).hexdigest() +result = dict(seed=seed, rows=rows, original_synthetic_rows=synthetic_rows, + replaced_spectral_rows=replaced_rows, probability=.5, + original_and_horizon_rng_bitwise_preserved=True, + unmodified_rows_bitwise_preserved=True, periods_and_finite_masks_unchanged=True, + all_numpy_rng_recovery_exact=True, model_sha256=model_hash, + model_bitwise_unchanged=True, covariance_checks=covariances, + sampler_comparison_seconds=sampler_seconds, seconds=time.monotonic()-started, + optimizer_updates=0, validation_data_read=False) +(R / 'spectral_synth_checks.json').write_text(json.dumps(result, indent=2)) +print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..bf91f33740715be702c2772f3cca89b656cea4dc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/data.py @@ -0,0 +1,102 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq +from spectral import gaussian_residual + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + if self.spectral_rng.random()8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + self.spectral_rng=np.random.default_rng(seed+1100003) + self.spectral_probability=.5 + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..0134693b620294a3fb18eed15e107d649a0cc487 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/launch.py @@ -0,0 +1,29 @@ +"""Queue spectral synthetic residuals after postloss completion finishes.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + checks=json.loads((R/'spectral_synth_checks.json').read_text()) + assert checks['original_and_horizon_rng_bitwise_preserved'] and checks['unmodified_rows_bitwise_preserved'] + assert checks['all_numpy_rng_recovery_exact'] and checks['model_bitwise_unchanged'] + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'spectral_synth'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/spectral_synth'),'--initialize-from',str(R/'horizon_delta12k.pt'), + '--steps','12000','--batch','64','--lr','.00002','--seed','197','--loss-mode','paired', + '--stop-file',str(R/'spectral_synth.stop')] + with (R/'spectral_synth_queue.log').open('w') as qlog,(R/'spectral_synth_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E106 spectral synthetic residuals seed197', + '--log',str(R/'spectral_synth_train.log'),'--receipt',str(R/'spectral_synth_queue.json'), + '--wait-pid','10664','--require-checkpoint',str(R/'runs/postloss_completion/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/spectral_synth'), + '--evaluator',str(R/'postloss_inference/evaluate.py'),'--name','spectral_synth', + '--expected-packed',str(R/'packed_sample'),'--steps','1000,3000,6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/spectral.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/spectral.py new file mode 100644 index 0000000000000000000000000000000000000000..f7358c3ec944849ea619ef2e73697775b48d408c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_synth/spectral.py @@ -0,0 +1,27 @@ +"""Locally generated finite stationary Gaussian fields with varied smoothness.""" +import numpy as np + + +def spectral_density(size, length_scale, family): + omega = 2 * np.pi * np.fft.rfftfreq(size) + if family == 3: + density = np.exp(-.5 * (length_scale * omega) ** 2) + else: + nu = [.5, 1.5, 2.5][family] + density = (1 + (length_scale * omega) ** 2 / (2 * nu)) ** (-nu - .5) + # Real FFT has one DC and one Nyquist coefficient, two of each interior bin. + variance = (density[0] + density[-1] + 2 * density[1:-1].sum()) / size + return density / variance + + +def gaussian_residual(n, rng, length_scale=None, family=None): + """The covariance is the discrete inverse Fourier transform of the declared PSD.""" + if length_scale is None: + length_scale = 10 ** rng.uniform(0, 4) + if family is None: + family = int(rng.integers(4)) + size = 1 << (max(16, 4 * n) - 1).bit_length() + density = spectral_density(size, length_scale, family) + white = rng.normal(size=size) + field = np.fft.irfft(np.fft.rfft(white) * np.sqrt(density), n=size) + return field[:n].astype(np.float32) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_transfer/run.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_transfer/run.py new file mode 100644 index 0000000000000000000000000000000000000000..b12c03e56acc3688932c441fd31aa259136f1bc1 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/spectral_transfer/run.py @@ -0,0 +1,55 @@ +"""E114: two predeclared coefficient-one spectral-prior transfers; selection only.""" +import hashlib +import json +import os +import subprocess +import time +from pathlib import Path + +R = Path('/workspace/research') +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +started = time.monotonic() +receipt = {'experiment': 'E114', 'status': 'running', 'steps': []} +receipt_path = R / 'spectral_transfer_receipt.json' + +def run(label, command): + receipt['current_step'] = label + receipt_path.write_text(json.dumps(receipt, indent=2)) + print(json.dumps({'starting': label}), flush=True) + t0 = time.monotonic() + result = subprocess.run(command, env=env, check=False) + receipt['steps'].append({'name': label, 'seconds': time.monotonic()-t0, + 'returncode': result.returncode}) + if result.returncode: + receipt.update(status='failed', seconds=time.monotonic()-started) + receipt_path.write_text(json.dumps(receipt, indent=2)) + raise SystemExit(result.returncode) + +add = R/'spectral_add_delta6k.pt' +replace = R/'spectral_replace_delta6k.pt' +assert not add.exists() and not replace.exists(), 'Refuse to overwrite fixed candidates' +run('add_spectral_delta', ['python3', str(R/'partial_delta/merge.py'), + '--base', str(R/'weekly_slow_ar_delta6k.pt'), + '--candidate', str(R/'runs/spectral_synth/ema006000.pt'), + '--control', str(R/'runs/overflow_control/ema006000.pt'), '--out', str(add)]) +run('remove_old_slow_ar_delta', ['python3', str(R/'partial_delta/merge.py'), + '--base', str(add), '--candidate', str(R/'runs/partial_targets/ema006000.pt'), + '--control', str(R/'runs/long_memory_synth_recovery/ema006000.pt'), '--out', str(replace)]) +receipt['candidate_hashes'] = {p.stem: hashlib.sha256(p.read_bytes()).hexdigest() for p in [add, replace]} +for weights in [add, replace]: + run(weights.stem+'_four_cutoffs', ['python3', str(R/'evaluate_cutoffs.py'), + '--name', weights.stem, '--weights', str(weights), + '--evaluator', str(R/'postloss_inference/evaluate.py')]) + for cutoff, folder in [('valid_screen','evals'), ('valid_backcast','backcast_evals'), + ('valid_backcast2','backcast2_evals'), ('valid_backcast3','backcast3_evals')]: + run(weights.stem+'_'+cutoff+'_record', ['python3', str(R/'direct_v1/record.py'), + str(R/folder/weights.stem/'report.json'), '--label', 'E114 '+weights.stem+' '+cutoff, + '--outcome', 'Fixed coefficient-one spectral transfer; additive and old-slow-AR replacement are the two predeclared ablations. No optimization. Ensemble selection recorded separately.']) + command = ['python3', str(R/'equal_ensemble_probe.py'), '--valid', str(R/cutoff), + '--out', str(R/(weights.stem+'_ensemble_'+cutoff+'.json'))] + for name in [weights.stem, 'patch8_ema6000', 'split_patch_ema12000']: + command += ['--pred', str(R/folder/name)] + run(weights.stem+'_'+cutoff+'_ensemble', command) +receipt.update(status='complete', seconds=time.monotonic()-started) +receipt_path.write_text(json.dumps(receipt, indent=2)) +print(json.dumps(receipt), flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/check.py new file mode 100644 index 0000000000000000000000000000000000000000..1797c7ca37791de3ac143f64843434ad7beda0ba --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/check.py @@ -0,0 +1,45 @@ +"""Verify the weekly-only data change without using validation or optimizer steps.""" +import copy +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'weekly_synth')) +from data import Sampler +spec=importlib.util.spec_from_file_location('weekly_control_data',R/'overflow_control/data.py') +control_code=importlib.util.module_from_spec(spec);spec.loader.exec_module(control_code) +started=time.monotonic();seed=467 +candidate=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +control=control_code.Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed);rows=synthetic_rows=weekly_rows=0 +for _ in range(120): + c=int(rng.choice([512,1024,2048,4096]));h=int(rng.choice([32,128,512,1024])) + expected=control.sample(64,c,h);actual=candidate.sample(64,c,h) + replacements=np.array(candidate.last_weekly_rows,dtype=int) + unchanged=np.ones(64,dtype=bool);unchanged[replacements]=False + for x,y in zip(expected,actual): + assert np.array_equal(x[unchanged],y[unchanged],equal_nan=True) + assert set(candidate.last_weekly_rows)<=set(candidate.last_synthetic_rows) + assert np.all(actual[2][replacements]==np.array([52,1])) + for x,y in zip(expected[:2],actual[:2]): + assert np.array_equal(np.isfinite(x),np.isfinite(y)) + assert candidate.rng.bit_generator.state==control.rng.bit_generator.state + assert candidate.horizon_rng.bit_generator.state==control.horizon_rng.bit_generator.state + rows+=64;synthetic_rows+=len(candidate.last_synthetic_rows);weekly_rows+=len(replacements) +states={n:copy.deepcopy(v.bit_generator.state) for n,v in vars(candidate).items() if isinstance(v,np.random.Generator)} +next_batch=candidate.sample(64,4096,1024) +for name,state in states.items():getattr(candidate,name).bit_generator.state=state +replayed=candidate.sample(64,4096,1024) +assert all(np.array_equal(x,y,equal_nan=True) for x,y in zip(next_batch,replayed)) +model_hash=hashlib.sha256((R/'weekly_synth/model.py').read_bytes()).hexdigest() +assert model_hash==hashlib.sha256((R/'overflow_control/model.py').read_bytes()).hexdigest() +result=dict(seed=seed,rows=rows,original_synthetic_rows=synthetic_rows,replaced_weekly_rows=weekly_rows, + probability=1/11,original_and_horizon_rng_bitwise_preserved=True,unmodified_rows_bitwise_preserved=True, + finite_masks_unchanged=True,all_numpy_rng_recovery_exact=True,model_sha256=model_hash, + model_bitwise_unchanged=True,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) +(R/'weekly_synth_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..81f0f018cb212a6e2125543e0d4efa2f31b9d8fb --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/data.py @@ -0,0 +1,113 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + self.weekly_rng=np.random.default_rng(seed+1000003) + self.weekly_probability=1/11 + def synthetic(self,n,p): + # Always consume the control generator first, preserving its complete RNG stream. + original=super().synthetic(n,p) + if self.weekly_rng.random()>=self.weekly_probability: + return original + original_rng=self.rng + try: + self.rng=self.weekly_rng + result=super().synthetic(n,[52,1]) + finally: + self.rng=original_rng + p[:]=[52,1] + self.last_weekly_rows.append(self._synthetic_row) + return result + + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..ef36b1e3de2ad1cc424019100da141536161d07a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/launch.py @@ -0,0 +1,29 @@ +"""Queue weekly synthetic coverage after robust-normalization training finishes.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + checks=json.loads((R/'weekly_synth_checks.json').read_text()) + assert checks['original_and_horizon_rng_bitwise_preserved'] and checks['unmodified_rows_bitwise_preserved'] + assert checks['all_numpy_rng_recovery_exact'] and checks['model_bitwise_unchanged'] + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'weekly_synth'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/weekly_synth'),'--initialize-from',str(R/'horizon_delta12k.pt'), + '--steps','12000','--batch','64','--lr','.00002','--seed','197','--loss-mode','paired', + '--stop-file',str(R/'weekly_synth.stop')] + with (R/'weekly_synth_queue.log').open('w') as qlog,(R/'weekly_synth_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E97 weekly synthetic coverage seed197', + '--log',str(R/'weekly_synth_train.log'),'--receipt',str(R/'weekly_synth_queue.json'), + '--wait-pid','9354','--require-checkpoint',str(R/'runs/robust_normalization/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/weekly_synth'), + '--evaluator',str(R/'postloss_inference/evaluate.py'),'--name','weekly_synth', + '--steps','1000,3000,6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member0/training/weekly_synth/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..ed7d82d53ee418c27f3691dc143ede37891db0ef --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/model_manifest.json @@ -0,0 +1,660 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36665488, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 16384, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "confidence_query/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "confidence_query/model.py": "b4f11ba2018e2b50879cdc33acf0138301548971508b58035a7c96a29aaa6f2d", + "confidence_query/train.py": "fc8a7555a5a6b0a6f91e80ac8cc9cbbfddaa2b26468c57f49dfb17671b22ce93", + "direct_large/data.py": "6e6db217936f8dd79380d2ceff3eaa8598a44f1b60b17acae7bfde2363116847", + "direct_large/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "direct_large/model.py": "146d93a3f95b13bda8b1b437bc36621b91356cf946e94f62999f89e7fb348071", + "direct_large/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "direct_large/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "direct_large/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "direct_large/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "direct_large/train.py": "b9ad6b2adddeaf12961b529d6535dd33f6d044a31979b5c9e49dceafbadd3ac0", + "direct_large/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "direct_large/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "full_paired/check.py": "90ac1c78846439d51ab8acd62a19bd536c7c394bd02e94f6d5ff17c0af8bd116", + "full_paired/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "full_paired/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "horizon_jitter/data.py": "5044cf648323420095ed6058d29f837c07ff5559b606df8b00cc8d1e95c8b58e", + "horizon_jitter/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "horizon_jitter/train.py": "4e9cbca1293f18f7eea2c72dba127815c0934a13c86e8f6cc881a749676d41a6", + "large_corpus/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "large_corpus/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "large_corpus/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "large_sign/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "large_sign/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "large_sign/model.py": "3fff6445a1982a1b3c92f06a9b5f1bb627dda6a291b0b2364bcfb1a6457830d7", + "large_sign/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "large_sign/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "large_sign/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "large_sign/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "large_sign/train.py": "a597f40ab87cce04e96dc654d12e56cdf40ffd87f00034d8bc4d56dff4eb7c68", + "large_sign/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "large_sign/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "partial_delta/merge.py": "63984a0f46f7d48817037f5bf5a1c9319e45a9b1924cde62c667ac49ce47532e", + "partial_targets/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "partial_targets/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "partial_targets/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "patch16/convert.py": "11e1d30100ab25311020ac1f4ab8227ec66156836df5de613300867977091c45", + "patch16/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "patch16/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "patch16/model.py": "8031c597b354eb2cf464140bee40c3ec8dff86c775b5c55c5ce910302b443582", + "patch16/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "patch16/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "patch16/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "patch16/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "patch16/train.py": "3156710f76111a31447cbe638ee27fe2811d060917aa083aab0b5134d98accf8", + "patch16/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "patch16/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "patch8/convert.py": "9edaa0c8349310b7419d649fb4f21dd3ddb9067ebe984d5df3701a234be73780", + "patch8/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "patch8/memory_check.py": "78e8e5cca960bf1225ec0104980363c82f4c3c13c2d77ed154cea37a5b6f3fd1", + "patch8/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "recency_features/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "recency_features/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "recency_features/train.py": "a654b9a27b6c27141e1d4e517ab28fcae3f2c23d061742fa2f6c01e3d23c8a00", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/snapshot.py": "0f241a7e139e47ffff7efea40572205fd84c12efe6fb3c2dccd87c50d678a6c3", + "recovery/train.py": "63bee736565af670877b4cd7c75015fab06a18c66bbe132b0bb3faff5ebd80c7" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/direct_large/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fda928e16338305fd9912f7bc08cacff58bd8aa4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/check.py @@ -0,0 +1,34 @@ +import importlib.util,json,time +from pathlib import Path +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +r=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197);start=time.monotonic() +ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +spec=importlib.util.spec_from_file_location('parent_model',r/'confidence_inference/model.py') +old=importlib.util.module_from_spec(spec);spec.loader.exec_module(old) +parent=old.DirectForecaster(**ck['config']);parent.load_state_dict(ck['model']) +m=DirectForecaster(**ck['config']);m.load_state_dict(ck['model']) +x=torch.randn(4,512);x[0,:50]=float('nan');p=torch.tensor([[24,168]]*4);y=torch.randn(4,128);y[0,32:]=float('nan') +with torch.inference_mode(): + assert all(torch.equal(a,b) for a,b in zip(m(x,p,48),parent(x,p,48))) + short=m(x,p,32)[0];long=m(x,p,128,forecast_lengths=torch.full((4,),32))[0][:,:32] + assert torch.allclose(short,long,atol=3e-6,rtol=1e-6),(short-long).abs().max() + paired=float(loss_fn(m,x,y,p,paired=True));reverse=float(loss_fn(m,-x,-y,p,paired=True)) + assert abs(paired-reverse)<1e-7,(paired,reverse) +a=Sampler(r/'packed_sample',197);b=Sampler(r/'packed_sample',197) +for c,h in [(512,32),(4096,1024)]: + assert all(np.array_equal(v,w,equal_nan=True) for v,w in zip(a.sample(16,c,h),b.sample(16,c,h))) +assert a.rng.bit_generator.state==b.rng.bit_generator.state and a.horizon_rng.bit_generator.state==b.horizon_rng.bit_generator.state +cpu=time.monotonic()-start;del parent,ck,a,b +m=m.cuda();ema={k:v.detach().clone() for k,v in m.state_dict().items()} +moments=[torch.zeros_like(v) for v in m.parameters() for _ in range(2)] +torch.backends.cuda.matmul.allow_tf32=True;torch.cuda.reset_peak_memory_stats();start=time.monotonic() +x=torch.randn(64,4096,device='cuda');y=torch.randn(64,1024,device='cuda');p=torch.tensor([[24,168]]*64,device='cuda') +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +z={'cpu_seconds':cpu,'initial_forecast_bitwise_parent':True,'unused_future_tokens_do_not_change_requested_prefix':True,'paired_loss_sign_symmetric':True,'matched_sampler_main_and_horizon_rng':True,'gpu_fixture_seconds':time.monotonic()-start,'allocated_mib':torch.cuda.max_memory_allocated()/2**20,'reserved_mib':torch.cuda.max_memory_reserved()/2**20,'optimizer_updates':0} +(r/'full_paired_checks.json').write_text(json.dumps(z,indent=2));print(json.dumps(z),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/large_sign/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch16/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..d55bebeab8c6ff393f89b7ad031763f49531f56b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/memory_check.py @@ -0,0 +1,23 @@ +"""Maximum training-shape memory fixture, serialized with validation jobs.""" +import fcntl,json,sys,time +from pathlib import Path +import torch + +r=Path('/workspace/research');sys.path.insert(0,str(r/'patch8')) +from model import DirectForecaster,loss_fn +from data import Sampler +with open(r/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + torch.set_num_threads(1);torch.manual_seed(277);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic() + ck=torch.load(r/'patch8_initial.pt',map_location='cpu',weights_only=False) + m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) + x,y,p=[torch.from_numpy(a).cuda() for a in Sampler(r/'packed_sample',277).sample(64,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize() + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) + result={'seed':277,'batch':64,'signed_rows':128,'context':4096,'horizon':1024, + 'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started, + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + (r/'patch8_memory_check.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/relaunch_20261022b.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/relaunch_20261022b.py new file mode 100644 index 0000000000000000000000000000000000000000..d16fc19cbbb86dba2ff53b445e368b8bbd2ca218 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/relaunch_20261022b.py @@ -0,0 +1,105 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery2' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 152594, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'recent_normalization_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'postloss': 'recent_normalization_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/relaunch_20261023.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/relaunch_20261023.py new file mode 100644 index 0000000000000000000000000000000000000000..5f35a9cfcbe7ea66c8837b6d4ada8b84be36b934 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/relaunch_20261023.py @@ -0,0 +1,104 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery3' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 151596, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/schedules.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/schedules.py new file mode 100644 index 0000000000000000000000000000000000000000..4c8378f374144b802d2cd5a98afd71efc1ba0a4c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/schedules.py @@ -0,0 +1,13 @@ +"""Explicit training-only learning-rate schedules; default arithmetic unchanged.""" +import math + + +def learning_rate(step, steps, peak, reset_at=-1, anneal_from_step=None, + anneal_from_lr=None, anneal_final_lr=None): + if anneal_from_step is not None: + assert steps > anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..11ce27e43477f9c685cefeaa5f36e53c59634505 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..536677ab542342e8e9b56298e5ddb7cb2983a258 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member1/training/recovery/train.py @@ -0,0 +1,201 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..267b9cd31e3dcddf8fb57320edcd08e8bba1d9bb --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/model_manifest.json @@ -0,0 +1,744 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36601928, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404" + ], + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "training_lineage": [ + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 8192, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "confidence_query/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "confidence_query/model.py": "b4f11ba2018e2b50879cdc33acf0138301548971508b58035a7c96a29aaa6f2d", + "confidence_query/train.py": "fc8a7555a5a6b0a6f91e80ac8cc9cbbfddaa2b26468c57f49dfb17671b22ce93", + "direct_large/data.py": "6e6db217936f8dd79380d2ceff3eaa8598a44f1b60b17acae7bfde2363116847", + "direct_large/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "direct_large/model.py": "146d93a3f95b13bda8b1b437bc36621b91356cf946e94f62999f89e7fb348071", + "direct_large/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "direct_large/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "direct_large/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "direct_large/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "direct_large/train.py": "b9ad6b2adddeaf12961b529d6535dd33f6d044a31979b5c9e49dceafbadd3ac0", + "direct_large/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "direct_large/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "full_paired/check.py": "90ac1c78846439d51ab8acd62a19bd536c7c394bd02e94f6d5ff17c0af8bd116", + "full_paired/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "full_paired/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "horizon_jitter/data.py": "5044cf648323420095ed6058d29f837c07ff5559b606df8b00cc8d1e95c8b58e", + "horizon_jitter/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "horizon_jitter/train.py": "4e9cbca1293f18f7eea2c72dba127815c0934a13c86e8f6cc881a749676d41a6", + "large_corpus/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "large_corpus/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "large_corpus/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "large_sign/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "large_sign/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "large_sign/model.py": "3fff6445a1982a1b3c92f06a9b5f1bb627dda6a291b0b2364bcfb1a6457830d7", + "large_sign/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "large_sign/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "large_sign/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "large_sign/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "large_sign/train.py": "a597f40ab87cce04e96dc654d12e56cdf40ffd87f00034d8bc4d56dff4eb7c68", + "large_sign/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "large_sign/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "partial_delta/merge.py": "63984a0f46f7d48817037f5bf5a1c9319e45a9b1924cde62c667ac49ce47532e", + "partial_targets/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "partial_targets/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "partial_targets/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "patch16/convert.py": "11e1d30100ab25311020ac1f4ab8227ec66156836df5de613300867977091c45", + "patch16/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "patch16/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "patch16/model.py": "8031c597b354eb2cf464140bee40c3ec8dff86c775b5c55c5ce910302b443582", + "patch16/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "patch16/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "patch16/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "patch16/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "patch16/train.py": "3156710f76111a31447cbe638ee27fe2811d060917aa083aab0b5134d98accf8", + "patch16/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "patch16/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "patch8/convert.py": "9edaa0c8349310b7419d649fb4f21dd3ddb9067ebe984d5df3701a234be73780", + "patch8/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "patch8/memory_check.py": "78e8e5cca960bf1225ec0104980363c82f4c3c13c2d77ed154cea37a5b6f3fd1", + "patch8/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "recency_features/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "recency_features/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "recency_features/train.py": "a654b9a27b6c27141e1d4e517ab28fcae3f2c23d061742fa2f6c01e3d23c8a00", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/snapshot.py": "0f241a7e139e47ffff7efea40572205fd84c12efe6fb3c2dccd87c50d678a6c3", + "recovery/train.py": "63bee736565af670877b4cd7c75015fab06a18c66bbe132b0bb3faff5ebd80c7", + "split_patch/check.py": "2e0917eec4b70741da84f62ba19d709229fefa29fd46a8b85dd91976952560f9", + "split_patch/convert.py": "115b3f518a2157529a3c26143dabd736abc8494b7f20cdd9bea57d569d77c36e", + "split_patch/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "split_patch/launch.py": "014b171e8b8dc1f4b84242a02813af1ee8b26c3b4dc839148718caf36d77ae77", + "split_patch/memory_check.py": "8a6f6af761ac37fb5118f71e38bba0ca5c446e5c1203b9e156657e7d68a5d3e9", + "split_patch/model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/direct_large/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fda928e16338305fd9912f7bc08cacff58bd8aa4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/check.py @@ -0,0 +1,34 @@ +import importlib.util,json,time +from pathlib import Path +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +r=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197);start=time.monotonic() +ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +spec=importlib.util.spec_from_file_location('parent_model',r/'confidence_inference/model.py') +old=importlib.util.module_from_spec(spec);spec.loader.exec_module(old) +parent=old.DirectForecaster(**ck['config']);parent.load_state_dict(ck['model']) +m=DirectForecaster(**ck['config']);m.load_state_dict(ck['model']) +x=torch.randn(4,512);x[0,:50]=float('nan');p=torch.tensor([[24,168]]*4);y=torch.randn(4,128);y[0,32:]=float('nan') +with torch.inference_mode(): + assert all(torch.equal(a,b) for a,b in zip(m(x,p,48),parent(x,p,48))) + short=m(x,p,32)[0];long=m(x,p,128,forecast_lengths=torch.full((4,),32))[0][:,:32] + assert torch.allclose(short,long,atol=3e-6,rtol=1e-6),(short-long).abs().max() + paired=float(loss_fn(m,x,y,p,paired=True));reverse=float(loss_fn(m,-x,-y,p,paired=True)) + assert abs(paired-reverse)<1e-7,(paired,reverse) +a=Sampler(r/'packed_sample',197);b=Sampler(r/'packed_sample',197) +for c,h in [(512,32),(4096,1024)]: + assert all(np.array_equal(v,w,equal_nan=True) for v,w in zip(a.sample(16,c,h),b.sample(16,c,h))) +assert a.rng.bit_generator.state==b.rng.bit_generator.state and a.horizon_rng.bit_generator.state==b.horizon_rng.bit_generator.state +cpu=time.monotonic()-start;del parent,ck,a,b +m=m.cuda();ema={k:v.detach().clone() for k,v in m.state_dict().items()} +moments=[torch.zeros_like(v) for v in m.parameters() for _ in range(2)] +torch.backends.cuda.matmul.allow_tf32=True;torch.cuda.reset_peak_memory_stats();start=time.monotonic() +x=torch.randn(64,4096,device='cuda');y=torch.randn(64,1024,device='cuda');p=torch.tensor([[24,168]]*64,device='cuda') +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +z={'cpu_seconds':cpu,'initial_forecast_bitwise_parent':True,'unused_future_tokens_do_not_change_requested_prefix':True,'paired_loss_sign_symmetric':True,'matched_sampler_main_and_horizon_rng':True,'gpu_fixture_seconds':time.monotonic()-start,'allocated_mib':torch.cuda.max_memory_allocated()/2**20,'reserved_mib':torch.cuda.max_memory_reserved()/2**20,'optimizer_updates':0} +(r/'full_paired_checks.json').write_text(json.dumps(z,indent=2));print(json.dumps(z),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/large_sign/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch16/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..d55bebeab8c6ff393f89b7ad031763f49531f56b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/memory_check.py @@ -0,0 +1,23 @@ +"""Maximum training-shape memory fixture, serialized with validation jobs.""" +import fcntl,json,sys,time +from pathlib import Path +import torch + +r=Path('/workspace/research');sys.path.insert(0,str(r/'patch8')) +from model import DirectForecaster,loss_fn +from data import Sampler +with open(r/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + torch.set_num_threads(1);torch.manual_seed(277);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic() + ck=torch.load(r/'patch8_initial.pt',map_location='cpu',weights_only=False) + m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) + x,y,p=[torch.from_numpy(a).cuda() for a in Sampler(r/'packed_sample',277).sample(64,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize() + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) + result={'seed':277,'batch':64,'signed_rows':128,'context':4096,'horizon':1024, + 'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started, + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + (r/'patch8_memory_check.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/relaunch_20261022b.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/relaunch_20261022b.py new file mode 100644 index 0000000000000000000000000000000000000000..d16fc19cbbb86dba2ff53b445e368b8bbd2ca218 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/relaunch_20261022b.py @@ -0,0 +1,105 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery2' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 152594, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'recent_normalization_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'postloss': 'recent_normalization_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/relaunch_20261023.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/relaunch_20261023.py new file mode 100644 index 0000000000000000000000000000000000000000..5f35a9cfcbe7ea66c8837b6d4ada8b84be36b934 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/relaunch_20261023.py @@ -0,0 +1,104 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery3' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 151596, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/schedules.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/schedules.py new file mode 100644 index 0000000000000000000000000000000000000000..4c8378f374144b802d2cd5a98afd71efc1ba0a4c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/schedules.py @@ -0,0 +1,13 @@ +"""Explicit training-only learning-rate schedules; default arithmetic unchanged.""" +import math + + +def learning_rate(step, steps, peak, reset_at=-1, anneal_from_step=None, + anneal_from_lr=None, anneal_final_lr=None): + if anneal_from_step is not None: + assert steps > anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..11ce27e43477f9c685cefeaa5f36e53c59634505 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..536677ab542342e8e9b56298e5ddb7cb2983a258 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/recovery/train.py @@ -0,0 +1,201 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/check.py new file mode 100644 index 0000000000000000000000000000000000000000..1f2b82a5b0b0ad5477066245356808138d166400 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/check.py @@ -0,0 +1,49 @@ +"""Verify equal input/output patches preserve the old implementation exactly.""" +import importlib.util +import json +import sys +import time +from pathlib import Path +import torch + +R = Path('/workspace/research') +sys.path.insert(0, str(R / 'split_patch')) +from model import DirectForecaster + +started = time.monotonic() +torch.set_num_threads(2) +torch.manual_seed(457) +spec = importlib.util.spec_from_file_location('original_patch_model', R / 'full_paired_inference/model.py') +old = importlib.util.module_from_spec(spec) +spec.loader.exec_module(old) +ck = torch.load(R / 'runs/patch8/ema006000.pt', map_location='cpu', weights_only=False) +control = old.DirectForecaster(**ck['config']) +control.load_state_dict(ck['model']) +same = DirectForecaster(**ck['config'], input_patch=8) +same.load_state_dict(ck['model']) +x = torch.randn(6, 251) +x[0, :90] = float('nan') +x[1, ::7] = float('nan') +p = torch.tensor([[12, 1], [52, 1], [24, 168], [7, 365], [1, 1], [96, 672]]) +with torch.no_grad(): + before = control(x, p, 57) + after = same(x, p, 57) +assert all(torch.equal(a, b) for a, b in zip(before, after)) +candidate = torch.load(R / 'split_patch_initial.pt', map_location='cpu', weights_only=False) +full4 = torch.load(R / 'patch4_initial.pt', map_location='cpu', weights_only=False) +for name, value in candidate['model'].items(): + reference = ck['model'][name] if name == 'embed.0.weight' else full4['model'][name] + assert torch.equal(value, reference), name +net = DirectForecaster(**candidate['config']) +net.load_state_dict(candidate['model']) +with torch.no_grad(): + q = net.predict(x, p, 57) +assert q.shape == (6, 9, 57) +assert torch.isfinite(q).all() and (q[:, 1:] >= q[:, :-1]).all() +receipt = dict(seed=457, cpu_seconds=time.monotonic() - started, + equal_patch_forward_bitwise_unchanged=True, + input_tensor_retained_from_patch8=True, + output_tensors_identical_to_full_patch4_conversion=True, + candidate_finite_ordered=True, optimizer_updates=0) +(R / 'split_patch_checks.json').write_text(json.dumps(receipt, indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..9a16c87c0cf45b0efb1b2e56008a821c8391b471 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/convert.py @@ -0,0 +1,13 @@ +"""Convert the already locally trained patch8 model to input8/output4 without external assets.""" +import argparse,hashlib,json,time +from pathlib import Path +import torch +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +torch.set_num_threads(1);started=time.monotonic();ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==8 +x=state['query.0.weight'].reshape(d,8,9);state['query.0.weight']=(x[:,:4]+x[:,4:]).reshape(d,36) +x=state['recency.weight'].reshape(d,8,4);state['recency.weight']=(x[:,:4]+x[:,4:]).reshape(d,16) +state['head.weight']=state['head.weight'].reshape(8,18,d)[:4].reshape(72,d).clone();state['head.bias']=state['head.bias'].reshape(8,18)[:4].reshape(72).clone() +ck['config']['patch']=4;ck['config']['input_patch']=8 +conversion={'method':'retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates','exact_function_preservation':False,'parent_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest()} +ck.update(step=0,args={'packed':ck['args']['packed'],'initialize_from':str(Path(a.input).resolve()),'converted':True},parent_checkpoints=[str(Path(a.input).resolve())],conversion=conversion) +torch.save(ck,a.output);receipt={**conversion,'checkpoint_sha256':hashlib.sha256(Path(a.output).read_bytes()).hexdigest(),'parameters':sum(v.numel() for v in state.values()),'cpu_seconds':time.monotonic()-started,'optimizer_updates':0};Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2));print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..d3156fc48da2d25d324c5fb7cc2a50f7f70738d7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/launch.py @@ -0,0 +1,33 @@ +"""Run input8/output4 after late patch8 slowAR releases its allocation.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R = Path('/workspace/research') + assert json.loads((R / 'split_patch_checks.json').read_text())['equal_patch_forward_bitwise_unchanged'] + assert json.loads((R / 'split_patch_memory_check.json').read_text())['peak_reserved_mib'] < 14000 + env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + command = ['python3', str(R / 'recovery/train.py'), '--code-dir', str(R / 'split_patch'), + '--packed', str(R / 'packed_sample'), '--source-weights-from', str(R / 'packed_sample'), + '--out', str(R / 'runs/split_patch'), '--initialize-from', str(R / 'split_patch_initial.pt'), + '--steps', '12000', '--batch', '32', '--lr', '.00002', '--seed', '401', + '--loss-mode', 'paired', '--stop-file', str(R / 'split_patch.stop')] + with (R / 'split_patch_queue.log').open('w') as qlog, (R / 'split_patch_watch.log').open('w') as wlog: + queued = subprocess.Popen(['python3', str(R / 'queued_train.py'), '--label', 'E93 input8/output4 seed401', + '--log', str(R / 'split_patch_train.log'), '--receipt', str(R / 'split_patch_queue.json'), + '--wait-pid', '7349', '--require-checkpoint', str(R / 'runs/patch8_long_memory/recovery.pt'), + '--', *command], stdout=qlog, stderr=subprocess.STDOUT, env=env) + watch = subprocess.Popen(['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs/split_patch'), + '--evaluator', str(R / 'split_patch_inference/evaluate.py'), + '--name', 'split_patch', '--steps', '1000,3000,6000,12000'], + stdout=wlog, stderr=subprocess.STDOUT, env=env) + print({'queue_pid': queued.pid, 'watch_pid': watch.pid}, flush=True) + result = queued.wait() + if result: + watch.terminate() + watch.wait() + raise SystemExit(result) + +if __name__ == '__main__': + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..7ae2014f738a03f54cbd2208eb9095efe16b009c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/memory_check.py @@ -0,0 +1,18 @@ +"""Maximum-shape memory check for the matched patch comparison, including training state.""" +import argparse,fcntl,json,sys,time +from pathlib import Path +import torch +R=Path('/workspace/research');sys.path.insert(0,str(R/'split_patch')) +from model import DirectForecaster,loss_fn +from data import Sampler +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +with open(R/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX);torch.set_num_threads(1);torch.manual_seed(401);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic();ck=torch.load(a.weights,map_location='cpu',weights_only=False);model=DirectForecaster(**ck['config']).cuda();model.load_state_dict(ck['model']) + ema=[p.detach().clone() for p in model.parameters()];moments=[(torch.zeros_like(p),torch.zeros_like(p)) for p in model.parameters()] + x,y,p=[torch.from_numpy(v).cuda() for v in Sampler(R/'packed_sample',seed=401).sample(32,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize();assert torch.isfinite(loss) + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in model.parameters()) + result={'seed':401,'batch':32,'signed_rows':64,'patch':model.patch,'input_patch':model.input_patch,'context':4096,'horizon':1024,'EMA_and_AdamW_moment_storage_present':True,'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started,'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20,'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + Path(a.out).write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/model.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member2/training/split_patch/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..58fef8f33bec4188c92f98475e251ede3a91f15e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/model_manifest.json @@ -0,0 +1,307 @@ +{ + "name": "direct-seasonal-fresh146m", + "contract": "timeseries-forecast/v1", + "parameters": 146477344, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 307", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 307", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 307", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300310" + ], + "weights_sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "runs/random_capacity_1024/ema048000.pt", + "sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "step": 48000, + "seed": 307, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 48, + "lr": 0.0002, + "steps": 96000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": true, + "synthetic_ar_time_constants": [ + 1, + 10000 + ], + "requested_horizon_seed": 300310, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "random_capacity_1024_initial.pt" + ] + }, + { + "checkpoint": "random_capacity_1024_initial.pt", + "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", + "step": 0, + "seed": 307, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "predict.py": "5583ff7e00623f91b7ef4cfbefa8ba8e08c7a0666efb3be58915c1296892f19c", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe" + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 65536, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 6144, + "backbone_frozen_during_projection_training": false, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Projection trained jointly from random initialization; all training stages are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "random_capacity/check.py": "c5090883cc4e983a41041a319a5260f4d1d5c88bb3133b0651ea5e077845fb8d", + "random_capacity/check_anneal_schedule.py": "e7a431afbd93b3a542786781a4065d5802743965dadc42759cb1d3d50c3adbd5", + "random_capacity/data.py": "d84032a33937a465acfc9e1b97004ca8d9db221509bb2710e74500703ade4344", + "random_capacity/initialize.py": "2a3326d8f2340e9f3fb9ccdea4a69c94c25f9cb969b883ec5e89bb7a53e1e317", + "random_capacity/launch_anneal.py": "3e3b8784781519f77fffac9f683eea847d14df92bf829c2022e520a6074fbb25", + "random_capacity/launch_legacy.py": "d9bd7980146ccb62c292907aa50713e37d0be2dfeac829cf075c140747e9041a", + "random_capacity/launch_lower_rate.py": "44ce2d26ce1adc76023893e82734c2634c840541e7f88f9cef5b51e503a1ef97", + "random_capacity/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "random_capacity/queue_recovery3.py": "72b59dff33a62ccb584cece127fb3e0d1631a893ab3d5ffb791a3398f9d902f2", + "random_capacity/restart_corrected.py": "1f020aa304f1ce92d452ed884d0dbe5a0607f2d2c2fb6537f9e0bcf42412fde9", + "recovery/brief.py": "1d5f3d530d46c437fc5d747cac9f702835b783e0f87fea2f638d00d93acad90c", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/launch_matched_cutoffs.py": "7d5b9b569df284c143bb4fe50033ed6be21ff1b54cb4405723b2ebcdefe6e562", + "recovery/matched_report.py": "82696104e2e7da9cee48611e42aebc0f5c4916f2273fdeb9a3158c4dd3700b04", + "recovery/pack_composition.py": "66c198e44b55fc4dce50dec505a0127eb9d97390e04d0f97c271ace11ad0f49f", + "recovery/quantile_coverage.py": "7a4057d1aa38c5e7de0ca601db0003a8fd3a9a2e6123b2fdb81fa8aedbc34787", + "recovery/reclaim_completed_cache.py": "d0a23e5a73b362f03a3be0d9fcc8dd5292d17da0489484a9c52af84bd05d9638", + "recovery/refresh_journal.py": "6ccbbbf7494f3b310f2e4d47e572487b62494ae52ef6598de93ce8ae28c8a7a5", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/seasonal_history_support.py": "fe2da1a695715c3add9472f0bfebc946783b179b1a8415f85565a937885f7076", + "recovery/snapshot.py": "a6d03761df590b9cb5aedefdebd4f9e6ae6a4aa05b27ef5e3dac16388491a2da", + "recovery/synthetic_window_audit.py": "912e38fd094f35fb528a77388d8076600207b369bb3b2c2133a24c3c485019a1", + "recovery/train.py": "39170d026adb9c43071d2618fd10955acbc52bff92c5fcba4b4ba3e3f07be861", + "recovery/watch_matched_cutoffs.py": "177dbe6d8b5186dd3ce1c4b261a55cd5cfb44f6ed2922ef64b489deb2117fa6b" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3b6d1440f762d7e57f47bb267df05b5dd786c223 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/check.py @@ -0,0 +1,49 @@ +"""Measure maximum training memory and verify compiled paired-loss gradients.""" +import argparse +import fcntl +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--width',type=int,required=True);a=ap.parse_args() +R=Path('/workspace/research');lock=open(R/'.evaluation.lock','a');fcntl.flock(lock,fcntl.LOCK_EX) +torch.set_num_threads(1);torch.manual_seed(313);torch.backends.cuda.matmul.allow_tf32=True +started=time.monotonic();ck=torch.load(R/f'random_capacity_{a.width}_initial.pt',map_location='cpu',weights_only=False) +m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) +sampler=Sampler(R/'packed_sample',seed=313,source_weights_from=R/'packed_sample') +arrays=sampler.sample(48,4096,1024);x,y,p=[torch.from_numpy(v).cuda() for v in arrays] +# Placeholders account for the EMA and two Adam moments without taking any update. +state_placeholders=[torch.empty_like(v) for v in m.parameters() for _ in range(3)] +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +memory={'batch':48,'signed_rows':96,'context':4096,'horizon':1024,'loss':float(loss.detach()), + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} +del state_placeholders,loss,x,y,p,arrays +m.zero_grad(set_to_none=True);torch.cuda.empty_cache() +x,y,p=[torch.from_numpy(v).cuda() for v in sampler.sample(8,512,128)] +def step(fn): + m.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=fn(m,x,y,p,paired=True) + loss.backward() + return float(loss.detach()) +reference=step(loss_fn);grads={n:v.grad.detach().clone() for n,v in m.named_parameters()} +compile_started=time.monotonic();actual=step(torch.compile(loss_fn,fullgraph=True,dynamic=False));torch.cuda.synchronize() +dot=norma=normb=0.;maximum=0. +for name,v in m.named_parameters(): + left,right=grads[name],v.grad + assert torch.isfinite(right).all() + dot+=float((left*right).sum());norma+=float(left.square().sum());normb+=float(right.square().sum()) + maximum=max(maximum,float((left-right).abs().max())) +cosine=dot/(norma*normb)**.5 +assert abs(reference-actual)<.003*max(reference,.1) and cosine>.995 +result={'normalization_overflow_fallback':True,'width':a.width,'initialization_seed':307,'fixture_seed':313,'optimizer_updates':0, + 'maximum_shape_memory':memory,'eager_loss':reference,'compiled_loss':actual, + 'gradient_cosine':cosine,'max_gradient_difference':maximum, + 'compile_comparison_seconds':time.monotonic()-compile_started, + 'total_seconds':time.monotonic()-started,'source':'allowed packed_sample and own synthetic generator only'} +(R/f'random_capacity_{a.width}_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/check_anneal_schedule.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/check_anneal_schedule.py new file mode 100644 index 0000000000000000000000000000000000000000..6c52591b8672097d4dd3466bc7850131929588ce --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/check_anneal_schedule.py @@ -0,0 +1,24 @@ +"""Check the new cooldown and unchanged default learning-rate arithmetic.""" +import json +import math +import sys +import time +from pathlib import Path +R=Path('/workspace/research');sys.path.insert(0,str(R/'recovery')) +from schedules import learning_rate +started=time.monotonic() +checked=0 +for total,peak,reset in [(12000,2e-5,-1),(96000,2e-4,-1),(32000,3e-5,8000)]: + for step in range(1,total+1): + warm=step-reset if reset>=0 and step>reset else step + original=peak*min(1,warm/400)*(.2+.4*(1+math.cos(math.pi*step/total))) + assert learning_rate(step,total,peak,reset)==original + checked+=1 +start=learning_rate(24000,96000,2e-4) +values=[learning_rate(i,36000,2e-4,-1,24000,start,1e-5) for i in range(24000,36001)] +assert values[0]==start and values[-1]==1e-5 +assert all(08 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/initialize.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/initialize.py new file mode 100644 index 0000000000000000000000000000000000000000..ff8f0f3e2d3f9dfa2e8378e90c31bab5ecf4d22e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/initialize.py @@ -0,0 +1,26 @@ +"""Create fresh local random initializations for the matched capacity comparison.""" +import hashlib +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster + +R=Path('/workspace/research');torch.set_num_threads(2) +receipts=[] +for d,heads in [(512,8),(1024,16)]: + start=time.monotonic();torch.manual_seed(307) + model=DirectForecaster(d=d,heads=heads,enc_layers=6,dec_layers=4,patch=16, + recency_features=True,confidence_features=True,partial_target_lengths=True) + path=R/f'random_capacity_{d}_initial.pt' + assert not path.exists(),path + ck={'model':model.state_dict(),'config':model.config,'step':0, + 'args':{'packed':str(R/'packed_sample'),'seed':307}, + 'initialization':{'method':'torch modules initialized locally, zero output weights with fixed seasonal-mixture and interval biases', + 'seed':307,'parent_weights':[]}, + 'parent_checkpoints':[],'lr_multipliers':{}} + torch.save(ck,path) + receipts.append({'path':str(path),'sha256':hashlib.sha256(path.read_bytes()).hexdigest(), + 'parameters':sum(p.numel() for p in model.parameters()),'seed':307, + 'cpu_seconds':time.monotonic()-start,'optimizer_updates':0}) +(R/'random_capacity_initialization.json').write_text(json.dumps(receipts,indent=2));print(json.dumps(receipts)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_anneal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_anneal.py new file mode 100644 index 0000000000000000000000000000000000000000..b192187a1714510e172dd17378cc6b85bff26744 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_anneal.py @@ -0,0 +1,38 @@ +"""Branch one fresh37M run for a matched training-only cooldown comparison.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + snapshot=json.loads((R/'random_capacity_512_recovery024000.json').read_text());assert snapshot['step']==24000 + check=json.loads((R/'random_capacity_anneal_checks.json').read_text());assert check['default_steps_bitwise_equal']==140000 + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1',TORCHINDUCTOR_COMPILE_THREADS='2',MAX_JOBS='2', + PYTHONPATH=str(R/'compiler_support'),TRITON_CACHE_MANAGER='sibling_cache:SiblingFileCacheManager', + TRITON_CACHE_DIR='/tmp/timeseries-triton-cache',TORCHINDUCTOR_CACHE_DIR='/tmp/timeseries-inductor-cache') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'random_capacity'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/random_capacity_512_anneal'),'--initialize-from',str(R/'random_capacity_512_initial.pt'), + '--resume',str(R/'random_capacity_512_recovery024000.pt'),'--steps','36000','--batch','48', + '--lr','.0002','--seed','307','--loss-mode','paired','--compile-loss', + '--anneal-from-step','24000','--anneal-from-lr',str(check['join_lr']),'--anneal-final-lr','.00001', + '--stop-file',str(R/'random_capacity_512_anneal.stop')] + with (R/'random_capacity_512_anneal_queue.log').open('w') as qlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E99 fresh37M early cooldown', + '--log',str(R/'random_capacity_512_anneal_train.log'), + '--receipt',str(R/'random_capacity_512_anneal_queue.json'), + '--wait-pid','5689','--require-checkpoint',str(R/'runs/patch4_candidate/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watchers=[] + for name in ['random_capacity_512_anneal','random_capacity_512']: + with (R/(name+'_cooldown_watch.log')).open('w') as log: + watchers.append(subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs'/name), + '--evaluator',str(R/'random_capacity_inference/evaluate.py'),'--name',name, + '--steps','30000,36000'],stdout=log,stderr=subprocess.STDOUT,env=env)) + print({'queue_pid':queued.pid,'watch_pids':[p.pid for p in watchers]},flush=True) + result=queued.wait() + if result: + for p in watchers:p.terminate() + for p in watchers:p.wait() + raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_legacy.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_legacy.py new file mode 100644 index 0000000000000000000000000000000000000000..5bf7ac326ec15b02e9caea0b6357babc57c3d6e5 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_legacy.py @@ -0,0 +1,43 @@ +def main(): + """Queue the matched fresh-width pair after two existing allocations are released.""" + import json + from pathlib import Path + import subprocess + + R=Path('/workspace/research') + recovery=json.loads((R/'recovery2_launch_receipt.json').read_text()) + dependencies=['wide_capacity_146m_recovery','patch8'] + wait_pids=[recovery['jobs'][name]['pid'] for name in dependencies] + children=[] + for width in [512,1024]: + checks=json.loads((R/f'random_capacity_{width}_checks.json').read_text()) + assert checks['gradient_cosine']>.995 + name=f'random_capacity_{width}' + train=['env','OPENBLAS_NUM_THREADS=1','OMP_NUM_THREADS=1', + 'TORCHINDUCTOR_COMPILE_THREADS=2','MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache', + 'python3',str(R/'recovery/train.py'),'--code-dir',str(R/'random_capacity'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs'/name),'--initialize-from',str(R/f'{name}_initial.pt'), + '--steps','96000','--batch','48','--lr','.0002','--seed','307', + '--loss-mode','paired','--compile-loss','--stop-file',str(R/f'{name}.stop')] + command=['python3',str(R/'queued_train.py'),'--label',f'E79 fresh{width} seed307', + '--log',str(R/f'{name}_train.log'),'--receipt',str(R/f'{name}_queue.json')] + for pid in wait_pids:command+=['--wait-pid',str(pid)] + for dep in dependencies:command+=['--require-checkpoint',str(R/'runs'/dep/'recovery.pt')] + command+=['--']+train + with (R/f'{name}_queue.log').open('w') as f: + children.append(subprocess.Popen(command,stdout=f,stderr=subprocess.STDOUT)) + watch=['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs'/name), + '--evaluator',str(R/'random_capacity_inference/evaluate.py'),'--name',name, + '--steps','4000,8000,16000,24000,48000,72000,96000'] + with (R/f'{name}_watch.log').open('w') as f: + subprocess.Popen(watch,stdout=f,stderr=subprocess.STDOUT) + for child in children:child.wait() + assert all(child.returncode==0 for child in children) + +if __name__ == "__main__": + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_lower_rate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_lower_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..a9b2c79450b71b081832e7eaf0dce361c7da2a8d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/launch_lower_rate.py @@ -0,0 +1,40 @@ +"""Queue a single-factor lower-learning-rate arm for the fresh146M model.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R = Path('/workspace/research') + checks = json.loads((R / 'random_capacity_1024_checks.json').read_text()) + assert checks['gradient_cosine'] > .995 and checks['normalization_overflow_fallback'] + name = 'random_capacity_1024_halflr' + env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + train = ['env', 'OPENBLAS_NUM_THREADS=1', 'OMP_NUM_THREADS=1', + 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache', + 'python3', str(R / 'recovery/train.py'), '--code-dir', str(R / 'random_capacity'), + '--packed', str(R / 'packed_sample'), '--source-weights-from', str(R / 'packed_sample'), + '--out', str(R / 'runs' / name), '--initialize-from', str(R / 'random_capacity_1024_initial.pt'), + '--steps', '96000', '--batch', '48', '--lr', '.0001', '--seed', '307', + '--loss-mode', 'paired', '--compile-loss', '--stop-file', str(R / (name + '.stop'))] + with (R / (name + '_queue.log')).open('w') as qlog, (R / (name + '_watch.log')).open('w') as wlog: + queued = subprocess.Popen(['python3', str(R / 'queued_train.py'), '--label', 'E94 fresh146M halfLR seed307', + '--log', str(R / (name + '_train.log')), '--receipt', str(R / (name + '_queue.json')), + '--wait-pid', '5690', '--require-checkpoint', str(R / 'runs/patch4_control/recovery.pt'), + '--', *train], stdout=qlog, stderr=subprocess.STDOUT, env=env) + watch = subprocess.Popen(['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / 'random_capacity_inference/evaluate.py'), '--name', name, + '--steps', '4000,8000,16000,24000,48000,72000,96000'], + stdout=wlog, stderr=subprocess.STDOUT, env=env) + print(json.dumps({'queue_pid': queued.pid, 'watch_pid': watch.pid}), flush=True) + result = queued.wait() + if result: + watch.terminate() + watch.wait() + raise SystemExit(result) + +if __name__ == '__main__': + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/queue_recovery3.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/queue_recovery3.py new file mode 100644 index 0000000000000000000000000000000000000000..ca60d7ce3a745482824790ba818da843c84274fc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/queue_recovery3.py @@ -0,0 +1,44 @@ +def main(): + """Queue the matched fresh-width pair after two existing allocations are released.""" + import json + from pathlib import Path + import subprocess + + R=Path('/workspace/research') + recovery=json.loads((R/'recovery3_launch_receipt.json').read_text()) + dependencies=['wide_capacity_146m_recovery','patch8'] + wait_pids=[recovery['jobs'][name]['pid'] for name in dependencies] + children=[] + for width in [512,1024]: + checks=json.loads((R/f'random_capacity_{width}_checks.json').read_text()) + assert checks['gradient_cosine']>.995 and checks.get('normalization_overflow_fallback') is True + name=f'random_capacity_{width}' + train=['env','OPENBLAS_NUM_THREADS=1','OMP_NUM_THREADS=1', + 'TORCHINDUCTOR_COMPILE_THREADS=2','MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache', + 'python3',str(R/'recovery/train.py'),'--code-dir',str(R/'random_capacity'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs'/name),'--initialize-from',str(R/f'{name}_initial.pt'), + '--steps','96000','--batch','48','--lr','.0002','--seed','307', + '--loss-mode','paired','--compile-loss','--stop-file',str(R/f'{name}.stop')] + command=['python3',str(R/'queued_train.py'),'--label',f'E79 fresh{width} seed307', + '--log',str(R/f'{name}_train.log'),'--receipt',str(R/f'{name}_queue.json')] + for pid in wait_pids:command+=['--wait-pid',str(pid)] + for dep in dependencies:command+=['--require-checkpoint',str(R/'runs'/dep/'recovery.pt')] + command+=['--']+train + with (R/f'{name}_queue.log').open('w') as f: + children.append(subprocess.Popen(command,stdout=f,stderr=subprocess.STDOUT)) + watch=['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs'/name), + '--evaluator',str(R/'random_capacity_inference/evaluate.py'),'--name',name, + '--steps','4000,8000,16000,24000,48000,72000,96000'] + with (R/f'{name}_watch.log').open('w') as f: + watcher=subprocess.Popen(watch,stdout=f,stderr=subprocess.STDOUT) + print(json.dumps({'width':width,'queue_pid':children[-1].pid,'watch_pid':watcher.pid}),flush=True) + for child in children:child.wait() + assert all(child.returncode==0 for child in children) + +if __name__ == "__main__": + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/restart_corrected.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/restart_corrected.py new file mode 100644 index 0000000000000000000000000000000000000000..0fa492437cc10d940ab177575b4583064dedfcb5 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/random_capacity/restart_corrected.py @@ -0,0 +1,13 @@ +"""Validate the shared numerical correction, then start exactly one matched fresh pair.""" +def main(): + import json,os,subprocess,time + from pathlib import Path + R=Path('/workspace/research');env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1',TORCHINDUCTOR_COMPILE_THREADS='2',MAX_JOBS='2',PYTHONPATH=str(R/'compiler_support'),TRITON_CACHE_MANAGER='sibling_cache:SiblingFileCacheManager',TRITON_CACHE_DIR='/tmp/timeseries-triton-cache',TORCHINDUCTOR_CACHE_DIR='/tmp/timeseries-inductor-cache') + for width in (512,1024): + assert not list((R/'runs'/f'random_capacity_{width}').glob('*.pt')) + log=R/f'random_capacity_{width}_corrected_check.log' + with log.open('w') as f:subprocess.run(['python3',str(R/'random_capacity/check.py'),'--width',str(width)],stdout=f,stderr=subprocess.STDOUT,env=env,check=True) + result=json.loads((R/f'random_capacity_{width}_checks.json').read_text());print(json.dumps(result),flush=True) + with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\nE79 corrected-normalization fixture: '+json.dumps(result)+'\n') + subprocess.run(['python3',str(R/'random_capacity/queue_recovery3.py')],env=env,check=True) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/brief.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/brief.py new file mode 100644 index 0000000000000000000000000000000000000000..fe8d5ced0c95c0dfa3aa225eeb7c32d6fc34111c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/brief.py @@ -0,0 +1,33 @@ +"""Write a short, current recovery handoff; never modify training state.""" +import datetime +import json +from pathlib import Path + +R = Path('/workspace/research') +s = json.loads((R/'CURRENT_RESEARCH_STATE.json').read_text()) +lines = ['# Current recovery brief', '', datetime.datetime.now(datetime.timezone.utc).isoformat(), '', + 'Continuous research; no endpoint/final hand-in. One H10080GB,22CPUs,224GiB requested RAM; no network or pretrained assets. Do not inspect credentials or spawn agents.', '', + '## Published', '', json.dumps(s['published']), '', '## Pending selection', '', + json.dumps(s.get('next_candidate',{})), '', json.dumps(s.get('selection_probes',{}).get('E124',{})), '', '## Active and queued training', ''] +for name, job in s.get('external_jobs',{}).items(): + if job['status'] not in ['running','waiting']: + continue + lines += [f'- {name}: {job["status"]}; receipt {job["receipt"]}; queue PID snapshot {job["queue_pid_at_snapshot"]}; children {job["child_pids_at_snapshot"]}.', + f' Last logged record: {json.dumps(job["last_phase_record"])}', + f' Complete recovery: {job["complete_recovery_checkpoint"]}; latest EMA: {job["latest_saved_ema"]}.'] +lines += ['', '## Recovery rules', '', + '- PIDs and launch-script dependencies are snapshots. After an operator restart, restore running jobs from each complete recovery.pt, preserving optimizer/EMA/RNG/prefetched batch and original schedules. Rewire waiting jobs to the newly launched dependency PIDs; do not blindly rerun old launch scripts.', + '- Waiting dependency chain: weekly_replication_control after long_seasonal; weekly_replication_candidate after that control; lowfreq_windows after that candidate; long_seasonal_replication after lowfreq_windows. phase_joint waits for random_capacity_512 final96000; seasonal_dispersion waits for phase_joint final12000; seasonal_history waits for seasonal_dispersion final12000. random_capacity_original_ar waits for random_capacity_1024 final96000; log_horizon waits for long_seasonal_replication final12000; seasonal_width waits for seasonal_history final12000; random_capacity_long_seasonal waits for both E94halfLR and E79wide final96000 and replaces only the E94allocation.', + '- E121 history-aware ensemble runtime is prepared at history_three_patch_ensemble; synthetic audit checks exact standalone composition and ordinary legacy equality. It also applies member finite cleanup before averaging, correcting a pre-existing extreme-value discrepancy. Use this separate publisher and complete public replay before any E121 publication; E127 published this runtime at08:29:14; use history_three_patch_ensemble for future ensembles.', + '- E126 compiled_teacher_trial completed its mandatory17000stop; do not resume it. It preserved original96000 LR schedule from immutable distill_ensemble_recovery016000.pt. Original E101 stays active; no takeover or coefficient change selected; four-cutoff comparison pending. E125 component ablations completed; both paths help. E127 finite-member numerical fix is published with all97predictions bitwise unchanged; do not republish it. E128 dispersion transfer6000 is in four-cutoff selection. Receipts are indexed in CURRENT_RESEARCH_STATE.json.', + '- E101 distillation teacher is immutable /workspace/research/distill_teacher_E96, even after later publications. Do not substitute the current submission.', + '- Restore compiler_cache_backup to the same /tmp cache paths before restarting compiled trainers. Exact environment and commands are in CURRENT_RESEARCH_STATE.json.', + '- E105 output collision is documented in incidents/stratified_volume_output_collision. Correct E105 output is runs/stratified_volume. E95final and2k..12k weights survive, but E95optimizer recovery and original1k weights were lost. Do not resume completed E95.', + '- All previous negative/stopped branches stay stopped unless a new matched experiment explicitly revisits them. Never retrain the supplied baselines.', + '- Current training-source publisher archives all Python modules from explicitly declared directories, fixing earlier omissions of spectral.py and schedules.py. Complete-source members carry a -complete suffix when rebuilt. Runtime/weight hashes were unchanged.', + '- Full evaluation and GPU diagnostics use .evaluation.lock; the six main trainers share the one H100. The bounded E126 seventh-process probe completed17000 and should remain stopped. Dataset windows under data/valid and all earlier cutoffs are selection only, never training.', + '- Master journal direct_v1/EXPERIMENTS.md, chronological SESSION_20261023_PROGRESS.md, and RESEARCH_IDEAS.md contain decisions and rejected candidates. Recheck live processes and latest reports before acting.', + '', '## Time anchor', '', + 'Latest operator recovery allowance:151596research seconds at2026-10-23T02:45:51UTC. Pauses/preflight excluded. The goal remains active and has no requested token budget.', ''] +(R/'RECOVERY_BRIEF.md').write_text('\n'.join(lines)) +print('Wrote RECOVERY_BRIEF.md with '+str(sum(j['status'] in ['running','waiting'] for j in s.get('external_jobs',{}).values()))+' active/queued jobs.') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/launch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/launch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..6d33e64b8212b250fc38a2990604c80228b94c80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/launch_matched_cutoffs.py @@ -0,0 +1,14 @@ +"""Keep evaluation controllers alive for the declared queued comparisons.""" +from pathlib import Path +import datetime,json,os,subprocess +R=Path('/workspace/research');jobs={};processes={};env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') +for name,control,runtime,label in [('lowfreq_windows','overflow_control','postloss_inference','E113'),('seasonal_history','long_seasonal','seasonal_history_inference','E121'),('seasonal_width','seasonal_dispersion','seasonal_width_inference','E129'),('long_seasonal_replication','weekly_replication_control','long_seasonal_inference','E118'),('log_horizon','overflow_control','postloss_inference','E123')]: + path=R/(name+'_matched_cutoffs.log') + with path.open('a') as log: + command=['python3',str(R/'recovery/watch_matched_cutoffs.py'),'--run',name,'--control',control,'--evaluator',str(R/runtime/'evaluate.py'),'--label',label] + p=subprocess.Popen(command,stdout=log,stderr=subprocess.STDOUT,env=env) + processes[label]=p;jobs[label]=dict(pid=p.pid,parent_pid=os.getpid(),command=command,log=str(path),receipt=str(R/(name+'_matched_cutoffs_receipt.json'))) +q=R/'CURRENT_RESEARCH_STATE.json';state=json.loads(q.read_text());state['diagnostics']['matched_cutoff_controllers']=jobs;t=q.with_suffix('.tmp');t.write_text(json.dumps(state,indent=2));os.replace(t,q) +print(json.dumps(jobs),flush=True) +for label,p in processes.items(): + result=p.wait();print(json.dumps(dict(label=label,returncode=result)),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/matched_report.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/matched_report.py new file mode 100644 index 0000000000000000000000000000000000000000..f7755cfc0300a5a18f3e2db1d6d5aa89cda9f0fa --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/matched_report.py @@ -0,0 +1,16 @@ +"""Record matched validation reports, including all configuration-group metrics.""" +import argparse,datetime,json,math +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['candidate','control','label','out']:ap.add_argument('--'+key,required=True) +ap.add_argument('--cutoffs',default='0');ap.add_argument('--outcome',required=True);a=ap.parse_args() +folders=['evals','backcast_evals','backcast2_evals','backcast3_evals'];rows=[] +for index in map(int,a.cutoffs.split(',')): + folder=folders[index];x=json.loads((R/folder/a.candidate/'report.json').read_text());y=json.loads((R/folder/a.control/'report.json').read_text()) + assert x['n_failed']==y['n_failed']==0 and x['n_configs']==y['n_configs'] + delta={g:{k:math.sqrt(y['groups'][g][k]['rel_mase_gmean']*y['groups'][g][k]['rel_wql_gmean'])-math.sqrt(v['rel_mase_gmean']*v['rel_wql_gmean']) for k,v in entries.items()} for g,entries in x['groups'].items()} + rows.append(dict(cutoff=folder,candidate_skill=x['skill_score'],control_skill=y['skill_score'],delta=x['skill_score']-y['skill_score'],candidate_checkpoint=x['checkpoint_sha256'],control_checkpoint=y['checkpoint_sha256'],candidate_eval_seconds=x.get('eval_seconds'),candidate_groups=x['groups'],control_groups=y['groups'],group_skill_delta=delta)) +result=dict(label=a.label,utc=datetime.datetime.now(datetime.timezone.utc).isoformat(),candidate=a.candidate,control=a.control,rows=rows,mean_delta=sum(v['delta'] for v in rows)/len(rows),positive_cutoffs=sum(v['delta']>0 for v in rows),outcome=a.outcome) +p=Path(a.out);assert not p.exists(),'Refuse duplicate comparison record';p.write_text(json.dumps(result,indent=2)) +with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\n'+a.label+': '+json.dumps(result)+'\n') +print(json.dumps({k:v for k,v in result.items() if k!='rows'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/pack_composition.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/pack_composition.py new file mode 100644 index 0000000000000000000000000000000000000000..0a023de983f7c0860043b58def56406e3fd27eb9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/pack_composition.py @@ -0,0 +1,32 @@ +"""Read-only comparison of source/length composition in the two allowed packs.""" +import json,time +from pathlib import Path +import numpy as np +R=Path('/workspace/research');started=time.monotonic();old=R/'packed_sample';new=R/'packed_stratified_full' +a=json.loads((old/'meta.json').read_text());b=json.loads((new/'meta.json').read_text());assert a['dirs']==b['dirs'];names=a['dirs'] +weights=[] +for n in names: + w=min((old/(n+'.bin')).stat().st_size//4,20000000)**.25 + if n.startswith(('era5_','cmip6_')):w*=.35 + if n.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) +weights=np.array(weights)/sum(weights);bins=np.array([16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131073]) +rows=[];aggregate={k:np.zeros(len(bins)-1) for k in ['old','full']} +for n,w in zip(names,weights): + row={'source':n,'conditional_real_source_probability':float(w)} + for k,root in [('old',old),('full',new)]: + lengths=np.diff(np.load(root/(n+'.offsets.npy'),mmap_mode='r')) + hist=np.histogram(lengths,bins=bins)[0]/len(lengths);aggregate[k]+=w*hist + row[k]={'series':len(lengths),'points':int(lengths.sum()),'mean_length':float(lengths.mean()),'median_length':float(np.median(lengths)), + 'fraction_below64':float(np.mean(lengths<64)),'fraction_below256':float(np.mean(lengths<256)), + 'fraction_at_least20480':float(np.mean(lengths>=20480)),'length_bin_probabilities':hist.tolist()} + row['weighted_length_distribution_l1']=float(w*np.abs(np.array(row['old']['length_bin_probabilities'])-row['full']['length_bin_probabilities']).sum()) + row['mixed_frequency_rows_in_full']=b['receipts'][n]['mixed_frequency_rows_in_candidates'];row['full_frequencies']=b['receipts'][n]['kept_frequencies'];rows.append(row) +result=dict(kind='per-source uniform-series sampling composition; no series values or validation labels read', + length_bins=bins.tolist(),conditional_real_length_bin_probabilities={k:v.tolist() for k,v in aggregate.items()}, + source_probabilities_unchanged=True,min_length_both=16,max_crop_length_both=131072, + mixed_frequency_sources=[r['source'] for r in rows if r['mixed_frequency_rows_in_full']],sources=rows, + seconds=time.monotonic()-started,optimizer_updates=0) +(R/'pack_composition_comparison.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='sources'})) +for row in sorted(rows,key=lambda r:-r['weighted_length_distribution_l1'])[:12]:print(json.dumps({k:v for k,v in row.items() if k not in ['old','full']},separators=(',',':')), 'mean_length',row['old']['mean_length'],row['full']['mean_length']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/quantile_coverage.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/quantile_coverage.py new file mode 100644 index 0000000000000000000000000000000000000000..d7f4958ae772a15c4a580eed59bb9257b065154d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/quantile_coverage.py @@ -0,0 +1,59 @@ +"""Validation-only quantile coverage, with separate strict/inclusive coverage at atoms.""" +import argparse +import json +import sys +import time +from pathlib import Path + +import numpy as np + +sys.path.insert(0,'/workspace/evaluation') +from ts_io import read_prediction_file, read_truth_file + +parser = argparse.ArgumentParser() +parser.add_argument('--valid',required=True) +parser.add_argument('--pred',required=True) +parser.add_argument('--report',required=True) +parser.add_argument('--out',required=True) +args = parser.parse_args() +started = time.monotonic() +root = Path(args.valid) +index = json.loads((root/'input/index.json').read_text()) +report = json.loads(Path(args.report).read_text()) +levels = np.arange(1,10)/10 +rows = [] +for cfg in index['configs']: + relative = Path('cases')/(cfg['config_id']+'.h5') + y,scale,_ = read_truth_file(root/'truth'/relative) + _,q = read_prediction_file(Path(args.pred)/relative) + valid = np.isfinite(y) + assert q.shape==(*y.shape[:2],9,y.shape[-1]) and np.isfinite(q).all() + count = int(valid.sum()) + assert count>0 + strict = ((y[:,:,None,:] anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/seasonal_history_support.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/seasonal_history_support.py new file mode 100644 index 0000000000000000000000000000000000000000..84314b30b22a4a761447fc5ee1cffb9301e725b9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/seasonal_history_support.py @@ -0,0 +1,23 @@ +"""Context-metadata diagnostic of potential 8-cycle support, with no targets read.""" +import importlib.util,json,time +from pathlib import Path +import h5py,numpy as np +R=Path('/workspace/research');started=time.monotonic() +spec=importlib.util.spec_from_file_location('support_model',R/'long_seasonal/model.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m) +root=Path('/workspace/data/valid/input');index=json.loads((root/'index.json').read_text());rows=[] +for cfg in index['configs']: + with h5py.File(root/'cases'/(cfg['config_id']+'.h5'),'r') as f:lengths=np.asarray(f['context_length']) + h=cfg['prediction_length'];periods=m.periods_for_freq(cfg['freq']);row={k:cfg[k] for k in ['config_id','freq','term','domain']};row['periods']=periods;row['n_instances']=len(lengths) + for cap in [4096,16384]: + support=[];cycles=[] + for p in periods: + count=np.clip(1+(np.minimum(lengths,cap)[:,None]-p+np.arange(h)[None,:]%p)//p,0,16) + support.append(float(np.mean((count>=8)&(p>=2))));cycles.append(float(np.mean(np.where(p>=2,count,0)))) + row[str(cap)]={'phase_support_fraction':support,'mean_available_cycles':cycles} + row['support_gain_sum']=sum(row['16384']['phase_support_fraction'])-sum(row['4096']['phase_support_fraction']);rows.append(row) +changed=[r for r in rows if r['support_gain_sum']>0] +result=dict(kind='optimistic potential support before missing-value masks; not measured forecast improvement',input_metadata_only=True,validation_targets_read=False,optimizer_updates=0,configs=rows, + changed_configurations=len(changed),changed_domains=sorted(set(r['domain'] for r in changed)),seconds=time.monotonic()-started) +(R/'seasonal_history_support.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='configs'})) +for r in sorted(changed,key=lambda x:x['support_gain_sum'],reverse=True)[:20]:print(json.dumps(r)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..32bac3687fc7ecb68c2255040c3d9cef721d2974 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json'),str(R/'long_seasonal_replication_queue.json'),str(R/'seasonal_dispersion_queue.json'),str(R/'seasonal_history_queue.json'),str(R/'random_capacity_original_ar_queue.json'),str(R/'log_horizon_queue.json'),str(R/'compiled_teacher_trial_queue.json'),str(R/'seasonal_width_queue.json'),str(R/'random_capacity_long_seasonal_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/synthetic_window_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/synthetic_window_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..5a6455bbd9926f9d342ee1a24ca825328a9e7e1f --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/synthetic_window_audit.py @@ -0,0 +1,63 @@ +"""Compare actual allowed/synthetic training-window dynamics without validation data.""" +import datetime +import json +from pathlib import Path +import sys +import time +import types +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'overflow_control')) +source=(R/'overflow_control/data.py').read_text() +needle='r=self.rng;ctx=np.full((batch,context),np.nan,np.float32);tgt=np.full((batch,horizon),np.nan,np.float32);periods=np.ones((batch,2),np.int64)' +assert source.count(needle)==1 +instrumented=source.replace(needle,needle+';self.audit_synthetic=np.zeros(batch,bool)') +needle='if r.random()=16 and len(target)>=4: + k=min(16,n//4,len(target)) + # Descriptive finite-observation means, not a proposed inference feature. + scale=max(float(np.std(values)),float(np.mean(np.abs(values)))*1e-4,1e-4) + past=(float(np.mean(values[-k:]))-float(np.mean(values[-2*k:-k])))/scale + future=(float(np.mean(target[:k].astype(np.float64)))-float(np.mean(values[-k:])))/scale + item.update(past_change=float(np.clip(past,-20,20)),future_change=float(np.clip(future,-20,20))) + groups.setdefault(frequency+'_'+kind,[]).append(item);counts+=1 +summary={} +for name,rows in groups.items(): + c=np.array([x['context'] for x in rows]);h=np.array([x['target'] for x in rows]) + valid=[x for x in rows if x['past_change'] is not None] + past=np.array([x['past_change'] for x in valid]);future=np.array([x['future_change'] for x in valid]) + summary[name]=dict(rows=len(rows),median_finite_context=float(np.median(c)), + context_at_most128=float(np.mean(c<=128)),context_above512=float(np.mean(c>512)), + median_finite_target=float(np.median(h)),dynamic_rows=len(valid), + median_abs_recent_change=float(np.median(np.abs(past))), + median_abs_future_change=float(np.median(np.abs(future))), + recent_future_change_correlation=float(np.corrcoef(past,future)[0,1])) +result=dict(seed=seed,rows=counts,batches=160,groups=summary,seconds=time.monotonic()-started, + generated_utc=datetime.datetime.now(datetime.timezone.utc).isoformat(), + instrumentation_first640_rows_and_rng_bitwise=True,optimizer_updates=0, + validation_data_read=False,decision='Descriptive audit only. E113 remains unchanged; no new generator selected.') +(R/'synthetic_window_audit.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..4cdae7818edfd782494fe444a1504b539d5baccf --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/train.py @@ -0,0 +1,217 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +ap.add_argument('--compile-teacher',action='store_true') +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble','random_capacity_long_seasonal'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint','seasonal_dispersion','seasonal_history','seasonal_width','random_capacity_long_seasonal'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='random_capacity_original_ar': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.synthetic_ar_coefficient_law='uniform(0.2,0.995), original generator; unchanged AR branch probability and asymptotic variance scaling' +if Path(a.code_dir).name=='log_horizon': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.requested_horizon_law='half full; half geometric quantile remap of the original uniform integer endpoint draw from min(16,max(1,H//4)) to H, then patch16 rounding; identical RNG consumption' +if Path(a.code_dir).name=='seasonal_history': + a.learned_seasonal_history_context=16384;a.recent_encoder_and_rule_context=4096 + a.history_extension_rule='extend originally full4096 real contexts before the same cutoff, preserving original recent contexts, targets, aggregation, sampler RNG and horizon RNG; synthetic extra prefix missing' +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None;teacher_predict=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + teacher_predict=teacher + if a.compile_teacher: + torch._dynamo.config.recompile_limit=64 + teacher_predict=torch.compile(teacher.__call__,fullgraph=True,dynamic=False) +else: + assert not a.compile_teacher, '--compile-teacher requires a declared own-model teacher' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/watch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/watch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..3bd2f95022f87dbe1c349575c0ec77662a2d4d6e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/member3/training/recovery/watch_matched_cutoffs.py @@ -0,0 +1,34 @@ +"""Complete declared primary/durability comparisons; never select a model automatically.""" +import argparse,datetime,json,os,subprocess,time +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['run','control','evaluator','label']:ap.add_argument('--'+key,required=True) +ap.add_argument('--control-evaluator');ap.add_argument('--steps',default='6000,12000');a=ap.parse_args();start=time.monotonic() +receipt=R/(a.run+'_matched_cutoffs_receipt.json') +state=dict(pid=os.getpid(),status='running',run=a.run,control=a.control,steps=[],started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) +def save(): + state['seconds']=time.monotonic()-start;tmp=receipt.with_suffix('.tmp');tmp.write_text(json.dumps(state,indent=2));os.replace(tmp,receipt) +def call(label,command): + state['status']=label;save();t=time.monotonic();result=subprocess.run(command);state['steps'].append(dict(label=label,returncode=result.returncode,seconds=time.monotonic()-t));save() + if result.returncode:state['status']='failed';save();raise SystemExit(result.returncode) +for step in map(int,a.steps.split(',')): + name=a.run+'_ema'+str(step);report=R/'evals'/name/'report.json';state['status']='waiting for main'+str(step);save() + while not report.exists(): + queue=R/(a.run+'_queue.json') + if queue.exists() and json.loads(queue.read_text()).get('status')=='failed':state['status']='training failed';save();raise SystemExit(1) + time.sleep(3) + time.sleep(1) + call('earlier cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',name,'--weights',str(R/'runs'/a.run/f'ema{step:06d}.pt'),'--evaluator',a.evaluator,'--cutoffs','1,2,3']) + control_name=a.control+'_ema'+str(step) + if any(not (R/folder/control_name/'report.json').exists() for folder in ['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert a.control_evaluator,'Missing matched control reports; pass --control-evaluator for their declared evaluation' + call('control cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',control_name,'--weights',str(R/'runs'/a.control/f'ema{step:06d}.pt'),'--evaluator',a.control_evaluator]) + out=R/(a.run+str(step//1000)+'k_four_cutoff_comparison.json') + if out.exists(): + cached=json.loads(out.read_text());assert cached['candidate']==name and cached['control']==a.control+'_ema'+str(step) and len(cached['rows'])==4 + for row,folder in zip(cached['rows'],['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert row['candidate_checkpoint']==json.loads((R/folder/name/'report.json').read_text())['checkpoint_sha256'] + assert row['control_checkpoint']==json.loads((R/folder/(a.control+'_ema'+str(step))/'report.json').read_text())['checkpoint_sha256'] + state['steps'].append(dict(label='reused verified matched comparison'+str(step),returncode=0,seconds=0));save();continue + call('matched comparison'+str(step),['python3',str(R/'recovery/matched_report.py'),'--candidate',name,'--control',a.control+'_ema'+str(step),'--label',a.label+' '+str(step)+' four-cutoff comparison','--cutoffs','0,1,2,3','--out',str(out),'--outcome',f'Declared comparison checkpoints {a.steps}. No transfer formula or automatic publication is selected by this controller.']) +state['status']='complete; research review required';save();print(json.dumps(state),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..40313237b17a9a47accb31b4fa27835776886c9c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/provenance/publish.py @@ -0,0 +1,104 @@ +"""Assemble and atomically publish a complete four-member, fixed-weight package.""" +import argparse +import ctypes +import hashlib +import json +import os +import shutil +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ap = argparse.ArgumentParser() +ap.add_argument('--member', action='append', required=True) +ap.add_argument('--out', required=True) +ap.add_argument('--report') +ap.add_argument('--experiments', default='/workspace/research/direct_v1/EXPERIMENTS.md') +a = ap.parse_args() +assert len(a.member) == 4 +final = Path(a.out) +stage = final.parent / f'.{final.name}-staging-{os.getpid()}' +shutil.rmtree(stage, ignore_errors=True) +stage.mkdir(parents=True) + +def digest(path): + h = hashlib.sha256() + with Path(path).open('rb') as f: + for block in iter(lambda: f.read(8 * 1024 * 1024), b''): + h.update(block) + return h.hexdigest() + +for name in ('infer.sh', 'predict.py', 'model.py', 'seasonal.py', 'continuity.py', + 'zero_mass.py', 'ts_io.py'): + shutil.copy2(HERE / 'runtime' / name, stage / name) +shutil.copy2('/opt/runtime/requirements.txt', stage / 'requirements.txt') +shutil.copy2(a.experiments, stage / 'EXPERIMENTS.md') +members, sources, lineage = [], set(), {} +for i, source in enumerate(map(Path, a.member)): + manifest = json.loads((source / 'model_manifest.json').read_text()) + assert manifest['pretrained_assets'] == [] + for shared in ['seasonal.py','continuity.py','zero_mass.py']: + assert digest(source/shared)==digest(stage/shared),'Members must retain identical fixed postprocessing rules' + name = f'member{i}.pt' + model_code = f'model{i}.py' + shutil.copy2(source / 'model.py', stage / model_code) + assert digest(stage / model_code) == manifest['runtime_code_sha256']['model.py'] + shutil.copy2(source / 'weights.pt', stage / name) + assert digest(stage / name) == manifest['weights_sha256'] + members.append({'weights': name, 'weights_sha256': manifest['weights_sha256'], + 'parameters': manifest['parameters'], 'config': manifest['config'], 'model_code': model_code}) + sources.update(manifest['sources_used']) + for item in manifest['training_lineage']: + lineage.setdefault(item['sha256'], item) + dst = stage / 'provenance' / f'member{i}' + dst.mkdir(parents=True) + shutil.copy2(source / 'model_manifest.json', dst / 'model_manifest.json') + shutil.copytree(source / 'provenance', dst / 'training') +shutil.copy2(__file__, stage / 'provenance' / 'publish.py') +descriptor = {'members': members, 'weights': [1/4]*4, + 'composition': 'mean after each member applies its fixed inference rules'} +(stage / 'config.json').write_text(json.dumps(descriptor, indent=2) + '\n') +identifier = digest(stage / 'config.json') +manifest = { + 'name': 'direct-seasonal-four-member-foundation', 'contract': 'timeseries-forecast/v1', + 'parameters': sum(m['parameters'] for m in members), 'pretrained_assets': [], + 'sources_used': sorted(sources), 'members': members, + 'checkpoint_sha256': identifier, + 'checkpoint_digest_method': 'SHA-256 of config.json, including ordered member weight hashes', + 'training_lineage': list(lineage.values()), 'ensemble_weights': [1/4]*4, + 'every_member_forecasts_every_instance': True, + 'member_history_caps': [{'input_and_summary': m['config']['max_context'], 'encoder_and_normalization': m['config'].get('encoder_context',m['config']['max_context']), 'fixed_rules': m['config'].get('encoder_context',m['config']['max_context'])} for m in members], + 'postprocessing_order': 'each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4, finite-value replacement; then equal quantile average', + 'runtime_code_sha256': {p.name: digest(p) for p in stage.iterdir() if p.suffix in ('.py', '.sh')}, + 'notes': 'All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation.', +} +(stage / 'model_manifest.json').write_text(json.dumps(manifest, indent=2) + '\n') +if a.report: + report = json.loads(Path(a.report).read_text()) + assert report['checkpoint_sha256'] == identifier + shutil.copy2(a.report, stage / 'validation_report.json') +else: + report = {'status': 'candidate validation pending'} + (stage / 'validation_report.json').write_text(json.dumps(report) + '\n') +if final.resolve() == Path('/workspace/submission').resolve(): + assert a.report and report['n_configs'] == 97 and report['n_instances'] == 151170 + assert report['n_failed'] == 0 +patch_sizes = ', '.join(str(m['config'].get('input_patch', m['config']['patch'])) + '/' + str(m['config']['patch']) for m in members) +(stage / 'README.md').write_text(f'''# Four-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains four locally trained models totaling {manifest['parameters']:,} parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed equal weights of 1/4 each. + +Each member retains its declared context limits, listed in model_manifest.json under member_history_caps. A model with a separate encoder_context uses longer history only for learned seasonal summaries; its encoder, normalization and fixed forecast rules use the shorter declared limit. Their history/forecast patch sizes are {patch_sizes}, in member order. Each member retains its own original model implementation and normalization; overflow handling follows each member's own implementation. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary uses a fixed width of 128 observations. The zero projection threshold is 0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. +''') +if final.exists(): + libc = ctypes.CDLL(None, use_errno=True) + if libc.renameat2(-100, os.fsencode(stage), -100, os.fsencode(final), 2): + raise OSError(ctypes.get_errno(), os.strerror(ctypes.get_errno())) + shutil.rmtree(stage) +else: + os.replace(stage, final) +print(json.dumps({'out': str(final), 'checkpoint_sha256': identifier, + 'parameters': manifest['parameters']})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/requirements.txt b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca733199990e5dc8e6a90509cc691f00ab8e9f5d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/requirements.txt @@ -0,0 +1,12 @@ +# Runtime pins recorded from the contributor's working environment on 2026-09-17 (Python 3.11). +# torch comes from the pytorch/pytorch:2.14.0-cuda12.6-cudnn9-runtime base image (cu130 needs driver >= 580). +torch==2.14.0 +numpy==2.4.6 +h5py==3.16.0 +pandas==2.3.3 +scipy==1.17.1 +pyarrow==25.0.1 +huggingface-hub==0.36.2 +einops==0.8.2 +safetensors==0.8.0 +pytest==9.1.1 diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/seasonal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/seasonal.py new file mode 100644 index 0000000000000000000000000000000000000000..cd8d8ebbf65c59c69f3d1c537e8cd5cb024d0330 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/seasonal.py @@ -0,0 +1,51 @@ +"""A fixed confidence gate for highly repeatable history; no fitted parameters.""" +import numpy as np + +def apply_gate(ctx,periods,quant,threshold=.25,strength=1.,cycles=4,mode='aligned'): + # Each row uses only its own context. Quantile blending preserves ordering. + b,_,h=quant.shape + out=quant.copy() + for i in range(b): + x=ctx[i];valid=np.isfinite(x) + if not valid.any():continue + x=x[np.flatnonzero(valid)[0]:] + best=None + for p in periods[i]: + p=int(p) + if p<2 or len(x)<3*p:continue + k=min(len(x)//p,8);history=x[-k*p:] + pairs=np.isfinite(history[p:])&np.isfinite(history[:-p]) + if pairs.sum()0) + if mode in ('centered','aligned'): + mu=mu+np.nanmean(seasons[-1])-np.nanmean(mu) + if mode=='aligned' and np.isfinite(seasons[-1]).sum()>=max(2,.75*p): + noise=float(np.mean(err.astype(np.float64)**2)/2) + target_var=max(0.,float(np.nanvar(seasons[-1]))-noise) + template_var=max(0.,float(np.nanvar(mu))-noise/min(k,cycles)) + ratio=float(np.clip(np.sqrt(target_var/max(template_var,1e-12)),.5,2.)) + center=float(np.nanmean(mu));mu=center+(mu-center)*ratio + if mode=='exponential': + w=.5**np.arange(len(recent)-1,-1,-1,dtype=np.float32) + den=(w[:,None]*np.isfinite(recent)).sum(0) + mu=np.divide((w[:,None]*np.nan_to_num(recent)).sum(0),den,out=np.full(p,np.nan,np.float32),where=den>0) + # Error of a season relative to the previous one, corrected for averaging. + sigma=float(np.sqrt(np.mean(err.astype(np.float64)**2)/2*(1+1/min(k,cycles)))) + idx=np.arange(h)%p;median=mu[idx] + z=np.array([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0,.2533471031,.5244005127,.8416212336,1.2815515655]) + sq=median[None]+z[:,None]*sigma + sq=np.where(np.isfinite(sq),sq,quant[i]) + if np.nanmin(x)>=0:sq=np.maximum(0,sq) + best=(weight,sq) + if best is not None:out[i]=(1-best[0])*quant[i]+best[0]*best[1] + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..c0c3db0da58ad5f4a8f4a2e850ff31338327a4fd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.38414971818207, + "skill_score": 0.38414971818207, + "rel_mase_gmean": 0.7359214701420272, + "rel_wql_gmean": 0.5153696216282796, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.7370661654238014, + "rel_wql_gmean": 0.4870613840327937 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7035568522010156, + "rel_wql_gmean": 0.4967421745656887 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.7482238088438601, + "rel_wql_gmean": 0.534061406229245 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.8936682790834078, + "rel_wql_gmean": 0.8472701606637754 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.8933899290073212, + "rel_wql_gmean": 0.6445556003786379 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.5480012217385011, + "rel_wql_gmean": 0.48208920761109747 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.7953127513029141, + "rel_wql_gmean": 0.389788044313917 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8217544369925983, + "rel_wql_gmean": 0.5047441377343534 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.6377281006131936, + "rel_wql_gmean": 0.43557452884567677 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5631059826545753, + "rel_wql_gmean": 0.4433418331722157 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6752014897744523, + "rel_wql_gmean": 0.7200591582178348 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7563484471131603, + "rel_wql_gmean": 0.5138217230504389 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7311038718235064, + "rel_wql_gmean": 0.4971111681515511 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 0.9342735895756479, + "rel_wql_gmean": 0.7778728906275383 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.7920689666327733, + "rel_wql_gmean": 0.8303819835711909 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.6585051551396908, + "rel_wql_gmean": 0.5044743977155955 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.684929858684541, + "rel_wql_gmean": 0.45855127549526375 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.8803309406332804, + "rel_wql_gmean": 0.6556577952107419 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7098257994419515, + "rel_wql_gmean": 0.5133690105719589 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.7573857941665847, + "rel_wql_gmean": 0.5169682752723933 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.1942454566819865, + "wql": 0.11234615473688546, + "wsql_by_level": [ + 0.06279988710459403, + 0.09686962039928947, + 0.11877171722326317, + 0.13180696635826364, + 0.13780697293845137, + 0.13776422219718135, + 0.13009884788768172, + 0.11303862492097355, + 0.0821585336022708 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 715.3433388850173, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6752014897744523, + "wql": 0.7200591582178348 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2601099114939882, + "wql": 0.08270528452169343, + "wsql_by_level": [ + 0.04850077401546678, + 0.0736151198346848, + 0.08902641480861387, + 0.09808912879809202, + 0.10179663089296853, + 0.10041936620294098, + 0.09401911603258326, + 0.08089750287447103, + 0.057983507235419715 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 579.6595620530242, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7920689666327733, + "wql": 0.8303819835711909 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9886240448494336, + "wql": 0.09223347064447941, + "wsql_by_level": [ + 0.0536329799783513, + 0.08184407190336042, + 0.09949726051076829, + 0.110007683186058, + 0.1145325539957287, + 0.11299542948777908, + 0.10495686462870878, + 0.08940488709678841, + 0.06322950501277168 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 543.0775251011405, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.799424866369737, + "wql": 0.7828921300061156 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2333137578173363, + "wql": 0.049885021180902676, + "wsql_by_level": [ + 0.025582934129854892, + 0.040307998175729824, + 0.05134192403811192, + 0.058383364818190175, + 0.06249558188245619, + 0.06378093329074119, + 0.06050024308830595, + 0.05127734953803384, + 0.035294861666700074 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 325.2805288362348, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.116811794488676, + "wql": 0.7664342198122722 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2818896992396467, + "wql": 0.021958428488480695, + "wsql_by_level": [ + 0.013886150731007945, + 0.020084697824339613, + 0.023780724091338447, + 0.02581736093459605, + 0.026669990592701465, + 0.026443386548809508, + 0.02479661103553365, + 0.021138257343651833, + 0.01500867729434777 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 170.88125005869563, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0204511538738066, + "wql": 0.9505147997954277 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.284215504172083, + "wql": 0.03739842309219142, + "wsql_by_level": [ + 0.018906848615453793, + 0.03157159415475922, + 0.04023474908234907, + 0.04515002009684665, + 0.047496469378928825, + 0.04734366287714808, + 0.04400275645183478, + 0.03676006277519546, + 0.02511964439720693 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 357.7909320348742, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0454705446403485, + "wql": 1.0847999978576948 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9739241343459598, + "wql": 0.04803171607457929, + "wsql_by_level": [ + 0.03044392297950255, + 0.046345210362901394, + 0.056200456644109956, + 0.06122785321008606, + 0.06227944072589734, + 0.05890391924314802, + 0.05095994463791686, + 0.03957724975393159, + 0.02634744711371983 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 63.26050327945158, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8921314220005111, + "wql": 0.7748471191485009 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.956801773506966, + "wql": 0.08968809591770686, + "wsql_by_level": [ + 0.04173966131277943, + 0.06668031582024125, + 0.0848612456732918, + 0.09903320997057591, + 0.10946747577434283, + 0.11429265370430391, + 0.1123655236992128, + 0.10165272998571225, + 0.07710004731890148 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 78.73133452635236, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.6336462055010674, + "wql": 0.7440363918722698 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.879521690509096, + "wql": 0.08608315022414861, + "wsql_by_level": [ + 0.040181483887529894, + 0.06445068846598757, + 0.08152981865018366, + 0.09383141768219364, + 0.1033129881753266, + 0.10802759145739467, + 0.1074090148038446, + 0.09865096030981156, + 0.0773543885850654 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 74.49346514944207, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8038711745104181, + "wql": 0.8002945158847535 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0357267565902744, + "wql": 0.07523547013806905, + "wsql_by_level": [ + 0.04731839199897801, + 0.06831310308883365, + 0.08275190164752887, + 0.09073563549499945, + 0.0938303703377631, + 0.0923570116600489, + 0.08552629881906862, + 0.07111668015149752, + 0.04516983804390337 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 284.96569912068634, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.050263117241495, + "wql": 1.112437460621722 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9690755237401555, + "wql": 0.07849752765396238, + "wsql_by_level": [ + 0.04262185331619939, + 0.06431004278880409, + 0.07788329912213776, + 0.08702498256041323, + 0.09452469509217211, + 0.0975341476159309, + 0.09482005392413478, + 0.08476915756359987, + 0.06298951690226928 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 254.38164355313052, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.7766009643794579, + "wql": 0.6376131241949101 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1903440314402591, + "wql": 0.09190336322630345, + "wsql_by_level": [ + 0.043491039868539694, + 0.06922425096156591, + 0.08747862805119525, + 0.10043019632078938, + 0.10886291915915705, + 0.11278075150439752, + 0.1121160665688211, + 0.1056231952495502, + 0.0871232213527149 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 298.3711609572229, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8773821182723436, + "wql": 0.626262909521158 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4759089130583483, + "wql": 0.06695111408434455, + "wsql_by_level": [ + 0.029002015351609997, + 0.04870773850899997, + 0.06450487581601848, + 0.07558626380562888, + 0.08326568303054908, + 0.08594716233913346, + 0.0835409946538403, + 0.07504689066817931, + 0.056958402585141364 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 5477.1439991475445, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8968456235586946, + "wql": 0.7229065968385615 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4374193389813472, + "wql": 0.06595345058836698, + "wsql_by_level": [ + 0.026732141646914183, + 0.04748869968268463, + 0.06706334991378293, + 0.07738341536725468, + 0.08440363359041284, + 0.08560377262667798, + 0.08067302452753743, + 0.07103033853799198, + 0.05320267940204618 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 36347.413636721896, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0915333170350061, + "wql": 1.010946949106995 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.018199418751639645, + "wql": 0.42901637532483616, + "wsql_by_level": [ + 0.18534124520446438, + 0.3497452906856371, + 0.44962145886623484, + 0.5006310591714044, + 0.5255843972576065, + 0.5194286667585368, + 0.5088579516271483, + 0.4737865610281875, + 0.3481507473243056 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.0507921051747254, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.136159589523164, + "wql": 0.0354015872018585 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6715781683084437, + "wql": 0.27399840612589454, + "wsql_by_level": [ + 0.21976536581001124, + 0.3171834239140191, + 0.3513059104461602, + 0.3488245661719687, + 0.32495505493521937, + 0.29335904407265273, + 0.25567197594067687, + 0.20969804335244327, + 0.14522227048989933 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.5526998379866541, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.806078298970429, + "wql": 0.48491585148334093 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7033703525218643, + "wql": 0.22318663169933764, + "wsql_by_level": [ + 0.16845880256870888, + 0.2581184125668115, + 0.2942072344098751, + 0.29843945527681837, + 0.2808863229184129, + 0.24629836681384942, + 0.19814934774894505, + 0.15026738053640745, + 0.11385436245421023 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.650410322357114, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3283531589997496, + "wql": 0.24709873201347488 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.870376326971509, + "wql": 0.3332018672170559, + "wsql_by_level": [ + 0.2481899054834295, + 0.38368330801520134, + 0.4364845764108726, + 0.4392508381373571, + 0.4121315895117938, + 0.36923780833250014, + 0.31058932477097584, + 0.24089371283972097, + 0.15835574145165207 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 11.367308088080332, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8234930871770287, + "wql": 0.5532182134467158 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1988963235798864, + "wql": 0.4490217116694114, + "wsql_by_level": [ + 0.47926169461388846, + 0.5796113986881352, + 0.5949078448338, + 0.5697667473343782, + 0.5222597216924023, + 0.45855236947276273, + 0.3792762281092892, + 0.28310119338122747, + 0.17445820689881916 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 15.650572411064624, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8698560266298947, + "wql": 0.4638738033378885 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0400903240671804, + "wql": 0.35740651441632004, + "wsql_by_level": [ + 0.43178728674779515, + 0.4679072884558275, + 0.4649714846388392, + 0.44175223069647374, + 0.4054598736864301, + 0.3575822225625056, + 0.2968809025680233, + 0.2211033303549126, + 0.12921401003607302 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.668441401826163, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9699258159438926, + "wql": 0.39589184808261296 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1424134338598282, + "wql": 0.2874221612354655, + "wsql_by_level": [ + 0.2427452471063124, + 0.34644552554994507, + 0.3814874371935646, + 0.38210511128412644, + 0.3571730836024456, + 0.315267049731431, + 0.25871621611045625, + 0.19092573352121317, + 0.1119340470196951 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 288.97553712097687, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9788827861694458, + "wql": 0.6096927849444252 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0232197745460292, + "wql": 0.12126760523101944, + "wsql_by_level": [ + 0.058705663034418036, + 0.11393108170766246, + 0.14488441850588338, + 0.15415751374222433, + 0.1530318632537061, + 0.14503715765937433, + 0.13142804293342358, + 0.11131504244481956, + 0.07891766379766328 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 939.7285090536967, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0152421707141261, + "wql": 0.8729971370245692 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7940810389534251, + "wql": 0.055793507776085126, + "wsql_by_level": [ + 0.03084659952118411, + 0.046978468770668635, + 0.05757089869607865, + 0.06554383754343963, + 0.06969548379007463, + 0.06975298192864461, + 0.06544624343996511, + 0.0562154101484624, + 0.04009164614624826 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 19.350340746631314, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8513944345745558, + "wql": 0.8801194783960621 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 43.58626553648207, + "wql": 0.07393998575858873, + "wsql_by_level": [ + 0.06339245508799747, + 0.09210683975694246, + 0.10751590634769316, + 0.10372799305133194, + 0.08987957337659641, + 0.058075319039994494, + 0.04020247389847339, + 0.051612469577213806, + 0.058946841691055483 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 182.595511816386, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8621470217945005, + "wql": 0.5892068555593525 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4554235368762092, + "wql": 0.024494646394098925, + "wsql_by_level": [ + 0.010536652165626116, + 0.015438289165195376, + 0.020348453617006292, + 0.023343133111219935, + 0.029555670284232543, + 0.03397918904997593, + 0.03544376889615347, + 0.03111743903073173, + 0.02068922222674893 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 300.76539713541666, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.19561977049457996, + "wql": 0.18760263891423218 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.2703878408583362, + "wql": 0.00763214042780642, + "wsql_by_level": [ + 0.005469898508513414, + 0.005909935297949571, + 0.005821575216465443, + 0.007617449325929611, + 0.008079054350359454, + 0.008208365873716593, + 0.009746997303506082, + 0.010003828527620879, + 0.007832159446196743 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 2536.2265625, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8944022202303985, + "wql": 0.6874685607720463 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.484777209239672, + "wql": 0.01643704297496297, + "wsql_by_level": [ + 0.006379482161670781, + 0.015431484331810399, + 0.020148185228095705, + 0.021661493716425007, + 0.02172031296471486, + 0.020617849167314992, + 0.018457447557059633, + 0.014998333327732247, + 0.008518798319843124 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 1615.7822265625, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38481312888869046, + "wql": 0.38934610722917534 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.127130440643957, + "wql": 0.31495476166496517, + "wsql_by_level": [ + 0.1466964250707064, + 0.25505550103598035, + 0.3412197673898517, + 0.40809682791153473, + 0.4425561723812525, + 0.4269447901846375, + 0.35587810764891215, + 0.2273871536503431, + 0.2307581097114682 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 13.748745187123616, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8021438089982458, + "wql": 0.5812434003673957 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4266914835222526, + "wql": 0.22582246906727127, + "wsql_by_level": [ + 0.1236888669689332, + 0.20520813457837447, + 0.24740955231160655, + 0.25800016941051407, + 0.2543383461463755, + 0.2397906176334221, + 0.25029404873740513, + 0.2579573535906851, + 0.19571513222812525 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 7.396733681360881, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.284128312983188, + "wql": 0.8635612789622682 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6926705057519791, + "wql": 0.22787761450537655, + "wsql_by_level": [ + 0.10657744328132507, + 0.1658796682749088, + 0.23906336183316, + 0.303588816814282, + 0.33948455083841544, + 0.33794598109915125, + 0.26287172492339217, + 0.13334508384900148, + 0.16214189963475267 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.301609635353088, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2182655363170456, + "wql": 0.3801703829106233 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.1081505247481016, + "wql": 0.5237265471395698, + "wsql_by_level": [ + 0.1771613183032218, + 0.3334289781062968, + 0.46850925501435453, + 0.5782510154869053, + 0.6575598703447675, + 0.7026933162400434, + 0.701794137266768, + 0.6336883788637775, + 0.46045265462999396 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.606479291557745, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6405366324133481, + "wql": 0.4764688577340779 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5383336916462691, + "wql": 0.38277767707395466, + "wsql_by_level": [ + 0.14880228808153476, + 0.2581616839376481, + 0.3527135361380904, + 0.4292032580549203, + 0.4815685079484318, + 0.5012820801658495, + 0.492810522441057, + 0.44928123192513514, + 0.33117598497292455 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.377505819086952, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7903622133548192, + "wql": 0.6108659635282011 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9244152025733541, + "wql": 0.45915700967084966, + "wsql_by_level": [ + 0.1773256880321255, + 0.3269742893888494, + 0.4479948914904603, + 0.5388266353549304, + 0.5960885311669089, + 0.6114991018420525, + 0.5811670294401192, + 0.4996131812194685, + 0.3529237391027325 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 19.978703712333903, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7232474753212357, + "wql": 0.4373344850617326 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8717047643573905, + "wql": 0.47541687645620434, + "wsql_by_level": [ + 0.18585836114326218, + 0.33492322669765495, + 0.4565529778505489, + 0.5489952786964406, + 0.6094782992342179, + 0.6329493700005366, + 0.614275008914694, + 0.5359306694950144, + 0.3597886960734699 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.587965533381375, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8885420318236661, + "wql": 0.3845718739981856 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0150288525237507, + "wql": 0.39141361383976897, + "wsql_by_level": [ + 0.16429977372643476, + 0.2891168312401022, + 0.380972809771325, + 0.44658044878314845, + 0.4876526990840349, + 0.5048667715371904, + 0.4951861069392327, + 0.44320451122814764, + 0.31084257224830425 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 15.135022740493175, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8365961904450201, + "wql": 0.43515274762358147 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4176098897450378, + "wql": 1.123656992287591, + "wsql_by_level": [ + 0.27829308837321176, + 0.5460696185899988, + 0.8160739799666892, + 1.0834877220001076, + 1.3185458476155434, + 1.5103331200138979, + 1.6278283895387904, + 1.6009961054665962, + 1.3312850590234846 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6239312704589692, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.9105852494443916, + "wql": 0.6962314203967831 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6946419904855707, + "wql": 0.26224355418456896, + "wsql_by_level": [ + 0.13182698643932184, + 0.2151133588461941, + 0.2741845268507833, + 0.3132398779725301, + 0.3334525664588416, + 0.3338977095678976, + 0.31201842861556206, + 0.2648672721851674, + 0.18159126072482254 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.1320070552226005, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6926899970972817, + "wql": 0.38787898501794765 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9568528934413725, + "wql": 0.6321018382175995, + "wsql_by_level": [ + 0.19802614772858937, + 0.37128293797209316, + 0.5230354521373839, + 0.6551892882062486, + 0.7610630430312788, + 0.8368538509187501, + 0.8712306436174554, + 0.8315067852652993, + 0.640728395081297 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 2.9845925691756294, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8733325670777369, + "wql": 0.43330875497371296 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8238386385328981, + "wql": 0.40951527550304384, + "wsql_by_level": [ + 0.1526078149204399, + 0.2720642560417895, + 0.3630290287973565, + 0.4332677495091701, + 0.4875868185378466, + 0.524943854360932, + 0.538333291755064, + 0.5123317706341857, + 0.40147289497061045 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 11.90558916027263, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8278069116332069, + "wql": 0.5546739898640968 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3950908501452917, + "wql": 0.028683256316882757, + "wsql_by_level": [ + 0.019627796250655746, + 0.02748312409149781, + 0.03229340987287318, + 0.03493677291124117, + 0.03591380074034261, + 0.03494883214480333, + 0.031683521292033286, + 0.025598056329154423, + 0.015663993219343274 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.329317257500285, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6489216583306632, + "wql": 0.5000467001382035 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6125039078002776, + "wql": 0.05102671406103912, + "wsql_by_level": [ + 0.0407341155639753, + 0.05411081717761517, + 0.060921131009329374, + 0.06350803485131697, + 0.0628062970195256, + 0.05887318905675829, + 0.05172533623187953, + 0.04098142248046768, + 0.02558008315848413 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.815726597061221, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3846216164188108, + "wql": 0.36163970874822315 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6783028550959439, + "wql": 0.057705590298614946, + "wsql_by_level": [ + 0.04537829253117405, + 0.06170597366409711, + 0.06963570437591388, + 0.07244954698705448, + 0.07113037305210834, + 0.06631456281123693, + 0.05804504998726885, + 0.045907031484353295, + 0.0287837777943276 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.184390898398981, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4263310585319084, + "wql": 0.39112021622502763 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6756037825841527, + "wql": 0.04357026058389341, + "wsql_by_level": [ + 0.035108524109673696, + 0.046433021204805774, + 0.05147104802783375, + 0.05337360217597081, + 0.052744467560669916, + 0.050181796152733174, + 0.04480413387778564, + 0.03570342886868997, + 0.022312323276877936 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.19483868936144, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.33609663788769606, + "wql": 0.3188297610471391 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7161954249495117, + "wql": 0.05105439065772778, + "wsql_by_level": [ + 0.04336908530487405, + 0.05659989007767167, + 0.06184821641982101, + 0.06271594948534552, + 0.06074862674423944, + 0.056407304326266734, + 0.04991607451861809, + 0.040783142324667315, + 0.02710122671804616 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.389214871590813, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6208722351119349, + "wql": 0.3423876409164738 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7196126562096288, + "wql": 0.05093635336262836, + "wsql_by_level": [ + 0.042928701825906274, + 0.055580439899729314, + 0.06070604051034585, + 0.06178481486132252, + 0.06021139897194038, + 0.056409729689059315, + 0.050468262222305785, + 0.04182208886741801, + 0.02851570341562783 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.3794747300535737, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.578069936515989, + "wql": 0.29062676130423726 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6021595362033416, + "wql": 0.027951534556589337, + "wsql_by_level": [ + 0.020425445313600885, + 0.029011601982317697, + 0.03333648801629737, + 0.035002225824860525, + 0.03458952722071596, + 0.0323426610449462, + 0.028532384612527655, + 0.023103422243499407, + 0.015220054750538345 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 1.9414003850505817, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5079746959814624, + "wql": 0.30114578007121634 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5174408972666434, + "wql": 0.19559184169992438, + "wsql_by_level": [ + 0.10197686864817931, + 0.16594593634985766, + 0.20896732998351109, + 0.2360519842122862, + 0.2484470779078739, + 0.24602200206386815, + 0.22871372528493775, + 0.19270740513690937, + 0.1314942457118958 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.780729218559872, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7136042489548348, + "wql": 0.6469057798517731 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46647035063132336, + "wql": 0.1947486848930516, + "wsql_by_level": [ + 0.10133435276079396, + 0.16055969901662143, + 0.20096432331096217, + 0.22725921653234632, + 0.2409914884365904, + 0.24193995774023905, + 0.2297717042535425, + 0.20195349634266796, + 0.1479639256437007 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.6671184211373142, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7345930219438965, + "wql": 0.4973100182874361 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4864709737256191, + "wql": 0.21816325041346682, + "wsql_by_level": [ + 0.115964440083069, + 0.1799472754908462, + 0.22041442218005597, + 0.24538941877128917, + 0.2583185438173168, + 0.26281697098908297, + 0.258469830282235, + 0.23877655592136957, + 0.18337179618593677 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.8688135091767433, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7995618844446138, + "wql": 0.47924508127545373 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4788341399309917, + "wql": 0.13002158935954855, + "wsql_by_level": [ + 0.06948637007568016, + 0.10832182440201168, + 0.1344924736014881, + 0.1510211760886101, + 0.15889235616231584, + 0.158618877795827, + 0.15038924006525056, + 0.13485030226924544, + 0.10412168377550803 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7565779302965225, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.786632055240403, + "wql": 0.6295506465704214 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7028143539064657, + "wql": 0.12701992507552778, + "wsql_by_level": [ + 0.09326090544263871, + 0.12588898482420036, + 0.143722409490392, + 0.15342763204468535, + 0.155426615226104, + 0.148781696613896, + 0.13521609390977588, + 0.1122298024122189, + 0.07522518571583905 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 97.89664143853717, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8037071089072418, + "wql": 0.6691152228440582 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7896712564593728, + "wql": 0.14013301167900574, + "wsql_by_level": [ + 0.08404243851924309, + 0.12214435952528467, + 0.14455245189024152, + 0.1589982455709574, + 0.1683150457462081, + 0.1706190145332776, + 0.16338876610099834, + 0.14374725639315644, + 0.10538952683168445 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 98.79428676578733, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6739971017745929, + "wql": 0.40067049138901256 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0883687262097466, + "wql": 0.18146529876896897, + "wsql_by_level": [ + 0.08971559175497279, + 0.1426244310841276, + 0.18064795594862415, + 0.20820921525954553, + 0.22737058696443133, + 0.2340209884075076, + 0.225269122256739, + 0.193317850272048, + 0.13201194697272478 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 133.2540677817221, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0072653986063234, + "wql": 0.47241932764308897 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0082544385973697, + "wql": 0.09242583429653625, + "wsql_by_level": [ + 0.06238985217047965, + 0.0925140864645958, + 0.11145102248242755, + 0.12094934918313807, + 0.12229336326769435, + 0.11277854067396689, + 0.09603656708282537, + 0.06983799527014982, + 0.043581732073548714 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 71.67192706214057, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.000561543301674, + "wql": 0.4639576823133695 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7790283497933572, + "wql": 0.2777938569334848, + "wsql_by_level": [ + 0.16309036409599775, + 0.2594791241155321, + 0.3127792911159382, + 0.34387130462169274, + 0.35539955880763036, + 0.3540894834443657, + 0.3233077894322711, + 0.2507439216443564, + 0.13738387512357875 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.2989092280622572, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6462379051824089, + "wql": 0.5774813421656764 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9687525304454642, + "wql": 0.3738433432158492, + "wsql_by_level": [ + 0.17749338566775905, + 0.32218279922035775, + 0.4377824213520666, + 0.4968313202034944, + 0.5076565406853707, + 0.4811950388175307, + 0.4189437451587393, + 0.3245571813673187, + 0.19794765647000565 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.6554226524994842, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2507004968822135, + "wql": 0.852201655961139 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3183628001458831, + "wql": 0.484984755525958, + "wsql_by_level": [ + 0.3131714903908517, + 0.4745020762376196, + 0.5910130087262079, + 0.6441067448989403, + 0.6402729203201174, + 0.5894408055984144, + 0.5017539677712904, + 0.3824598674780732, + 0.22814191831210678 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.195078396092036, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9934364659140196, + "wql": 0.8366421722897116 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.767238736426964, + "wql": 0.34358997645076506, + "wsql_by_level": [ + 0.2035826741546137, + 0.3021711339855281, + 0.361908302907503, + 0.41689757750610096, + 0.4416258843904016, + 0.4412782126814634, + 0.4065091194039413, + 0.3284423943942549, + 0.18989448863307867 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.3370067447069145, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.734790006109077, + "wql": 0.6811698323168786 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4099540028895037, + "wql": 0.4326045502168654, + "wsql_by_level": [ + 0.2983579563734333, + 0.4628774547657105, + 0.5342769070766757, + 0.5556419864938983, + 0.5432922841013219, + 0.5019841630825838, + 0.4352705362987078, + 0.3447241907955194, + 0.2170154729639376 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.313490383675145, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1523118127921907, + "wql": 0.7866462196134401 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4518863824861417, + "wql": 0.41835904595889783, + "wsql_by_level": [ + 0.30695021196912525, + 0.46229623004461756, + 0.5408697016549474, + 0.5595346100459413, + 0.5365298152096444, + 0.481113539766167, + 0.39951553810145823, + 0.29841418805431363, + 0.1800075787838657 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 9.033908691347413, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0138424134576136, + "wql": 0.7233987825006837 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.7470663090947824, + "wql": 0.3380665567205061, + "wsql_by_level": [ + 0.17114090462798215, + 0.299925445069192, + 0.39480922668553725, + 0.4489874668584324, + 0.45461307800595807, + 0.42546502843346795, + 0.36329206093462035, + 0.2898900195979939, + 0.1944757802713713 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 144.3052267755781, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9608785913773245, + "wql": 0.6966376628071844 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0102104998982009, + "wql": 0.19361619641284594, + "wsql_by_level": [ + 0.1328468278138967, + 0.18303209109357044, + 0.2187836903796069, + 0.22623818389494232, + 0.2167911833782864, + 0.21334399788051794, + 0.2159600687625217, + 0.19237271195637462, + 0.14317701255589643 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 541.0540885925293, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8117970088364429, + "wql": 0.7500330170430595 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0735951976603673, + "wql": 0.13016018698933965, + "wsql_by_level": [ + 0.06643228288354493, + 0.1066704113391588, + 0.13554917765581226, + 0.15497753208222192, + 0.166245960361256, + 0.1673225339480475, + 0.15696761389467728, + 0.13220428791707478, + 0.08507188282226327 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.6527655089185354, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.409241064023359, + "wql": 1.3857204706843893 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.810753877795946, + "wql": 0.0978186082836764, + "wsql_by_level": [ + 0.06507637217956345, + 0.0987489888455313, + 0.11752757166550881, + 0.1252961698455497, + 0.12424824701456005, + 0.11601211827406112, + 0.10118452420572006, + 0.07971853462394894, + 0.052554947898644254 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.8908467998705982, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8981243396866833, + "wql": 0.7166673479686673 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9988955145303348, + "wql": 0.12565005086841408, + "wsql_by_level": [ + 0.08665795118514717, + 0.12794191861988094, + 0.15272546794211683, + 0.1644716067988587, + 0.16266933441101458, + 0.149609295075255, + 0.1260861736216297, + 0.09625308154786266, + 0.06443562861396125 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.453377237647683, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9453906292811344, + "wql": 0.7498838265793618 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6813222910809958, + "wql": 0.07436713897659084, + "wsql_by_level": [ + 0.051523141390042375, + 0.07694665539625728, + 0.09058278366096925, + 0.09546835087179467, + 0.09252621906357668, + 0.08360182654464952, + 0.07118810025358367, + 0.0613494814662976, + 0.0461176921421466 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.672981592870894, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6871198990036249, + "wql": 0.6232888181371485 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.6285398311614925, + "wql": 0.2543729943338188, + "wsql_by_level": [ + 0.10439589824618484, + 0.1819840316148869, + 0.2526150853262708, + 0.3106960104449169, + 0.3476718602839414, + 0.3554034326878946, + 0.32593254450968695, + 0.2588658869410458, + 0.15179219894954135 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 19.774251721338146, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9922488035502113, + "wql": 0.7355674592657326 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.1933435868096267, + "wql": 0.35325638145697913, + "wsql_by_level": [ + 0.2780396484127942, + 0.3840755359443685, + 0.43544100516841167, + 0.4542121967401605, + 0.4468416822474937, + 0.4127083378814552, + 0.35307549015656153, + 0.26651592693186227, + 0.14839760962970475 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.213835600905476, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0067985906649999, + "wql": 0.9539819938527033 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.724642885242206, + "wql": 0.3280461389892744, + "wsql_by_level": [ + 0.29359429560720696, + 0.3946974865020523, + 0.429267514245895, + 0.43081540122460754, + 0.4066140380973866, + 0.36003882798774384, + 0.2962376714510389, + 0.21880688241782248, + 0.12234313336971597 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 549.842791125888, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.004294401112714, + "wql": 1.0294068750950112 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6357239089556035, + "wql": 0.1732805005979016, + "wsql_by_level": [ + 0.09864088386121074, + 0.17332427678576567, + 0.20839828346680458, + 0.22467491599398778, + 0.22409467705962557, + 0.20957328706444975, + 0.1766716066812609, + 0.14253687901510328, + 0.10160969545290627 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2181.0048142841883, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9251512873257697, + "wql": 0.8199161849375548 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4184142461218036, + "wql": 0.01848779113836022, + "wsql_by_level": [ + 0.007471917601995136, + 0.012608341483462114, + 0.016125488323124264, + 0.018952556646567805, + 0.021512157020107524, + 0.02310183421798816, + 0.024109324860662244, + 0.0234377471281535, + 0.019070752963181222 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.389980246209436, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5489795644328394, + "wql": 0.13526923632003676 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8206307300318567, + "wql": 0.08358293312110471, + "wsql_by_level": [ + 0.026863389238896147, + 0.054846965071851383, + 0.0767597397287812, + 0.09191082110030548, + 0.10170563190591035, + 0.10686772357422819, + 0.10651189322848116, + 0.10057121918555996, + 0.08620901505592862 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.19994460931639, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8392243081327857, + "wql": 0.3667460457477282 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7025234211133033, + "wql": 0.07797035409515174, + "wsql_by_level": [ + 0.030692736543138564, + 0.05674122623360344, + 0.07530497379131332, + 0.0876785904231552, + 0.09492731057822476, + 0.09694782188201387, + 0.09484926420838119, + 0.08873617957343484, + 0.0758550836231004 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.228216440622354, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7757955083678867, + "wql": 0.3210099528744048 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5013775342024385, + "wql": 0.05834855858792973, + "wsql_by_level": [ + 0.02492045253127565, + 0.05146668151798431, + 0.0644837575237659, + 0.0698848116385134, + 0.06997958591467884, + 0.06863743064663014, + 0.06646211907299665, + 0.06125550346269646, + 0.04804668498282631 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 11.693466186417185, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6604220234768614, + "wql": 0.3179464951035027 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8125500423965355, + "wql": 0.09344106860236025, + "wsql_by_level": [ + 0.046837476715933704, + 0.07947995489090012, + 0.0963743654255817, + 0.1050264471813984, + 0.10830260928219804, + 0.10996125072832093, + 0.10818595355989986, + 0.10171742647650217, + 0.08508413316050725 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 18.654599173606044, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7588740470514809, + "wql": 0.25663644657053963 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.998679110171069, + "wql": 0.12523982761178848, + "wsql_by_level": [ + 0.073414532028999, + 0.1233586936456292, + 0.14675889446664248, + 0.1532643474199469, + 0.1495005115930943, + 0.14199870558058444, + 0.13067045523856716, + 0.11528008395475788, + 0.09291222457787497 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 26.058697180781884, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6691059563033289, + "wql": 0.28214903904115013 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.462035408135632, + "wql": 0.11310512206521212, + "wsql_by_level": [ + 0.04937007416526524, + 0.09592569833239714, + 0.12504821124348858, + 0.1404757186723741, + 0.14601428982400788, + 0.14360771248325763, + 0.13184930836714198, + 0.1102837594583093, + 0.07537132604066714 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 25.45103093297452, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7869515649382872, + "wql": 0.48882216449239435 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0677696026520813, + "wql": 0.4709905720933086, + "wsql_by_level": [ + 0.18295178212816818, + 0.3218056064439358, + 0.42557096743580625, + 0.5124407709668181, + 0.5801002043062712, + 0.6155047612793341, + 0.6127936812818151, + 0.5595434434644737, + 0.4282039315331549 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 170.41670858889412, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5412805061944762, + "wql": 0.24811707581875186 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1142383378626914, + "wql": 0.6698877833737793, + "wsql_by_level": [ + 0.487244147289927, + 0.8435543584574441, + 0.9225934801080489, + 0.8985459940670745, + 0.8239771395188474, + 0.7195637644570807, + 0.5975361653835178, + 0.4553671868865929, + 0.2806078141954805 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 512.1474478619184, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8363233298081489, + "wql": 0.8409697226083964 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.255656624922124, + "wql": 0.4980339182411762, + "wsql_by_level": [ + 0.3299361516825172, + 0.5493494935305362, + 0.6340634724855716, + 0.6560010257511558, + 0.6352714882671093, + 0.5760139033988184, + 0.49017986908698213, + 0.37723848893855677, + 0.23425137102933802 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 463.75843968276405, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8332968119935321, + "wql": 0.7136123853481723 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.355415875080586, + "wql": 0.48752473545778446, + "wsql_by_level": [ + 0.34824373408163006, + 0.55884388819116, + 0.6385465870057265, + 0.6472786160856181, + 0.6072156556591863, + 0.5388140933855665, + 0.45835723997927275, + 0.36312924217288906, + 0.22729356255901007 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 428.6973041238485, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8704285658865741, + "wql": 0.7823903295640211 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5524477759951592, + "wql": 0.22552264774601558, + "wsql_by_level": [ + 0.11259701465866091, + 0.1740861799019515, + 0.21613875780502614, + 0.24565686871602443, + 0.2615965510973232, + 0.2663065585541035, + 0.2614397579764183, + 0.2633125388611826, + 0.22856960214344957 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 140.18347193979088, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6600566334205797, + "wql": 0.25181570478471654 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8196561297205004, + "wql": 0.8610966036846335, + "wsql_by_level": [ + 0.3192157505448027, + 0.6590544673349387, + 0.8542960064348951, + 0.9696405429820717, + 1.0310598982038226, + 1.0527264099369258, + 1.0329308178271241, + 0.9654686123871999, + 0.8654769275099218 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 309.6463715818684, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8415295780061023, + "wql": 0.7796305230499134 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9689327549814218, + "wql": 0.732697301032435, + "wsql_by_level": [ + 0.26296022802468266, + 0.43030015398607113, + 0.5732122528309505, + 0.7038570564291331, + 0.8213957007531844, + 0.925534946582297, + 1.0037916335393515, + 1.030083623588021, + 0.8431401135582245 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 268.6980199508666, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.8309828605158653, + "wql": 0.7343469513290874 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9084666783113396, + "wql": 0.6230065413535412, + "wsql_by_level": [ + 0.19019145823604586, + 0.35309401063215745, + 0.5234812159381675, + 0.6734563686561106, + 0.7919273250060723, + 0.8481716805083073, + 0.8386614858554557, + 0.7705963587325313, + 0.6174789686170218 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 256.53444871291146, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8129203090967604, + "wql": 0.6688473853298512 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5378955445127478, + "wql": 0.009674292722745441, + "wsql_by_level": [ + 0.0057257245561528145, + 0.00921374239940092, + 0.011476518935274647, + 0.012678107193785093, + 0.012981320319976973, + 0.01235396854284605, + 0.010587463379293892, + 0.0077855760496841385, + 0.0042662131282944354 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 335.89685656229653, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38598465889329997, + "wql": 0.5256461536126273 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.672785100142627, + "wql": 0.009017796427591044, + "wsql_by_level": [ + 0.005338828955761613, + 0.008052182791377616, + 0.009914692216714155, + 0.01106426355096117, + 0.011564000960076789, + 0.011304421876079699, + 0.010292269534149483, + 0.00837937083148371, + 0.005250137131715154 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 276.84342694918314, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7326151056024063, + "wql": 0.6561990863082663 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7112860068460157, + "wql": 0.009404053371212433, + "wsql_by_level": [ + 0.005629539113836025, + 0.008812122350423208, + 0.010798039972113808, + 0.011813716582271884, + 0.011975467072117078, + 0.011504949588062191, + 0.010359350174628627, + 0.008412428118060051, + 0.005330867369399032 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 291.7866864331563, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9499951619950396, + "wql": 0.7265924379133442 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5101335190109032, + "wql": 0.009038993894125139, + "wsql_by_level": [ + 0.005556438750634697, + 0.008751985095275005, + 0.010804047204269411, + 0.011867644366990162, + 0.012055961128959937, + 0.011440794224365008, + 0.00991536709952197, + 0.0072984051152355095, + 0.0036603020618745487 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 16.165576594311094, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.48312284722035415, + "wql": 0.35426144426837486 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6765994678994637, + "wql": 0.0098348022995554, + "wsql_by_level": [ + 0.00607388716831971, + 0.009215203113771048, + 0.01117999778905323, + 0.01223734513145026, + 0.012502923996508625, + 0.01205666910430289, + 0.010875122863453827, + 0.008828451233038947, + 0.0055436202961000654 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.770085565249126, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7087303691027441, + "wql": 0.41826333551936673 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7372459124322908, + "wql": 0.010510035873702236, + "wsql_by_level": [ + 0.006319141792298703, + 0.0098382454463921, + 0.011985932374801245, + 0.013146406578054277, + 0.013456617650873057, + 0.01300338784212669, + 0.011656607787900852, + 0.009309017478401606, + 0.005874965912471607 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 17.19533864906304, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8864396019883567, + "wql": 0.4438549952948735 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.1784432977200685, + "wql": 0.0531909842220362, + "wsql_by_level": [ + 0.039708841616655735, + 0.05776168625140534, + 0.0670441040795583, + 0.06902303350531792, + 0.0665916822115211, + 0.06103054000345812, + 0.05070146316133977, + 0.039233551873637806, + 0.02762395529543174 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.7106907750879015, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.23110192960210185, + "wql": 0.24074351772923747 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4694246698086531, + "wql": 0.1508307707109458, + "wsql_by_level": [ + 0.1203751117628287, + 0.1677077208723978, + 0.18931789037158056, + 0.18686370887869222, + 0.17986939983640587, + 0.16821795020960548, + 0.1474280145872291, + 0.114415378201694, + 0.08328176167807826 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 4.003105910335268, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.325606644365387, + "wql": 0.32029513496073203 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7196661896682671, + "wql": 0.2719549438620832, + "wsql_by_level": [ + 0.14173245788801372, + 0.228586388063779, + 0.2905277648825506, + 0.33001054438900373, + 0.3638404615545374, + 0.36516612662449427, + 0.336384270734396, + 0.2550534497335866, + 0.13629303088838732 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.655954468676022, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.4278560203112029, + "wql": 0.4025567195830946 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6933794720018138, + "wql": 0.2086643993090498, + "wsql_by_level": [ + 0.12489173765273232, + 0.21237673962955037, + 0.27608416507654293, + 0.3004521827739533, + 0.2995463023425755, + 0.26240157429602945, + 0.19518606424805582, + 0.12956560199988354, + 0.07747522576212483 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.267182456950347, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.43757841748889564, + "wql": 0.37436898227795185 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.34961953762448056, + "wql": 0.2102968869791908, + "wsql_by_level": [ + 0.10974353626161192, + 0.1747273871830309, + 0.21367645665334764, + 0.23857368907924162, + 0.2522237280300209, + 0.2522394297223402, + 0.24505808334594537, + 0.22899334926306808, + 0.1774363232741106 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.4521242369764615, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.21635362659695698, + "wql": 0.1883045852676817 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4296344352341141, + "wql": 0.21523199606561463, + "wsql_by_level": [ + 0.11705631977490015, + 0.1868048832274375, + 0.23119164172177173, + 0.2549586105585033, + 0.2621387410645625, + 0.25582408578853055, + 0.2449398117407564, + 0.21865839043313648, + 0.16551548028093307 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.960607557702396, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.33559317883674433, + "wql": 0.21238500432984028 + } + } + ], + "checkpoint_sha256": "fa97880dd132b1cdff459be4798f8f360d7df59b13e78026a9d74a95d63df0db", + "inference_seconds": 481.491509179119 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/zero_mass.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/zero_mass.py new file mode 100644 index 0000000000000000000000000000000000000000..7e9c7067950c67da130e2c2538ffb42f34537402 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S065/zero_mass.py @@ -0,0 +1,12 @@ +"""Fixed zero-mass projection from the supplied history only.""" +import numpy as np + +def project(ctx,q,threshold=.4): + finite=np.isfinite(ctx);n=finite.sum(-1).clip(min=1) + x=np.where(finite,ctx,0.) + mean=x.sum(-1)/n + scale=np.sqrt((np.where(finite,ctx-mean[...,None],0.)**2).sum(-1)/n) + zero=((ctx==0)&finite).sum(-1) + active=((ctx>=0)|~finite).all(-1)&(zero>=4)&(zero/n>=.1) + cutoff=np.where(active,threshold*scale,0.) + return np.where((q>=0)&(q=0)|~np.isfinite(ctx)).all(-1) + for i in range(b): + x=ctx[i,-512:].astype(np.float64) + if len(x)<8 or not np.isfinite(x[-1]):continue + diff=np.diff(x) + if np.isfinite(diff).sum()<8 or not np.isfinite(diff[-8:]).any():continue + ratio=np.nanmean(diff*diff)/(np.nanvar(x)+1e-12) + weight=float(np.clip(1-ratio/.5,0,.95)) + bias[i]=weight*(x[-1]+np.nanmedian(diff[-8:])-quant[i,4,0]) + out=quant+bias[:,None,None]*np.exp(-np.arange(h)/tau)[None,None,:] + out=np.where(positive[:,None,None],np.maximum(0,out),out) + return out.astype(np.float32) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model0.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model0.py new file mode 100644 index 0000000000000000000000000000000000000000..0fb76d7fe91edd7ea32a5e4cf8ea092b570edcfe --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model0.py @@ -0,0 +1,279 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras, dispersion, width_deltas = [], [], [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + variance4 = (((values[:4] - mean4).square() * seen[:4]).sum(0) / (n4 - 1).clamp(min=1)) + variance16 = (((values - mean16).square() * seen).sum(0) / (n16 - 1).clamp(min=1)) + width_deltas.append(torch.where(active, variance16.sqrt().log1p() - math.log(2.), 0.)) + dispersion.extend([torch.where(active, variance4.sqrt().log1p(), 0.), + torch.where(active, variance16.sqrt().log1p(), 0.)]) + return torch.stack(deltas, -1), torch.stack(extras, -1), torch.stack(dispersion, -1), torch.stack(width_deltas, -1) + + + +def seasonal_width_multiplier(raw, delta): + return ((raw.float().tanh() * delta).sum(-1).clamp(-math.log(4.), math.log(4.))).exp() + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,long_seasonal_features=True,seasonal_dispersion_features=True,seasonal_width_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,long_seasonal_features=long_seasonal_features,seasonal_dispersion_features=seasonal_dispersion_features,seasonal_width_features=seasonal_width_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + self.long_query=nn.Linear(patch*4,d,bias=False) if long_seasonal_features else None + self.long_head=nn.Linear(d,patch*2) if long_seasonal_features else None + if long_seasonal_features: + nn.init.zeros_(self.long_query.weight) + nn.init.zeros_(self.long_head.weight);nn.init.zeros_(self.long_head.bias) + assert long_seasonal_features or not seasonal_dispersion_features + self.dispersion_query=nn.Linear(patch*4,d,bias=False) if seasonal_dispersion_features else None + if self.dispersion_query is not None:nn.init.zeros_(self.dispersion_query.weight) + assert seasonal_dispersion_features or not seasonal_width_features + self.width_head=nn.Linear(d,patch*2) if seasonal_width_features else None + if self.width_head is not None: + nn.init.zeros_(self.width_head.weight);nn.init.zeros_(self.width_head.bias) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + if self.long_query is not None:long_delta,long_extra,dispersion_extra,width_delta=centered_seasonal_difference(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + hidden=self.norm(q) + out=self.head(hidden).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + if self.long_head is not None: + gates=self.long_head(hidden).view(b,h,2).float().tanh() + median=median+(gates*long_delta).sum(-1) + widths=F.softplus(out[:,:,10:]).clamp(max=20) + if self.width_head is not None: + multiplier=seasonal_width_multiplier(self.width_head(hidden).view(b,h,2),width_delta) + widths=widths*multiplier[:,:,None] + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model1.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model1.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model1.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model2.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model2.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model2.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model3.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model3.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model3.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..46e7dccb7e886330d9ef2899fde4fa937a04dc7d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/model_manifest.json @@ -0,0 +1,1557 @@ +{ + "name": "direct-seasonal-four-member-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 256643928, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 307", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/AR/intermittent/changepoint generator at weekly periods52,1, replacing a Bernoulli1/11 share of the original synthetic rows with unchanged total synthetic fraction; independent seed 1000200", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 307", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,503,577,661", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 307", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300310", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404", + "synthetic:own stationary Gaussian residuals generated by FFT, equal Matern0.5/1.5/2.5 and RBF spectral families, length scale log-uniform1to10000, theoretical unit marginal variance, FFT size next power of two at least4times window; replacing half of original synthetic residuals with all other generator components unchanged; independent seed 1100200" + ], + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "82d50d0b2f7abfb963562f5f7966644b05612a49725f066392c022ccd6ba18ca", + "parameters": 36899168, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + }, + { + "weights": "member2.pt", + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "parameters": 36601928, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "model_code": "model2.py" + }, + { + "weights": "member3.pt", + "weights_sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "parameters": 146477344, + "config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model3.py" + } + ], + "checkpoint_sha256": "dfc20235aeb4b9fc799001d69f5be390d9892448dbbf51fc2abb8ca0be453bf7", + "checkpoint_digest_method": "SHA-256 of config.json, including ordered member weight hashes", + "training_lineage": [ + { + "checkpoint": "seasonal_width_transfer6k.pt", + "sha256": "82d50d0b2f7abfb963562f5f7966644b05612a49725f066392c022ccd6ba18ca", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "conversion": { + "method": "matched direct-width-head training delta, separately zero-extending base and control", + "formula": "zero_extend(E117first)+E129-zero_extend(E119)", + "coefficient": 1.0, + "base_zero_parameters": [ + "dispersion_query.weight", + "width_head.bias", + "width_head.weight" + ], + "control_zero_parameters": [ + "width_head.bias", + "width_head.weight" + ], + "dispersion_query": "candidate-minus-control only; no E128 correction", + "parent_hashes": { + "/workspace/research/long_seasonal_transfer12k.pt": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "/workspace/research/runs/seasonal_width/ema006000.pt": "4565c9b6447aab0d457738b65543c5cbee2a90f79e4a87dd9afa7f567aaf685a", + "/workspace/research/runs/seasonal_dispersion/ema006000.pt": "6b640ad1ce200544da2d530578e59eb353f8b9dabc5cc98473403cfe7383c49f" + }, + "base_extension_forward_bitwise_equal": true, + "finite_ordered_fixture": true, + "check_seed": 769, + "seconds": 2.319647100986913, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "long_seasonal_transfer12k.pt", + "runs/seasonal_width/ema006000.pt", + "runs/seasonal_dispersion/ema006000.pt" + ] + }, + { + "checkpoint": "long_seasonal_transfer12k.pt", + "sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "matched training delta after zero extension of new seasonal query/head parameters", + "formula": "extend_zero(base) + candidate - extend_zero(control)", + "coefficient": 1.0, + "new_parameters_from_candidate": [ + "long_head.bias", + "long_head.weight", + "long_query.weight" + ], + "parent_hashes": { + "/workspace/research/spectral_add_delta6k.pt": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "/workspace/research/runs/long_seasonal/ema012000.pt": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "/workspace/research/runs/overflow_control/ema012000.pt": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819" + }, + "base_extension_forward_bitwise_equal": true, + "check_seed": 571, + "seconds": 2.5279976530000567, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "spectral_add_delta6k.pt", + "runs/long_seasonal/ema012000.pt", + "runs/overflow_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/seasonal_width/ema006000.pt", + "sha256": "4565c9b6447aab0d457738b65543c5cbee2a90f79e4a87dd9afa7f567aaf685a", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "compile_teacher": false, + "visibility_curriculum": false + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "parents": [ + "seasonal_width_initial.pt", + "seasonal_dispersion_initial.pt" + ] + }, + { + "checkpoint": "runs/seasonal_dispersion/ema006000.pt", + "sha256": "6b640ad1ce200544da2d530578e59eb353f8b9dabc5cc98473403cfe7383c49f", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true + }, + "parents": [ + "seasonal_dispersion_initial.pt", + "long_seasonal_initial.pt" + ] + }, + { + "checkpoint": "spectral_add_delta6k.pt", + "sha256": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/weekly_slow_ar_delta6k.pt": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "/workspace/research/runs/spectral_synth/ema006000.pt": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 1.4204325219616294 + }, + "parents": [ + "weekly_slow_ar_delta6k.pt", + "runs/spectral_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/long_seasonal/ema012000.pt", + "sha256": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "parents": [ + "long_seasonal_initial.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema012000.pt", + "sha256": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "seasonal_width_initial.pt", + "sha256": "94ba155b90c6b510bccf92358cc225afe8f317285a19637ab5ca68072bbb83d1", + "step": 0, + "seed": 661, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "conversion": { + "method": "zero-initialized direct seasonal width head", + "parent_sha256": "5f07cac4fe7de3e878a01cb90384e79905fdb3156122b568e82c5923526aca3c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "seasonal_dispersion_initial.pt" + ] + }, + { + "checkpoint": "seasonal_dispersion_initial.pt", + "sha256": "5f07cac4fe7de3e878a01cb90384e79905fdb3156122b568e82c5923526aca3c", + "step": 0, + "seed": 577, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true + }, + "conversion": { + "method": "zero-initialized phase-specific cycle-centered standard-deviation query", + "parent_sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "initial_function_bitwise_equal": true + }, + "parents": [ + "long_seasonal_initial.pt" + ] + }, + { + "checkpoint": "long_seasonal_initial.pt", + "sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "step": 0, + "seed": 503, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "zero-initialized sixteen-cycle centered seasonal query/head additions", + "parent_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "weekly_slow_ar_delta6k.pt", + "sha256": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema006000.pt": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 2.0751679679378867 + }, + "parents": [ + "postloss_slow_ar_delta6k.pt", + "runs/weekly_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/spectral_synth/ema006000.pt", + "sha256": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "spectral_synthetic_seed": 1100200, + "spectral_replacement_probability": 0.5, + "spectral_length_scale": [ + 1, + 10000 + ], + "spectral_families": [ + "Matern0.5", + "Matern1.5", + "Matern2.5", + "RBF" + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt", + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema006000.pt", + "sha256": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/weekly_synth/ema006000.pt", + "sha256": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "weekly_synthetic_seed": 1000200, + "weekly_replacement_probability": 0.09090909090909091, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/random_capacity_1024/ema048000.pt", + "sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "step": 48000, + "seed": 307, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 48, + "lr": 0.0002, + "steps": 96000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": true, + "synthetic_ar_time_constants": [ + 1, + 10000 + ], + "requested_horizon_seed": 300310, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "random_capacity_1024_initial.pt" + ] + }, + { + "checkpoint": "random_capacity_1024_initial.pt", + "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", + "step": 0, + "seed": 307, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "initialization": "random initialization in this workspace" + } + ], + "ensemble_weights": [ + 0.25, + 0.25, + 0.25, + 0.25 + ], + "every_member_forecasts_every_instance": true, + "member_history_caps": [ + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + } + ], + "postprocessing_order": "each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4, finite-value replacement; then equal quantile average", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "model2.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "model3.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "model0.py": "0d9557eca352e3c493f47c310355aa576da2e75c8f7cb5b69786c3d162644f38", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "predict.py": "15b86dbaa19128df1105b6dd4243f2aa1321aff3fc45685a0a9811d8862d7add", + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "model1.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e" + }, + "notes": "All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation." +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..818ba6ab67470c891c5f1eb3291b85bb39825c09 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/predict.py @@ -0,0 +1,72 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import importlib.util +from seasonal import apply_gate +from continuity import apply_continuity +from zero_mass import project +import ts_io + +def load_model(checkpoint,device='cuda'): + from types import SimpleNamespace + path=Path(checkpoint);descriptor=json.loads(path.read_text());members=[] + for entry in descriptor['members']: + ck=torch.load(path.parent/entry['weights'],map_location='cpu',weights_only=False) + spec=importlib.util.spec_from_file_location('member_model_'+str(len(members)),path.parent/entry['model_code']) + module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) + model=module.DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval();members.append(model) + assert len(members)==4 + return SimpleNamespace(models=members,max_context=max(m.max_context for m in members)) + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + forecasts=[] + for member in model.models: + member_ctx=ctx[:,-member.max_context:] + member_x=x[:,-member.max_context:] + rule_context=getattr(member,'rule_context',member.max_context) + rule_ctx=member_ctx[:,-rule_context:] + rule_x=member_x[:,-rule_context:] + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16): + qq,mu,scale=member(torch.cat((member_x,-member_x),0),p.repeat(2,1),h) + qq=qq*scale[:,:,None]+mu[:,:,None] + qq=(qq[:len(ids)]-qq[len(ids):].flip(-1))*.5 + recent=rule_x[:,-4096:] + positive=((recent>=0)|~torch.isfinite(recent)).all(-1) + qq=torch.where(positive[:,None,None],qq.clamp(min=0),qq) + q=qq.transpose(1,2).float().cpu().numpy() + q=apply_gate(rule_ctx[:,-4096:],p.cpu().numpy(),q) + q=project(rule_ctx,apply_continuity(rule_ctx,q)) + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + forecasts.append(q) + q=(forecasts[0]+forecasts[1]+forecasts[2]+forecasts[3])/4 + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'config.json'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..24cfd5c33553684917c5c71c6d36a9b9bb588ba2 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/model_manifest.json @@ -0,0 +1,1481 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36899168, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/AR/intermittent/changepoint generator at weekly periods52,1, replacing a Bernoulli1/11 share of the original synthetic rows with unchanged total synthetic fraction; independent seed 1000200", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,503,577,661", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own stationary Gaussian residuals generated by FFT, equal Matern0.5/1.5/2.5 and RBF spectral families, length scale log-uniform1to10000, theoretical unit marginal variance, FFT size next power of two at least4times window; replacing half of original synthetic residuals with all other generator components unchanged; independent seed 1100200" + ], + "weights_sha256": "82d50d0b2f7abfb963562f5f7966644b05612a49725f066392c022ccd6ba18ca", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "training_lineage": [ + { + "checkpoint": "seasonal_width_transfer6k.pt", + "sha256": "82d50d0b2f7abfb963562f5f7966644b05612a49725f066392c022ccd6ba18ca", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "conversion": { + "method": "matched direct-width-head training delta, separately zero-extending base and control", + "formula": "zero_extend(E117first)+E129-zero_extend(E119)", + "coefficient": 1.0, + "base_zero_parameters": [ + "dispersion_query.weight", + "width_head.bias", + "width_head.weight" + ], + "control_zero_parameters": [ + "width_head.bias", + "width_head.weight" + ], + "dispersion_query": "candidate-minus-control only; no E128 correction", + "parent_hashes": { + "/workspace/research/long_seasonal_transfer12k.pt": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "/workspace/research/runs/seasonal_width/ema006000.pt": "4565c9b6447aab0d457738b65543c5cbee2a90f79e4a87dd9afa7f567aaf685a", + "/workspace/research/runs/seasonal_dispersion/ema006000.pt": "6b640ad1ce200544da2d530578e59eb353f8b9dabc5cc98473403cfe7383c49f" + }, + "base_extension_forward_bitwise_equal": true, + "finite_ordered_fixture": true, + "check_seed": 769, + "seconds": 2.319647100986913, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "long_seasonal_transfer12k.pt", + "runs/seasonal_width/ema006000.pt", + "runs/seasonal_dispersion/ema006000.pt" + ] + }, + { + "checkpoint": "long_seasonal_transfer12k.pt", + "sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "matched training delta after zero extension of new seasonal query/head parameters", + "formula": "extend_zero(base) + candidate - extend_zero(control)", + "coefficient": 1.0, + "new_parameters_from_candidate": [ + "long_head.bias", + "long_head.weight", + "long_query.weight" + ], + "parent_hashes": { + "/workspace/research/spectral_add_delta6k.pt": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "/workspace/research/runs/long_seasonal/ema012000.pt": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "/workspace/research/runs/overflow_control/ema012000.pt": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819" + }, + "base_extension_forward_bitwise_equal": true, + "check_seed": 571, + "seconds": 2.5279976530000567, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "spectral_add_delta6k.pt", + "runs/long_seasonal/ema012000.pt", + "runs/overflow_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/seasonal_width/ema006000.pt", + "sha256": "4565c9b6447aab0d457738b65543c5cbee2a90f79e4a87dd9afa7f567aaf685a", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "compile_teacher": false, + "visibility_curriculum": false + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "parents": [ + "seasonal_width_initial.pt", + "seasonal_dispersion_initial.pt" + ] + }, + { + "checkpoint": "runs/seasonal_dispersion/ema006000.pt", + "sha256": "6b640ad1ce200544da2d530578e59eb353f8b9dabc5cc98473403cfe7383c49f", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true + }, + "parents": [ + "seasonal_dispersion_initial.pt", + "long_seasonal_initial.pt" + ] + }, + { + "checkpoint": "spectral_add_delta6k.pt", + "sha256": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/weekly_slow_ar_delta6k.pt": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "/workspace/research/runs/spectral_synth/ema006000.pt": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 1.4204325219616294 + }, + "parents": [ + "weekly_slow_ar_delta6k.pt", + "runs/spectral_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/long_seasonal/ema012000.pt", + "sha256": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "parents": [ + "long_seasonal_initial.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema012000.pt", + "sha256": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "seasonal_width_initial.pt", + "sha256": "94ba155b90c6b510bccf92358cc225afe8f317285a19637ab5ca68072bbb83d1", + "step": 0, + "seed": 661, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "conversion": { + "method": "zero-initialized direct seasonal width head", + "parent_sha256": "5f07cac4fe7de3e878a01cb90384e79905fdb3156122b568e82c5923526aca3c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "seasonal_dispersion_initial.pt" + ] + }, + { + "checkpoint": "seasonal_dispersion_initial.pt", + "sha256": "5f07cac4fe7de3e878a01cb90384e79905fdb3156122b568e82c5923526aca3c", + "step": 0, + "seed": 577, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true + }, + "conversion": { + "method": "zero-initialized phase-specific cycle-centered standard-deviation query", + "parent_sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "initial_function_bitwise_equal": true + }, + "parents": [ + "long_seasonal_initial.pt" + ] + }, + { + "checkpoint": "long_seasonal_initial.pt", + "sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "step": 0, + "seed": 503, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "zero-initialized sixteen-cycle centered seasonal query/head additions", + "parent_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "weekly_slow_ar_delta6k.pt", + "sha256": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema006000.pt": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 2.0751679679378867 + }, + "parents": [ + "postloss_slow_ar_delta6k.pt", + "runs/weekly_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/spectral_synth/ema006000.pt", + "sha256": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "spectral_synthetic_seed": 1100200, + "spectral_replacement_probability": 0.5, + "spectral_length_scale": [ + 1, + 10000 + ], + "spectral_families": [ + "Matern0.5", + "Matern1.5", + "Matern2.5", + "RBF" + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt", + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema006000.pt", + "sha256": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/weekly_synth/ema006000.pt", + "sha256": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "weekly_synthetic_seed": 1000200, + "weekly_replacement_probability": 0.09090909090909091, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "model.py": "0d9557eca352e3c493f47c310355aa576da2e75c8f7cb5b69786c3d162644f38", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37" + }, + "checkpoint_composition": { + "method": "matched direct-width-head training delta, separately zero-extending base and control", + "formula": "zero_extend(E117first)+E129-zero_extend(E119)", + "coefficient": 1.0, + "base_zero_parameters": [ + "dispersion_query.weight", + "width_head.bias", + "width_head.weight" + ], + "control_zero_parameters": [ + "width_head.bias", + "width_head.weight" + ], + "dispersion_query": "candidate-minus-control only; no E128 correction", + "parent_hashes": { + "/workspace/research/long_seasonal_transfer12k.pt": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "/workspace/research/runs/seasonal_width/ema006000.pt": "4565c9b6447aab0d457738b65543c5cbee2a90f79e4a87dd9afa7f567aaf685a", + "/workspace/research/runs/seasonal_dispersion/ema006000.pt": "6b640ad1ce200544da2d530578e59eb353f8b9dabc5cc98473403cfe7383c49f" + }, + "base_extension_forward_bitwise_equal": true, + "finite_ordered_fixture": true, + "check_seed": 769, + "seconds": 2.319647100986913, + "optimizer_updates": 0, + "validation_data_read": false + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 32768, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "seasonal_dispersion_features": { + "features": "log1p unbiased standard deviation across matching phases of four and sixteen individually centered cycles, for each of two periods", + "active_rule": "period>=2,at least2recent and8total matching-phase observations", + "query_projection_parameters": 32768, + "initialization": "zero projection preserves the own parent model exactly", + "trainable_scope": "all parameters", + "fixed_output_rescaling": false + }, + "seasonal_width_features": { + "head_parameters": 16416, + "delta": "active*(log1p(cycle-centered matching-phase standard deviation over16cycles)-log2)", + "multiplier": "exp(clamp(sum(tanh(learned_gate)*delta),-log4,log4))", + "bounds": [ + 0.25, + 4.0 + ], + "active_rule": "period>=2,n4>=2,n16>=8", + "all_eight_width_increments_share_multiplier": true, + "zero_initialization_preserves_parent": true, + "trainable_scope": "all parameters" + }, + "long_seasonal_features": { + "cycles": [ + 4, + 16 + ], + "each_cycle_centered": true, + "minimum_total_cycles": 8, + "minimum_recent_cycles": 2, + "query_features": [ + "centered16-minus4 phase mean", + "observed16-cycle fraction" + ], + "median_shift": "sum of two learned tanh gates times template differences", + "same_shift_all_quantiles": true, + "maximum_context": 4096, + "parameters_fixed_at_inference": true + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "confidence_query/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "confidence_query/model.py": "b4f11ba2018e2b50879cdc33acf0138301548971508b58035a7c96a29aaa6f2d", + "confidence_query/train.py": "fc8a7555a5a6b0a6f91e80ac8cc9cbbfddaa2b26468c57f49dfb17671b22ce93", + "direct_large/data.py": "6e6db217936f8dd79380d2ceff3eaa8598a44f1b60b17acae7bfde2363116847", + "direct_large/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "direct_large/model.py": "146d93a3f95b13bda8b1b437bc36621b91356cf946e94f62999f89e7fb348071", + "direct_large/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "direct_large/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "direct_large/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "direct_large/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "direct_large/train.py": "b9ad6b2adddeaf12961b529d6535dd33f6d044a31979b5c9e49dceafbadd3ac0", + "direct_large/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "direct_large/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "full_paired/check.py": "90ac1c78846439d51ab8acd62a19bd536c7c394bd02e94f6d5ff17c0af8bd116", + "full_paired/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "full_paired/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "horizon_jitter/data.py": "5044cf648323420095ed6058d29f837c07ff5559b606df8b00cc8d1e95c8b58e", + "horizon_jitter/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "horizon_jitter/train.py": "4e9cbca1293f18f7eea2c72dba127815c0934a13c86e8f6cc881a749676d41a6", + "large_corpus/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "large_corpus/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "large_corpus/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "large_sign/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "large_sign/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "large_sign/model.py": "3fff6445a1982a1b3c92f06a9b5f1bb627dda6a291b0b2364bcfb1a6457830d7", + "large_sign/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "large_sign/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "large_sign/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "large_sign/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "large_sign/train.py": "a597f40ab87cce04e96dc654d12e56cdf40ffd87f00034d8bc4d56dff4eb7c68", + "large_sign/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "large_sign/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "long_memory_synth/data.py": "2955ec414de97f7ec91c8863873b7ae50ebe8f0ccb7fe48c41599e69da88ec34", + "long_memory_synth/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "long_memory_synth/train.py": "75918ac02d30ad8289632bc8a3ce1386c949fd670522799af59536d4cab0b9e9", + "long_seasonal/check.py": "e55fe780892204889e210d1591ae3f0b964d72ec1916b9b5e768b938aba28fc1", + "long_seasonal/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "long_seasonal/launch.py": "68c56b8abde125eb8de866807f8deb946c30e4c52866bc0cafcab82198b58def", + "long_seasonal/long_features.py": "270d84ff1208085f65856e8c489998e6248af5c5ea1c3c47b5161f7d6b621b13", + "long_seasonal/model.py": "3eaa4aed0a1c62b80d94be6c3084b10a594e9fce17444eac17ca3f1b0b5c549e", + "long_seasonal/transfer.py": "301df5a793988edbe50b3384c5777d8679161142943578bc7723a552ed4f3d04", + "overflow_control/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "overflow_control/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "partial_delta/merge.py": "63984a0f46f7d48817037f5bf5a1c9319e45a9b1924cde62c667ac49ce47532e", + "partial_targets/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "partial_targets/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "partial_targets/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "patch16/convert.py": "11e1d30100ab25311020ac1f4ab8227ec66156836df5de613300867977091c45", + "patch16/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "patch16/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "patch16/model.py": "8031c597b354eb2cf464140bee40c3ec8dff86c775b5c55c5ce910302b443582", + "patch16/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "patch16/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "patch16/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "patch16/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "patch16/train.py": "3156710f76111a31447cbe638ee27fe2811d060917aa083aab0b5134d98accf8", + "patch16/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "patch16/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "postloss/check_numerical_fix.py": "527dffcd94ec1a02b214dd300261d189b06c386f0b8c4d4df3320098f5fc0e68", + "postloss/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "postloss/diagnose_nonfinite.py": "82d10c5751ea1d21ecd36cd5eb54c00aabcaf78a8562b259551d028d452be47b", + "postloss/gpu_check.py": "c0a7e23d9f74cdab4fa04e1a4b9f89c64bb58f5e24228aa5e0f2cf554fef2d1f", + "postloss/launch_completion.py": "ef584b22259e3bc741b16ef876a6120bfcee08e2b9237a7990ed560a0dbf77ae", + "postloss/model.py": "d4b76fb1a63789e091b114dd947abe30be3e47c2e2e9d41cecb3e3353af86ac5", + "postloss/model_before_numerical_fix.py": "1ad846ac7adc16298b9643a79f4ee1b94f4db82fa716c6db77a2fcbb2160c261", + "postloss/restart.py": "5baa9a0947a0d30f7773113c05bd1f53b8ed1817aeaa2365078b06df9ce2fbca", + "postloss/torch_post.py": "0762fc5d330a4039798a81788e4adb8bfe206aba2aa29a1b53ecad0bd3bff217", + "recency_features/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "recency_features/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "recency_features/train.py": "a654b9a27b6c27141e1d4e517ab28fcae3f2c23d061742fa2f6c01e3d23c8a00", + "recovery/brief.py": "04f6b652733e1d45490f996bec5de2fd2b1793566f4ba0a846b868e0d1cb8c6f", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/launch_matched_cutoffs.py": "7d5b9b569df284c143bb4fe50033ed6be21ff1b54cb4405723b2ebcdefe6e562", + "recovery/matched_report.py": "82696104e2e7da9cee48611e42aebc0f5c4916f2273fdeb9a3158c4dd3700b04", + "recovery/median_error_structure.py": "f6e126496eba2e0aa1fce1efeac7e926f0fbc28005ab81c0f1c9cf73ecd93782", + "recovery/pack_composition.py": "66c198e44b55fc4dce50dec505a0127eb9d97390e04d0f97c271ace11ad0f49f", + "recovery/quantile_coverage.py": "7a4057d1aa38c5e7de0ca601db0003a8fd3a9a2e6123b2fdb81fa8aedbc34787", + "recovery/reclaim_completed_cache.py": "d0a23e5a73b362f03a3be0d9fcc8dd5292d17da0489484a9c52af84bd05d9638", + "recovery/refresh_journal.py": "6ccbbbf7494f3b310f2e4d47e572487b62494ae52ef6598de93ce8ae28c8a7a5", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/seasonal_history_support.py": "fe2da1a695715c3add9472f0bfebc946783b179b1a8415f85565a937885f7076", + "recovery/snapshot.py": "05d286585c4cd2bb495644bee7dbc3f09a8756c906caa13c55910156fa82f653", + "recovery/synthetic_window_audit.py": "912e38fd094f35fb528a77388d8076600207b369bb3b2c2133a24c3c485019a1", + "recovery/train.py": "7b980656e2962268d7995bafe9398b60239f4075f1d91a62c7173f7b2cd3f29c", + "recovery/watch_matched_cutoffs.py": "177dbe6d8b5186dd3ce1c4b261a55cd5cfb44f6ed2922ef64b489deb2117fa6b", + "seasonal_dispersion/check.py": "aec0a137044f8da807fa7f4212f196dd99c7d823f0c93d526592f3659481721f", + "seasonal_dispersion/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "seasonal_dispersion/durability.py": "5e249e02a5a2b0b61f3c78693f273b851d98db3e964e004dcd19c920679c6a1f", + "seasonal_dispersion/launch.py": "5befe970b37e12829e8cc97f201568c95a2d06311a2730e6599b4372cc9a55b1", + "seasonal_dispersion/model.py": "35d591ca15c0875d6562a45618fd7483796eaec8d4c8306408e716c72693c4b3", + "seasonal_width/check.py": "6fd58bfeca5cb16aa70bfa66a93ec0ede4d43d554e976368c143afe986377c1e", + "seasonal_width/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "seasonal_width/launch.py": "7473cd5ee8b9094439a7375c58f4069ece047e0c7c9c77064856355fc09be9b3", + "seasonal_width/model.py": "0d9557eca352e3c493f47c310355aa576da2e75c8f7cb5b69786c3d162644f38", + "seasonal_width_transfer/assemble.py": "7313ef4be82840bb0e89b989375a348e633ac24f5a63fb1e15e9730492acd2eb", + "seasonal_width_transfer/check_runtime.py": "1a5e7113c3ab3452dce6eee5f26d9283e48da825c15e2c595be43756bde0b443", + "seasonal_width_transfer/merge.py": "a67ab547f82b3f86935c47ef82c6f196e3cd80af3b3860247125dc742076cdd3", + "seasonal_width_transfer/run.py": "0bb371e4e7585fd36d2afc499412d1cf166194395c56519d230ba7d2d1298ee3", + "seasonal_width_transfer/validate.py": "6d13c787616e012d47888c9821779e00c0b8c2aa554b4e4e98a04f3dbeb95dd9", + "spectral_synth/check.py": "c308c87af0a6756fafefa460751cc370ed44ee98f3f52364b1ed6879a3c4e110", + "spectral_synth/data.py": "1780475ef9573c9731cf67f46c1a339ab2fa466c28bbbee5948322ae3f33ca29", + "spectral_synth/launch.py": "5888c115ae4b38b307ac1ac1bb4a9c200a1aa35850819dab55eaeb47946c38e2", + "spectral_synth/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "spectral_synth/spectral.py": "347aa6d352df72ff18ef35a267b8e0479546263b26174d5256d4e9903cce5f71", + "spectral_transfer/run.py": "33fb544faca0633cd96440e2e4fa3c0e38c8e8cde8a215bfaf8357ed224bfcd8", + "weekly_synth/check.py": "a122b553d9ddc01a506a36713a0df478b03d7fe0b3f9ee1fa34c22c3e982adbf", + "weekly_synth/data.py": "774d0d5216fa263db9d809289dd3daa877f0bcea6ed44a628dd9f8e53829815f", + "weekly_synth/launch.py": "b28347982ecf6d87b45970824d0961027297296e8a6d4372414caeae28427e9d", + "weekly_synth/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/direct_large/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fda928e16338305fd9912f7bc08cacff58bd8aa4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/check.py @@ -0,0 +1,34 @@ +import importlib.util,json,time +from pathlib import Path +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +r=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197);start=time.monotonic() +ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +spec=importlib.util.spec_from_file_location('parent_model',r/'confidence_inference/model.py') +old=importlib.util.module_from_spec(spec);spec.loader.exec_module(old) +parent=old.DirectForecaster(**ck['config']);parent.load_state_dict(ck['model']) +m=DirectForecaster(**ck['config']);m.load_state_dict(ck['model']) +x=torch.randn(4,512);x[0,:50]=float('nan');p=torch.tensor([[24,168]]*4);y=torch.randn(4,128);y[0,32:]=float('nan') +with torch.inference_mode(): + assert all(torch.equal(a,b) for a,b in zip(m(x,p,48),parent(x,p,48))) + short=m(x,p,32)[0];long=m(x,p,128,forecast_lengths=torch.full((4,),32))[0][:,:32] + assert torch.allclose(short,long,atol=3e-6,rtol=1e-6),(short-long).abs().max() + paired=float(loss_fn(m,x,y,p,paired=True));reverse=float(loss_fn(m,-x,-y,p,paired=True)) + assert abs(paired-reverse)<1e-7,(paired,reverse) +a=Sampler(r/'packed_sample',197);b=Sampler(r/'packed_sample',197) +for c,h in [(512,32),(4096,1024)]: + assert all(np.array_equal(v,w,equal_nan=True) for v,w in zip(a.sample(16,c,h),b.sample(16,c,h))) +assert a.rng.bit_generator.state==b.rng.bit_generator.state and a.horizon_rng.bit_generator.state==b.horizon_rng.bit_generator.state +cpu=time.monotonic()-start;del parent,ck,a,b +m=m.cuda();ema={k:v.detach().clone() for k,v in m.state_dict().items()} +moments=[torch.zeros_like(v) for v in m.parameters() for _ in range(2)] +torch.backends.cuda.matmul.allow_tf32=True;torch.cuda.reset_peak_memory_stats();start=time.monotonic() +x=torch.randn(64,4096,device='cuda');y=torch.randn(64,1024,device='cuda');p=torch.tensor([[24,168]]*64,device='cuda') +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +z={'cpu_seconds':cpu,'initial_forecast_bitwise_parent':True,'unused_future_tokens_do_not_change_requested_prefix':True,'paired_loss_sign_symmetric':True,'matched_sampler_main_and_horizon_rng':True,'gpu_fixture_seconds':time.monotonic()-start,'allocated_mib':torch.cuda.max_memory_allocated()/2**20,'reserved_mib':torch.cuda.max_memory_reserved()/2**20,'optimizer_updates':0} +(r/'full_paired_checks.json').write_text(json.dumps(z,indent=2));print(json.dumps(z),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/large_sign/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..95410ba700e638fc2e1375b14dece4df57c10110 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=np.exp(-10**(-r.uniform(0,4)));noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/train.py new file mode 100644 index 0000000000000000000000000000000000000000..61de733eea03837247278d9010c2ed8b955d7359 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_memory_synth/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + a.synthetic_ar_time_constants=[1,10000] + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/check.py new file mode 100644 index 0000000000000000000000000000000000000000..beba62576fae73576eef907b81c674e96622670d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/check.py @@ -0,0 +1,145 @@ +"""Check exact initialization, fixed feature arithmetic and allowed-data gradients.""" +import argparse +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path + +import numpy as np +import torch + +R = Path('/workspace/research') +sys.path.insert(0, str(R / 'long_seasonal')) +from model import DirectForecaster, centered_seasonal_difference, loss_fn +from data import Sampler + +ap = argparse.ArgumentParser() +ap.add_argument('--gpu', action='store_true') +a = ap.parse_args() +torch.set_num_threads(2) +torch.manual_seed(503) +started = time.monotonic() +spec = importlib.util.spec_from_file_location('long_control_model', R / 'overflow_control/model.py') +control_code = importlib.util.module_from_spec(spec) +spec.loader.exec_module(control_code) +parent_path = R / 'horizon_delta12k.pt' +parent = torch.load(parent_path, map_location='cpu', weights_only=False) +config = dict(parent['config'], long_seasonal_features=True) +candidate = DirectForecaster(**config) +missing, unexpected = candidate.load_state_dict(parent['model'], strict=False) +assert set(missing) == {'long_query.weight', 'long_head.weight', 'long_head.bias'} +assert not unexpected +assert all(torch.count_nonzero(candidate.state_dict()[key]) == 0 for key in missing) +control = control_code.DirectForecaster(**parent['config']) +control.load_state_dict(parent['model']) +assert all(torch.equal(value, candidate.state_dict()[key]) for key, value in parent['model'].items()) + +if a.gpu: + import fcntl + lock = open(R / '.evaluation.lock', 'a') + fcntl.flock(lock, fcntl.LOCK_EX) + device = 'cuda' + torch.backends.cuda.matmul.allow_tf32 = False + candidate = candidate.cuda() + control = control.cuda() + rng = np.random.default_rng(509) + x = torch.tensor(rng.normal(size=(8, 512)).astype(np.float32), device=device) + x[0, :23] = float('nan') + x[1] = 0 + p = torch.tensor([[24,168],[7,365],[12,1],[52,1],[4,1],[1,1],[96,672],[2,14]], device=device) + with torch.inference_mode(), torch.autocast('cuda', dtype=torch.bfloat16): + expected = control(x, p, 128) + actual = candidate(x, p, 128) + assert all(torch.equal(v, w) for v, w in zip(expected, actual)) + del control, expected, actual, x, p + torch.cuda.empty_cache() + torch.cuda.reset_peak_memory_stats() + sampler = Sampler(R / 'packed_sample', seed=509, source_weights_from=R / 'packed_sample') + arrays = sampler.sample(64, 4096, 1024) + tensors = [torch.from_numpy(v).cuda() for v in arrays] + placeholders = [torch.zeros_like(v) for v in candidate.parameters() for _ in range(3)] + with torch.autocast('cuda', dtype=torch.bfloat16): + loss = loss_fn(candidate, *tensors, paired=True) + loss.backward() + assert torch.isfinite(loss) + assert all(v.grad is None or torch.isfinite(v.grad).all() for v in candidate.parameters()) + gradients = {key: float(dict(candidate.named_parameters())[key].grad.norm()) for key in missing} + assert gradients['long_head.weight'] > 0 and gradients['long_query.weight'] > 0 + result = dict(seed=509, gpu_initial_function_bitwise_equal=True, + max_shape=[64,4096,1024], loss=float(loss.detach()), added_gradient_norms=gradients, + reserved_mib=torch.cuda.max_memory_reserved()/2**20, + allocated_mib=torch.cuda.max_memory_allocated()/2**20, + includes_ema_and_adam_placeholders=True, seconds=time.monotonic()-started, + optimizer_updates=0, validation_data_read=False) + (R / 'long_seasonal_gpu_checks.json').write_text(json.dumps(result, indent=2)) + print(json.dumps(result)) + raise SystemExit() + +rng = np.random.default_rng(503) +z = rng.normal(size=(4, 96)).astype(np.float32) +valid = rng.random(z.shape) > .12 +z[~valid] = 0 +periods = np.array([[4,7],[2,3],[12,1],[24,168]], dtype=np.int64) +delta, extra = centered_seasonal_difference(torch.from_numpy(z), torch.from_numpy(valid), + torch.from_numpy(periods), 23) +expected = np.zeros((4,23,2), np.float32) +support = np.zeros_like(expected) +for row in range(4): + for j in range(2): + period = int(periods[row,j]) + for t in range(23): + observations, recent = [], [] + for cycle in range(16): + end = max(0, 96-cycle*period) + start = max(0, 96-(cycle+1)*period) + index = 96-period+t%period-cycle*period + if index < 0 or not valid[row,index]: + continue + mean = z[row,start:end][valid[row,start:end]].mean(dtype=np.float64) + value = float(z[row,index])-mean + observations.append(value) + if cycle < 4: + recent.append(value) + if period>=2 and len(observations)>=8 and len(recent)>=2: + expected[row,t,j] = np.mean(observations)-np.mean(recent) + support[row,t,j] = len(observations)/16 +assert np.max(np.abs(delta.numpy()-expected)) < 1e-6 +assert np.array_equal(extra.numpy()[:,:,[1,3]], support) +# Adding a different constant to each complete cycle leaves centered templates unchanged. +z0 = torch.tensor(rng.normal(size=(1,64)).astype(np.float32)) +offsets = torch.tensor(rng.normal(size=(1,16,1)).astype(np.float32)) +z1 = (z0.view(1,16,4)+offsets).view(1,64) +p = torch.tensor([[4,4]]) +ones = torch.ones_like(z0,dtype=torch.bool) +v0 = centered_seasonal_difference(z0,ones,p,16)[0] +v1 = centered_seasonal_difference(z1,ones,p,16)[0] +assert torch.max(torch.abs(v0-v1)) < 1e-6 +for c,h in [(32,6),(96,23),(512,128)]: + ctx = torch.tensor(rng.normal(size=(4,c)).astype(np.float32)) + ctx[0,:c//3] = float('nan') + ctx[1] = 0 + ctx[2] = float('nan') + with torch.inference_mode(): + expected = control(ctx,torch.from_numpy(periods),h) + actual = candidate(ctx,torch.from_numpy(periods),h) + assert all(torch.equal(v,w) for v,w in zip(expected,actual)) +assert (R/'long_seasonal/data.py').read_bytes()==(R/'overflow_control/data.py').read_bytes() +out = R / 'long_seasonal_initial.pt' +assert not out.exists(), 'Do not overwrite an existing declared initial checkpoint' +checkpoint = dict(model=candidate.state_dict(), config=config, step=0, + args=dict(packed=str(R/'packed_sample'), seed=503), + parent_checkpoints=[str(parent_path)], + conversion=dict(method='zero-initialized sixteen-cycle centered seasonal query/head additions', + parent_sha256=hashlib.sha256(parent_path.read_bytes()).hexdigest(), + initial_function_bitwise_equal=True)) +torch.save(checkpoint,out) +result = dict(seed=503, independent_feature_arithmetic=True, centered_cycle_offset_invariance=True, + initial_function_bitwise_equal=True, inherited_weights_bitwise_equal=True, + sampler_byte_identical=True, added_parameters=sum(candidate.state_dict()[k].numel() for k in missing), + total_parameters=sum(v.numel() for v in candidate.parameters()), + checkpoint_sha256=hashlib.sha256(out.read_bytes()).hexdigest(), + seconds=time.monotonic()-started, optimizer_updates=0, validation_data_read=False) +(R/'long_seasonal_checks.json').write_text(json.dumps(result,indent=2)) +print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..d7fd732aae9def625f17a4d15dd2dbe3f4cd9317 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/launch.py @@ -0,0 +1,31 @@ +"""Queue the audited learned sixteen-cycle summary after nested-volume training.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + checks=json.loads((R/'long_seasonal_checks.json').read_text()) + assert checks['initial_function_bitwise_equal'] and checks['inherited_weights_bitwise_equal'] + assert checks['independent_feature_arithmetic'] and checks['sampler_byte_identical'] + gpu=json.loads((R/'long_seasonal_gpu_checks.json').read_text()) + assert gpu['gpu_initial_function_bitwise_equal'] and gpu['reserved_mib']<10000 + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'long_seasonal'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/long_seasonal'),'--initialize-from',str(R/'long_seasonal_initial.pt'), + '--steps','12000','--batch','64','--lr','.00002','--seed','197','--loss-mode','paired', + '--stop-file',str(R/'long_seasonal.stop')] + with (R/'long_seasonal_queue.log').open('w') as qlog,(R/'long_seasonal_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E107 learned sixteen-cycle summary seed197', + '--log',str(R/'long_seasonal_train.log'),'--receipt',str(R/'long_seasonal_queue.json'), + '--wait-pid','13470','--require-checkpoint',str(R/'runs/stratified_volume/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/long_seasonal'), + '--evaluator',str(R/'long_seasonal_inference/evaluate.py'),'--name','long_seasonal', + '--expected-packed',str(R/'packed_sample'),'--steps','1000,3000,6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/long_features.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/long_features.py new file mode 100644 index 0000000000000000000000000000000000000000..efc6e3ba327c6016d844148fcfcc29ac63863f23 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/long_features.py @@ -0,0 +1,37 @@ +"""Fixed within-context phase summaries; no estimated or adapted parameters.""" +import torch +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras = [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + return torch.stack(deltas, -1), torch.stack(extras, -1) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/model.py new file mode 100644 index 0000000000000000000000000000000000000000..298ee3b840cbc8b7da585ee5e47a3822d06717b0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/model.py @@ -0,0 +1,260 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras = [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + return torch.stack(deltas, -1), torch.stack(extras, -1) + + + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,long_seasonal_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,long_seasonal_features=long_seasonal_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + self.long_query=nn.Linear(patch*4,d,bias=False) if long_seasonal_features else None + self.long_head=nn.Linear(d,patch*2) if long_seasonal_features else None + if long_seasonal_features: + nn.init.zeros_(self.long_query.weight) + nn.init.zeros_(self.long_head.weight);nn.init.zeros_(self.long_head.bias) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + if self.long_query is not None:long_delta,long_extra=centered_seasonal_difference(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + hidden=self.norm(q) + out=self.head(hidden).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + if self.long_head is not None: + gates=self.long_head(hidden).view(b,h,2).float().tanh() + median=median+(gates*long_delta).sum(-1) + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/transfer.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/transfer.py new file mode 100644 index 0000000000000000000000000000000000000000..c20a4df852f5b150e634ae2c06510d01c7ea18b3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/long_seasonal/transfer.py @@ -0,0 +1,73 @@ +"""Apply one matched feature-learning difference with explicit zero-extension semantics.""" +import argparse +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path + +import numpy as np +import torch + +R = Path('/workspace/research') +parser = argparse.ArgumentParser() +for key in ['base','candidate','control','out']: + parser.add_argument('--'+key,required=True) +args = parser.parse_args() +torch.set_num_threads(2) +torch.manual_seed(571) +started = time.monotonic() +paths = [Path(args.base),Path(args.candidate),Path(args.control)] +base,candidate,control = [torch.load(p,map_location='cpu',weights_only=False) for p in paths] +extra = {'long_query.weight','long_head.weight','long_head.bias'} +assert set(base['model'])==set(control['model']) +assert set(candidate['model'])==set(base['model'])|extra +config = dict(candidate['config']) +assert config.pop('long_seasonal_features') is True +assert config==base['config']==control['config'] +sys.path.insert(0,str(R/'long_seasonal')) +from model import DirectForecaster +extended = DirectForecaster(**candidate['config']) +missing,unexpected = extended.load_state_dict(base['model'],strict=False) +assert set(missing)==extra and not unexpected +assert all(torch.count_nonzero(extended.state_dict()[k])==0 for k in extra) +spec = importlib.util.spec_from_file_location('transfer_original_model',R/'overflow_control/model.py') +code = importlib.util.module_from_spec(spec) +spec.loader.exec_module(code) +original = code.DirectForecaster(**base['config']) +original.load_state_dict(base['model']) +rng = np.random.default_rng(571) +periods = torch.tensor([[24,168],[7,365],[52,1],[1,1]]) +for c,h in [(32,6),(512,128)]: + ctx = torch.tensor(rng.normal(size=(4,c)).astype(np.float32)) + ctx[0,:c//3] = float('nan') + ctx[1] = 0 + ctx[2] = float('nan') + with torch.inference_mode(): + a = original(ctx,periods,h) + b = extended(ctx,periods,h) + assert all(torch.equal(v,w) for v,w in zip(a,b)) +weights = {k:v.clone() for k,v in extended.state_dict().items()} +for k in weights: + if k in extra: + weights[k].copy_(candidate['model'][k]) + else: + assert weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +out = Path(args.out) +assert not out.exists(),'Refuse to overwrite a declared fixed candidate' +conversion = dict(method='matched training delta after zero extension of new seasonal query/head parameters', + formula='extend_zero(base) + candidate - extend_zero(control)',coefficient=1.0, + new_parameters_from_candidate=sorted(extra), + parent_hashes={str(p):hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}, + base_extension_forward_bitwise_equal=True,check_seed=571, + seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) +checkpoint = dict(model=weights,config=candidate['config'],step=0,args={'packed':base['args']['packed']}, + parent_checkpoints=[str(p) for p in paths],conversion=conversion) +torch.save(checkpoint,out) +result = dict(conversion,checkpoint_sha256=hashlib.sha256(out.read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in weights.values())) +out.with_suffix('.json').write_text(json.dumps(result,indent=2)) +print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/overflow_control/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/overflow_control/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/overflow_control/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/overflow_control/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/overflow_control/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/overflow_control/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/patch16/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/check_numerical_fix.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/check_numerical_fix.py new file mode 100644 index 0000000000000000000000000000000000000000..0dd7f0b04a538020f59a4d4e8d6bc4884e0acd29 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/check_numerical_fix.py @@ -0,0 +1,26 @@ +"""Regression test for observed variance overflow in permitted training data.""" +import importlib.util +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster,loss_fn + +R=Path('/workspace/research');torch.set_num_threads(1);started=time.monotonic() +spec=importlib.util.spec_from_file_location('original',Path(__file__).with_name('model_before_numerical_fix.py')) +original=importlib.util.module_from_spec(spec);spec.loader.exec_module(original) +torch.manual_seed(331);normal=torch.randn(8,512);normal[0,:200]=float('nan');normal[1]=float('nan');normal[2]=0 +old=original.DirectForecaster.standardize(normal);new=DirectForecaster.standardize(normal) +assert all(torch.equal(a,b) for a,b in zip(old,new)) +f=torch.load(R/'postloss_nonfinite_fixture.pt',map_location='cpu',weights_only=False) +indices=torch.tensor([37]);ctx=f['ctx'][indices];target=f['target'][indices];periods=f['periods'][indices] +z,valid,mu,scale=DirectForecaster.standardize(ctx) +assert torch.isfinite(z).all() and torch.isfinite(mu).all() and torch.isfinite(scale).all() +ck=torch.load(R/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,ctx.cuda(),target.cuda(),periods.cuda(),paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +result={'ordinary_rows_bitwise_original':True,'observed_overflow_row_loss':float(loss.detach()), + 'all_gradients_finite':True,'optimizer_updates':0,'seconds':time.monotonic()-started} +(R/'postloss_numerical_fix_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/diagnose_nonfinite.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/diagnose_nonfinite.py new file mode 100644 index 0000000000000000000000000000000000000000..770ff91d0718cbb6b947fc91fd61697ea50cbfd6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/diagnose_nonfinite.py @@ -0,0 +1,42 @@ +"""Find nonfinite fixed-transform outputs on the unchanged allowed-corpus stream.""" +import json +from pathlib import Path +import time +import numpy as np +import torch +from model import DirectForecaster +from data import Sampler +from torch_post import apply_fixed,context_statistics + +R=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197) +torch.backends.cuda.matmul.allow_tf32=True +ck=torch.load(R/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']);m.eval() +sampler=Sampler(R/'packed_sample',seed=197,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(197);started=time.monotonic() +for step in range(1,251): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + arrays=sampler.sample(64,c,h);ctx,target,periods=[torch.from_numpy(v).cuda() for v in arrays] + with torch.no_grad(),torch.autocast('cuda',dtype=torch.bfloat16): + seen=torch.isfinite(target);pos=torch.arange(h,device=ctx.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + raw,mu,scale=m(torch.cat((ctx,-ctx),0),periods.repeat(2,1),h,forecast_lengths=lengths.repeat(2)) + q=(raw[:64]-raw[64:].flip(-1))*.5;mu=mu[:64];scale=scale[:64] + denormalized=q*scale[:,:,None]+mu[:,:,None] + post=apply_fixed(ctx,periods,denormalized) + bad=~torch.isfinite(post).all((1,2)) + if bad.any(): + stats=context_statistics(ctx,periods,h) + badids=torch.nonzero(bad)[:,0] + receipt={'step':step,'context':c,'horizon':h,'bad_rows':badids.tolist(), + 'raw_finite':bool(torch.isfinite(q).all()),'scale_finite':bool(torch.isfinite(scale).all()), + 'denormalized_finite':bool(torch.isfinite(denormalized).all()), + 'statistics_finite':[bool(torch.isfinite(v).all()) for v in stats], + 'bad_scale':scale[bad].tolist(),'bad_mu':mu[bad].tolist(), + 'bad_maximum_context':torch.nan_to_num(ctx[bad]).abs().max(-1).values.tolist(), + 'seconds':time.monotonic()-started,'optimizer_updates':0} + torch.save({'ctx':ctx.cpu(),'target':target.cpu(),'periods':periods.cpu(), + 'raw':denormalized.cpu(),'scale':scale.cpu(),'post':post.cpu(), + 'statistics':[v.cpu() for v in stats]},R/'postloss_nonfinite_fixture.pt') + (R/'postloss_nonfinite_diagnostic.json').write_text(json.dumps(receipt,indent=2));print(json.dumps(receipt));break +else:print(json.dumps({'no_nonfinite_fixed_parent_outputs_in_first_steps':250,'seconds':time.monotonic()-started})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/gpu_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/gpu_check.py new file mode 100644 index 0000000000000000000000000000000000000000..a457afa8d1dd55d2167434b70f4e1488e41e4049 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/gpu_check.py @@ -0,0 +1,24 @@ +"""Verify the new training loss at the largest scheduled bf16 shape.""" +import fcntl,json,sys,time +from pathlib import Path +import torch + +r=Path('/workspace/research');sys.path.insert(0,str(r/'postloss')) +from model import DirectForecaster,loss_fn +from data import Sampler +with open(r/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + torch.set_num_threads(1);torch.manual_seed(281);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic() + ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).cuda();model.load_state_dict(ck['model']) + x,y,p=[torch.from_numpy(a).cuda() for a in Sampler(r/'packed_sample',281).sample(64,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize() + assert torch.isfinite(loss) + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in model.parameters()) + result={'seed':281,'batch':64,'context':4096,'horizon':1024,'optimizer_updates':0, + 'loss':float(loss.detach()),'seconds':time.monotonic()-started, + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + (r/'postloss_gpu_check.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/launch_completion.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/launch_completion.py new file mode 100644 index 0000000000000000000000000000000000000000..8bdf1346b99ae846a2679a7494c9b88c1900bdce --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/launch_completion.py @@ -0,0 +1,30 @@ +"""Complete the original pruned schedule from its immutable exact training state.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + receipt=json.loads((R/'postloss_recovery003653.json').read_text()) + assert receipt['step']==3653 + assert json.loads((R/'postloss_completion_code_audit.json').read_text())['matches_original_E75_archived_training_code'] + assert (R/'postloss.stop').exists() + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'postloss'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/postloss_completion'),'--initialize-from',str(R/'horizon_delta12k.pt'), + '--resume',str(R/'postloss_recovery003653.pt'),'--steps','12000','--batch','64','--lr','.00002', + '--seed','197','--loss-mode','paired','--stop-file',str(R/'postloss_completion.stop')] + with (R/'postloss_completion_queue.log').open('w') as qlog,(R/'postloss_completion_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E98 complete original E75 schedule', + '--log',str(R/'postloss_completion_train.log'),'--receipt',str(R/'postloss_completion_queue.json'), + '--wait-pid','9274','--require-checkpoint',str(R/'runs/split_patch/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/postloss_completion'), + '--evaluator',str(R/'postloss_inference/evaluate.py'),'--name','postloss_completion', + '--steps','6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/model.py new file mode 100644 index 0000000000000000000000000000000000000000..014b585df72cc69852a8eedf302320b52fe55aad --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/model.py @@ -0,0 +1,216 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/model_before_numerical_fix.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/model_before_numerical_fix.py new file mode 100644 index 0000000000000000000000000000000000000000..1dab6e08582e4610693292e765d40a8b5392e97a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/model_before_numerical_fix.py @@ -0,0 +1,207 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + from torch_post import apply_fixed + q=apply_fixed(ctx,periods,q*scale[:,:,None]+mu[:,:,None]) + q=(q-mu[:,:,None])/scale[:,:,None] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/restart.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/restart.py new file mode 100644 index 0000000000000000000000000000000000000000..fa09bf30ead55ac10ca2d8c9a55277ddd71986f7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/restart.py @@ -0,0 +1,25 @@ +"""Restart corrected E75 from the declared parent and record process compute.""" +import json +import os +from pathlib import Path +import subprocess +import time + +R=Path('/workspace/research');run=R/'runs/postloss' +receipt=json.loads((R/'postloss_queue_before_recovery2.json').read_text()) +command=receipt['command'] +assert not (run/'recovery.pt').exists(),'This script is only for the documented pre-checkpoint numerical restart.' +env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') +with (R/'postloss_recovery3.log').open('w') as f: + p=subprocess.Popen(command,stdout=f,stderr=subprocess.STDOUT,env=env) +record={'command':command,'status':'running','pid':p.pid,'log':str(R/'postloss_recovery3.log'), + 'started_utc':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + 'note':'Restart own E62 initialization after verified float32 variance-overflow correction; original seed and recipe unchanged.'} +path=R/'postloss_recovery3_receipt.json';path.write_text(json.dumps(record,indent=2)) +watch=['python3',str(R/'watch_evaluate.py'),'--run',str(run),'--evaluator',str(R/'postloss_inference/evaluate.py'), + '--name','postloss','--steps','1000,3000,6000,12000'] +with (R/'postloss_watch_recovery3_fixed.log').open('w') as f: + subprocess.Popen(watch,stdout=f,stderr=subprocess.STDOUT,env=env) +started=time.monotonic();returncode=p.wait() +record.update(status='complete' if returncode==0 else 'failed',returncode=returncode,process_seconds=time.monotonic()-started) +path.write_text(json.dumps(record,indent=2));raise SystemExit(returncode) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/torch_post.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/torch_post.py new file mode 100644 index 0000000000000000000000000000000000000000..e19586bcc1677d56cedb6ce02c2f57797157f5f3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/postloss/torch_post.py @@ -0,0 +1,112 @@ +"""Differentiable forecast transforms with the package's fixed context rules. + +Context statistics are constants with respect to model parameters. Gradients +flow only through the forecast, including the continuity correction's anchor. +""" +import torch + + +@torch.no_grad() +def context_statistics(ctx, periods, horizon): + x=ctx.double(); finite=torch.isfinite(x); clean=torch.where(finite,x,0.) + b,c=x.shape; device=x.device + pos=torch.arange(c,device=device)[None,:] + count=finite.sum(-1).clamp(min=1) + mean=clean.sum(-1)/count + variance=(torch.where(finite,x-mean[:,None],0.).square()).sum(-1)/count + positive=((x>=0)|~finite).all(-1) + zeros=((x==0)&finite).sum(-1) + zero_active=positive&(zeros>=4)&(zeros/count>=.1) + cutoff=torch.where(zero_active,.4*variance.sqrt(),0.) + first=torch.where(finite,pos,c).min(-1).values + length=c-first + phase=torch.arange(max(1,c//3),device=device)[None,:] + future=torch.arange(horizon,device=device)[None,:] + z=torch.tensor([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0, + .2533471031,.5244005127,.8416212336,1.2815515655],device=device) + best_weight=torch.zeros(b,device=device,dtype=torch.float64) + prior=torch.zeros(b,horizon,9,device=device,dtype=torch.float64) + prior_valid=torch.zeros(b,horizon,device=device,dtype=torch.bool) + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + cycles=(length[:,None]//p).clamp(max=8) + history=finite&(pos>=c-cycles*p) + n=history.sum(-1).clamp(min=1) + center=(clean*history).sum(-1)/n + var=torch.where(history,x-center[:,None],0.).square().sum(-1)/n + previous=pos-p;safe=previous.clamp(min=0) + pairs=(previous>=c-cycles*p)&(previous>=0)&finite&finite.gather(1,safe) + pairs_count=pairs.sum(-1) + difference=clean-clean.gather(1,safe) + mse=(difference.square()*pairs).sum(-1)/pairs_count.clamp(min=1) + weight=(1-mse/(var+1e-12)/.25).clamp(0,.98) + eligible=(p[:,0]>=2)&(cycles[:,0]>=3)&(pairs_count>=p[:,0]) + weight=torch.where(eligible,weight,0.) + values=[];observed=[] + for cycle in range(4): + idx=c-p+phase-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(phase=0)&(cycle0 + template=(values*observed).sum(0)/nphase.clamp(min=1) + ntemplate=phase_valid.sum(-1).clamp(min=1) + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent=finite&(pos>=c-p) + nr=recent.sum(-1).clamp(min=1) + recent_mean=(clean*recent).sum(-1)/nr + template=template+(recent_mean-template_mean)[:,None] + template_mean=(template*phase_valid).sum(-1)/ntemplate + recent_var=torch.where(recent,x-recent_mean[:,None],0.).square().sum(-1)/nr + template_var=((template-template_mean[:,None]).square()*phase_valid).sum(-1)/ntemplate + used_cycles=cycles[:,0].clamp(min=1,max=4) + noise=mse/2 + target_var=(recent_var-noise).clamp(min=0) + base_var=(template_var-noise/used_cycles).clamp(min=0) + ratio=(target_var/base_var.clamp(min=1e-12)).sqrt().clamp(.5,2.) + align=nr>=torch.maximum(torch.full_like(nr,2),.75*p[:,0]) + ratio=torch.where(align,ratio,1.) + template=template_mean[:,None]+(template-template_mean[:,None])*ratio[:,None] + sigma=(noise*(1+1/used_cycles)).sqrt() + index=(future%p).clamp(max=phase.shape[-1]-1) + selected=template.gather(1,index) + valid=phase_valid.gather(1,index) + q=selected[:,:,None]+sigma[:,None,None]*z[None,None,:] + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + choose=weight>best_weight + prior=torch.where(choose[:,None,None],q,prior) + prior_valid=torch.where(choose[:,None],valid,prior_valid) + best_weight=torch.maximum(best_weight,weight) + seasonal_weight=best_weight[:,None]*prior_valid + + recent=x[:,-512:];seen=torch.isfinite(recent) + n=seen.sum(-1).clamp(min=1);clean_recent=torch.where(seen,recent,0.) + center=clean_recent.sum(-1)/n + var=torch.where(seen,recent-center[:,None],0.).square().sum(-1)/n + differences=recent[:,1:]-recent[:,:-1] + diff_seen=torch.isfinite(differences);nd=diff_seen.sum(-1) + mse=torch.where(diff_seen,differences,0.).square().sum(-1)/nd.clamp(min=1) + tail=differences[:,-8:] + tail_seen=torch.isfinite(tail);nt=tail_seen.sum(-1) + sorted_tail=torch.where(tail_seen,tail,float('inf')).sort(-1).values + if tail.shape[-1]: + lo=((nt-1).clamp(min=0)//2)[:,None];hi=(nt//2).clamp(max=tail.shape[-1]-1)[:,None] + median=(sorted_tail.gather(1,lo)+sorted_tail.gather(1,hi))[:,0]/2 + else:median=torch.zeros(b,device=device,dtype=x.dtype) + continuity_weight=(1-mse/(var+1e-12)/.5).clamp(0,.95) + active=(nd>=8)&(nt>0)&seen[:,-1] + continuity_weight=torch.where(active,continuity_weight,0.) + anchor=torch.where(active,recent[:,-1]+median,0.) + return seasonal_weight,prior,continuity_weight,anchor,positive,cutoff + + +def apply_fixed(ctx,periods,quant): + """Quantiles are raw-scale tensors of shape (batch,horizon,9).""" + weight,prior,cweight,anchor,positive,cutoff=context_statistics(ctx,periods,quant.shape[1]) + q=torch.where(positive[:,None,None],quant.clamp(min=0),quant) + q=((1-weight[:,:,None])*q+weight[:,:,None]*prior).float() + bias=(cweight*(anchor-q[:,0,4])).float() + decay=torch.exp(-torch.arange(q.shape[1],device=q.device,dtype=torch.float64)/24) + q=(q.double()+bias[:,None,None]*decay[None,:,None]).float() + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return torch.where((q>=0)&(q8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/brief.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/brief.py new file mode 100644 index 0000000000000000000000000000000000000000..8dd8e644caebdbb0b767e5432db11e19c5eaa211 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/brief.py @@ -0,0 +1,33 @@ +"""Write a short, current recovery handoff; never modify training state.""" +import datetime +import json +from pathlib import Path + +R = Path('/workspace/research') +s = json.loads((R/'CURRENT_RESEARCH_STATE.json').read_text()) +lines = ['# Current recovery brief', '', datetime.datetime.now(datetime.timezone.utc).isoformat(), '', + 'Continuous research; no endpoint/final hand-in. One H10080GB,22CPUs,224GiB requested RAM; no network or pretrained assets. Do not inspect credentials or spawn agents.', '', + '## Published', '', json.dumps(s['published']), '', '## Pending selection', '', + json.dumps(s.get('next_candidate',{})), '', json.dumps({k:v for k,v in s.get('selection_probes',{}).items() if k in ['E128','E130','E132','E133','E134','E135','E136','E137']}), '', '## Active and queued training', ''] +for name, job in s.get('external_jobs',{}).items(): + if job['status'] not in ['running','waiting']: + continue + lines += [f'- {name}: {job["status"]}; receipt {job["receipt"]}; queue PID snapshot {job["queue_pid_at_snapshot"]}; children {job["child_pids_at_snapshot"]}.', + f' Last logged record: {json.dumps(job["last_phase_record"])}', + f' Complete recovery: {job["complete_recovery_checkpoint"]}; latest EMA: {job["latest_saved_ema"]}.'] +lines += ['', '## Recovery rules', '', + '- PIDs and launch-script dependencies are snapshots. After an operator restart, restore running jobs from each complete recovery.pt, preserving optimizer/EMA/RNG/prefetched batch and original schedules. Rewire waiting jobs to the newly launched dependency PIDs; do not blindly rerun old launch scripts.', + '- Waiting dependency chain: weekly_replication_control after long_seasonal; weekly_replication_candidate after that control; lowfreq_windows after that candidate; long_seasonal_replication after lowfreq_windows. phase_joint waits for random_capacity_512 final96000; seasonal_dispersion waits for phase_joint final12000; seasonal_history waits for seasonal_dispersion final12000. random_capacity_original_ar waits for random_capacity_1024 final96000; log_horizon waits for long_seasonal_replication final12000; seasonal_width waits for seasonal_history final12000; random_capacity_long_seasonal waits for both E94halfLR and E79wide final96000 and replaces only the E94allocation. visibility_curriculum waits for E110full and E79wide final96000 and replaces only the E110allocation; preserve --visibility-curriculum on any resume. direct_trend_head waits for E129seasonal_width final12000 and replaces that allocation. random_capacity_deep waits for E122originalAR and E79wide final96000, replacing only the E122allocation.', + '- E121 history-aware ensemble runtime is prepared at history_three_patch_ensemble; synthetic audit checks exact standalone composition and ordinary legacy equality. It also applies member finite cleanup before averaging, correcting a pre-existing extreme-value discrepancy. Use this separate publisher and complete public replay before any E121 publication; E130 now publishes four members using four_member_ensemble/publish.py, retaining both finite cleanup and per-member history support. Use that publisher for four-member packages.', + '- E126 compiled_teacher_trial completed its mandatory17000stop; do not resume it. It preserved original96000 LR schedule from immutable distill_ensemble_recovery016000.pt. Original E101 stays active. Compiler takeover rejected: max cutoff drift0.001964 exceeded0.0005 tolerance, with only3to5percent warm shared-device timing gain. No coefficient change selected. E125 component ablations completed; both paths help. E127 finite-member numerical fix is published with all97predictions bitwise unchanged; do not republish it. E128 dispersion transfers6000 and12000 both lost full validation; neither is published. E130 equal-quarter package is the current best. E132 checks scheduled E79wide96000 as the fourth member; E133 conditional seasonal seed average requires both replication gates before any checkpoint is constructed. Receipts are indexed in CURRENT_RESEARCH_STATE.json.', + '- E101 distillation teacher is immutable /workspace/research/distill_teacher_E96, even after later publications. Do not substitute the current submission.', + '- Restore compiler_cache_backup to the same /tmp cache paths before restarting compiled trainers. Exact environment and commands are in CURRENT_RESEARCH_STATE.json.', + '- E105 output collision is documented in incidents/stratified_volume_output_collision. Correct E105 output is runs/stratified_volume. E95final and2k..12k weights survive, but E95optimizer recovery and original1k weights were lost. Do not resume completed E95.', + '- All previous negative/stopped branches stay stopped unless a new matched experiment explicitly revisits them. Never retrain the supplied baselines.', + '- Current training-source publisher archives all Python modules from explicitly declared directories, fixing earlier omissions of spectral.py and schedules.py. Complete-source members carry a -complete suffix when rebuilt. Runtime/weight hashes were unchanged.', + '- Full evaluation and GPU diagnostics use .evaluation.lock; the six main trainers share the one H100. The bounded E126 seventh-process probe completed17000 and should remain stopped. Dataset windows under data/valid and all earlier cutoffs are selection only, never training.', + '- Master journal direct_v1/EXPERIMENTS.md, chronological SESSION_20261023_PROGRESS.md, and RESEARCH_IDEAS.md contain decisions and rejected candidates. Recheck live processes and latest reports before acting.', + '', '## Time anchor', '', + 'Latest operator recovery allowance:151596research seconds at2026-10-23T02:45:51UTC. Pauses/preflight excluded. The goal remains active and has no requested token budget.', ''] +(R/'RECOVERY_BRIEF.md').write_text('\n'.join(lines)) +print('Wrote RECOVERY_BRIEF.md with '+str(sum(j['status'] in ['running','waiting'] for j in s.get('external_jobs',{}).values()))+' active/queued jobs.') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/launch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/launch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..6d33e64b8212b250fc38a2990604c80228b94c80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/launch_matched_cutoffs.py @@ -0,0 +1,14 @@ +"""Keep evaluation controllers alive for the declared queued comparisons.""" +from pathlib import Path +import datetime,json,os,subprocess +R=Path('/workspace/research');jobs={};processes={};env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') +for name,control,runtime,label in [('lowfreq_windows','overflow_control','postloss_inference','E113'),('seasonal_history','long_seasonal','seasonal_history_inference','E121'),('seasonal_width','seasonal_dispersion','seasonal_width_inference','E129'),('long_seasonal_replication','weekly_replication_control','long_seasonal_inference','E118'),('log_horizon','overflow_control','postloss_inference','E123')]: + path=R/(name+'_matched_cutoffs.log') + with path.open('a') as log: + command=['python3',str(R/'recovery/watch_matched_cutoffs.py'),'--run',name,'--control',control,'--evaluator',str(R/runtime/'evaluate.py'),'--label',label] + p=subprocess.Popen(command,stdout=log,stderr=subprocess.STDOUT,env=env) + processes[label]=p;jobs[label]=dict(pid=p.pid,parent_pid=os.getpid(),command=command,log=str(path),receipt=str(R/(name+'_matched_cutoffs_receipt.json'))) +q=R/'CURRENT_RESEARCH_STATE.json';state=json.loads(q.read_text());state['diagnostics']['matched_cutoff_controllers']=jobs;t=q.with_suffix('.tmp');t.write_text(json.dumps(state,indent=2));os.replace(t,q) +print(json.dumps(jobs),flush=True) +for label,p in processes.items(): + result=p.wait();print(json.dumps(dict(label=label,returncode=result)),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/matched_report.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/matched_report.py new file mode 100644 index 0000000000000000000000000000000000000000..f7755cfc0300a5a18f3e2db1d6d5aa89cda9f0fa --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/matched_report.py @@ -0,0 +1,16 @@ +"""Record matched validation reports, including all configuration-group metrics.""" +import argparse,datetime,json,math +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['candidate','control','label','out']:ap.add_argument('--'+key,required=True) +ap.add_argument('--cutoffs',default='0');ap.add_argument('--outcome',required=True);a=ap.parse_args() +folders=['evals','backcast_evals','backcast2_evals','backcast3_evals'];rows=[] +for index in map(int,a.cutoffs.split(',')): + folder=folders[index];x=json.loads((R/folder/a.candidate/'report.json').read_text());y=json.loads((R/folder/a.control/'report.json').read_text()) + assert x['n_failed']==y['n_failed']==0 and x['n_configs']==y['n_configs'] + delta={g:{k:math.sqrt(y['groups'][g][k]['rel_mase_gmean']*y['groups'][g][k]['rel_wql_gmean'])-math.sqrt(v['rel_mase_gmean']*v['rel_wql_gmean']) for k,v in entries.items()} for g,entries in x['groups'].items()} + rows.append(dict(cutoff=folder,candidate_skill=x['skill_score'],control_skill=y['skill_score'],delta=x['skill_score']-y['skill_score'],candidate_checkpoint=x['checkpoint_sha256'],control_checkpoint=y['checkpoint_sha256'],candidate_eval_seconds=x.get('eval_seconds'),candidate_groups=x['groups'],control_groups=y['groups'],group_skill_delta=delta)) +result=dict(label=a.label,utc=datetime.datetime.now(datetime.timezone.utc).isoformat(),candidate=a.candidate,control=a.control,rows=rows,mean_delta=sum(v['delta'] for v in rows)/len(rows),positive_cutoffs=sum(v['delta']>0 for v in rows),outcome=a.outcome) +p=Path(a.out);assert not p.exists(),'Refuse duplicate comparison record';p.write_text(json.dumps(result,indent=2)) +with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\n'+a.label+': '+json.dumps(result)+'\n') +print(json.dumps({k:v for k,v in result.items() if k!='rows'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/median_error_structure.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/median_error_structure.py new file mode 100644 index 0000000000000000000000000000000000000000..83bb24d13841f0266d0947799c682f47e8641474 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/median_error_structure.py @@ -0,0 +1,30 @@ +"""Describe validation median errors without fitting or proposing corrected forecasts.""" +import argparse,json,sys,time +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +from ts_io import read_prediction_file,read_truth_file +ap=argparse.ArgumentParser() +for n in ['valid','pred','report','out']:ap.add_argument('--'+n,required=True) +a=ap.parse_args();start=time.monotonic();root=Path(a.valid);report=json.loads(Path(a.report).read_text());rows=[] +for cfg in report['configs']: + cid=cfg['config_id'];y,scale,_=read_truth_file(root/'truth/cases'/(cid+'.h5'));_,q=read_prediction_file(Path(a.pred)/'cases'/(cid+'.h5')) + good=np.isfinite(scale)&(scale>0);valid=np.isfinite(y)&good[...,None];safe=np.where(good,scale,1).astype(np.float64) + err=np.where(valid,(q[:,:,4,:].astype(np.float64)-y.astype(np.float64))/safe[...,None],0.) + n=valid.sum(-1);total=int(n.sum());mae=float(np.abs(err).sum()/total) + signed=float(err.sum()/total);absolute_window_mean=float(np.abs(err.sum(-1)).sum()/total) + assert absolute_window_mean<=mae+1e-10 + lead=[] + for positions in np.array_split(np.arange(y.shape[-1]),4): + mask=valid[...,positions];count=int(mask.sum());values=err[...,positions] + lead.append(dict(count=count,mase=float(np.abs(values).sum()/count),signed_scaled_error=float(values.sum()/count))) + rows.append(dict(config_id=cid,term=cfg['term'],domain=cfg['domain'],frequency=cfg['freq'],horizon=cfg['prediction_length'],mase=mae,scorer_mase=cfg['metrics']['mase'],signed_scaled_error=signed,absolute_window_mean_error=absolute_window_mean,window_mean_error_fraction_of_mae=absolute_window_mean/max(mae,1e-30),lead_quarters=lead)) + assert abs(mae-cfg['metrics']['mase'])<1e-6*max(1,mae) +groups={} +for key in ['term','domain','frequency']: + groups[key]={} + for value in sorted({row[key] for row in rows}): + selected=[row for row in rows if row[key]==value] + groups[key][value]=dict(configs=len(selected),mean_window_mean_error_fraction=float(np.mean([row['window_mean_error_fraction_of_mae'] for row in selected])),mean_signed_error_over_mae=float(np.mean([row['signed_scaled_error']/max(row['mase'],1e-30) for row in selected])),mean_lead_quarter_mase_ratio=[float(np.mean([row['lead_quarters'][i]['mase']/max(row['mase'],1e-30) for row in selected])) for i in range(4)]) +result=dict(checkpoint_sha256=report['checkpoint_sha256'],groups=groups,configs=rows,seconds=time.monotonic()-start,optimizer_updates=0,new_inference=False,note='Validation-only descriptive analysis. Absolute per-window mean error is a Jensen lower bound on MAE, not a recoverable correction or attributable causal component. Groups average configurations equally; lead ratios are descriptive, not the benchmark metric. No parameter fitting or forecast modification.') +Path(a.out).write_text(json.dumps(result,indent=2));print(json.dumps({k:v for k,v in result.items() if k!='configs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/pack_composition.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/pack_composition.py new file mode 100644 index 0000000000000000000000000000000000000000..0a023de983f7c0860043b58def56406e3fd27eb9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/pack_composition.py @@ -0,0 +1,32 @@ +"""Read-only comparison of source/length composition in the two allowed packs.""" +import json,time +from pathlib import Path +import numpy as np +R=Path('/workspace/research');started=time.monotonic();old=R/'packed_sample';new=R/'packed_stratified_full' +a=json.loads((old/'meta.json').read_text());b=json.loads((new/'meta.json').read_text());assert a['dirs']==b['dirs'];names=a['dirs'] +weights=[] +for n in names: + w=min((old/(n+'.bin')).stat().st_size//4,20000000)**.25 + if n.startswith(('era5_','cmip6_')):w*=.35 + if n.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) +weights=np.array(weights)/sum(weights);bins=np.array([16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131073]) +rows=[];aggregate={k:np.zeros(len(bins)-1) for k in ['old','full']} +for n,w in zip(names,weights): + row={'source':n,'conditional_real_source_probability':float(w)} + for k,root in [('old',old),('full',new)]: + lengths=np.diff(np.load(root/(n+'.offsets.npy'),mmap_mode='r')) + hist=np.histogram(lengths,bins=bins)[0]/len(lengths);aggregate[k]+=w*hist + row[k]={'series':len(lengths),'points':int(lengths.sum()),'mean_length':float(lengths.mean()),'median_length':float(np.median(lengths)), + 'fraction_below64':float(np.mean(lengths<64)),'fraction_below256':float(np.mean(lengths<256)), + 'fraction_at_least20480':float(np.mean(lengths>=20480)),'length_bin_probabilities':hist.tolist()} + row['weighted_length_distribution_l1']=float(w*np.abs(np.array(row['old']['length_bin_probabilities'])-row['full']['length_bin_probabilities']).sum()) + row['mixed_frequency_rows_in_full']=b['receipts'][n]['mixed_frequency_rows_in_candidates'];row['full_frequencies']=b['receipts'][n]['kept_frequencies'];rows.append(row) +result=dict(kind='per-source uniform-series sampling composition; no series values or validation labels read', + length_bins=bins.tolist(),conditional_real_length_bin_probabilities={k:v.tolist() for k,v in aggregate.items()}, + source_probabilities_unchanged=True,min_length_both=16,max_crop_length_both=131072, + mixed_frequency_sources=[r['source'] for r in rows if r['mixed_frequency_rows_in_full']],sources=rows, + seconds=time.monotonic()-started,optimizer_updates=0) +(R/'pack_composition_comparison.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='sources'})) +for row in sorted(rows,key=lambda r:-r['weighted_length_distribution_l1'])[:12]:print(json.dumps({k:v for k,v in row.items() if k not in ['old','full']},separators=(',',':')), 'mean_length',row['old']['mean_length'],row['full']['mean_length']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/quantile_coverage.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/quantile_coverage.py new file mode 100644 index 0000000000000000000000000000000000000000..d7f4958ae772a15c4a580eed59bb9257b065154d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/quantile_coverage.py @@ -0,0 +1,59 @@ +"""Validation-only quantile coverage, with separate strict/inclusive coverage at atoms.""" +import argparse +import json +import sys +import time +from pathlib import Path + +import numpy as np + +sys.path.insert(0,'/workspace/evaluation') +from ts_io import read_prediction_file, read_truth_file + +parser = argparse.ArgumentParser() +parser.add_argument('--valid',required=True) +parser.add_argument('--pred',required=True) +parser.add_argument('--report',required=True) +parser.add_argument('--out',required=True) +args = parser.parse_args() +started = time.monotonic() +root = Path(args.valid) +index = json.loads((root/'input/index.json').read_text()) +report = json.loads(Path(args.report).read_text()) +levels = np.arange(1,10)/10 +rows = [] +for cfg in index['configs']: + relative = Path('cases')/(cfg['config_id']+'.h5') + y,scale,_ = read_truth_file(root/'truth'/relative) + _,q = read_prediction_file(Path(args.pred)/relative) + valid = np.isfinite(y) + assert q.shape==(*y.shape[:2],9,y.shape[-1]) and np.isfinite(q).all() + count = int(valid.sum()) + assert count>0 + strict = ((y[:,:,None,:] anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/seasonal_history_support.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/seasonal_history_support.py new file mode 100644 index 0000000000000000000000000000000000000000..84314b30b22a4a761447fc5ee1cffb9301e725b9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/seasonal_history_support.py @@ -0,0 +1,23 @@ +"""Context-metadata diagnostic of potential 8-cycle support, with no targets read.""" +import importlib.util,json,time +from pathlib import Path +import h5py,numpy as np +R=Path('/workspace/research');started=time.monotonic() +spec=importlib.util.spec_from_file_location('support_model',R/'long_seasonal/model.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m) +root=Path('/workspace/data/valid/input');index=json.loads((root/'index.json').read_text());rows=[] +for cfg in index['configs']: + with h5py.File(root/'cases'/(cfg['config_id']+'.h5'),'r') as f:lengths=np.asarray(f['context_length']) + h=cfg['prediction_length'];periods=m.periods_for_freq(cfg['freq']);row={k:cfg[k] for k in ['config_id','freq','term','domain']};row['periods']=periods;row['n_instances']=len(lengths) + for cap in [4096,16384]: + support=[];cycles=[] + for p in periods: + count=np.clip(1+(np.minimum(lengths,cap)[:,None]-p+np.arange(h)[None,:]%p)//p,0,16) + support.append(float(np.mean((count>=8)&(p>=2))));cycles.append(float(np.mean(np.where(p>=2,count,0)))) + row[str(cap)]={'phase_support_fraction':support,'mean_available_cycles':cycles} + row['support_gain_sum']=sum(row['16384']['phase_support_fraction'])-sum(row['4096']['phase_support_fraction']);rows.append(row) +changed=[r for r in rows if r['support_gain_sum']>0] +result=dict(kind='optimistic potential support before missing-value masks; not measured forecast improvement',input_metadata_only=True,validation_targets_read=False,optimizer_updates=0,configs=rows, + changed_configurations=len(changed),changed_domains=sorted(set(r['domain'] for r in changed)),seconds=time.monotonic()-started) +(R/'seasonal_history_support.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='configs'})) +for r in sorted(changed,key=lambda x:x['support_gain_sum'],reverse=True)[:20]:print(json.dumps(r)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..8830b781603788d85aceb9e21eee755ab03b4c47 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json'),str(R/'long_seasonal_replication_queue.json'),str(R/'seasonal_dispersion_queue.json'),str(R/'seasonal_history_queue.json'),str(R/'random_capacity_original_ar_queue.json'),str(R/'log_horizon_queue.json'),str(R/'compiled_teacher_trial_queue.json'),str(R/'seasonal_width_queue.json'),str(R/'random_capacity_long_seasonal_queue.json'),str(R/'visibility_curriculum_queue.json'),str(R/'direct_trend_head_queue.json'),str(R/'random_capacity_deep_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/synthetic_window_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/synthetic_window_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..5a6455bbd9926f9d342ee1a24ca825328a9e7e1f --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/synthetic_window_audit.py @@ -0,0 +1,63 @@ +"""Compare actual allowed/synthetic training-window dynamics without validation data.""" +import datetime +import json +from pathlib import Path +import sys +import time +import types +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'overflow_control')) +source=(R/'overflow_control/data.py').read_text() +needle='r=self.rng;ctx=np.full((batch,context),np.nan,np.float32);tgt=np.full((batch,horizon),np.nan,np.float32);periods=np.ones((batch,2),np.int64)' +assert source.count(needle)==1 +instrumented=source.replace(needle,needle+';self.audit_synthetic=np.zeros(batch,bool)') +needle='if r.random()=16 and len(target)>=4: + k=min(16,n//4,len(target)) + # Descriptive finite-observation means, not a proposed inference feature. + scale=max(float(np.std(values)),float(np.mean(np.abs(values)))*1e-4,1e-4) + past=(float(np.mean(values[-k:]))-float(np.mean(values[-2*k:-k])))/scale + future=(float(np.mean(target[:k].astype(np.float64)))-float(np.mean(values[-k:])))/scale + item.update(past_change=float(np.clip(past,-20,20)),future_change=float(np.clip(future,-20,20))) + groups.setdefault(frequency+'_'+kind,[]).append(item);counts+=1 +summary={} +for name,rows in groups.items(): + c=np.array([x['context'] for x in rows]);h=np.array([x['target'] for x in rows]) + valid=[x for x in rows if x['past_change'] is not None] + past=np.array([x['past_change'] for x in valid]);future=np.array([x['future_change'] for x in valid]) + summary[name]=dict(rows=len(rows),median_finite_context=float(np.median(c)), + context_at_most128=float(np.mean(c<=128)),context_above512=float(np.mean(c>512)), + median_finite_target=float(np.median(h)),dynamic_rows=len(valid), + median_abs_recent_change=float(np.median(np.abs(past))), + median_abs_future_change=float(np.median(np.abs(future))), + recent_future_change_correlation=float(np.corrcoef(past,future)[0,1])) +result=dict(seed=seed,rows=counts,batches=160,groups=summary,seconds=time.monotonic()-started, + generated_utc=datetime.datetime.now(datetime.timezone.utc).isoformat(), + instrumentation_first640_rows_and_rng_bitwise=True,optimizer_updates=0, + validation_data_read=False,decision='Descriptive audit only. E113 remains unchanged; no new generator selected.') +(R/'synthetic_window_audit.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..065dcacb628103ba06aed5cdf1c9868860599ae0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/train.py @@ -0,0 +1,255 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +ap.add_argument('--compile-teacher',action='store_true') +ap.add_argument('--visibility-curriculum',action='store_true') +ap.add_argument('--gate-package') +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble','random_capacity_long_seasonal','visibility_curriculum','random_capacity_deep'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint','seasonal_dispersion','seasonal_history','seasonal_width','direct_trend_head','random_capacity_long_seasonal','visibility_curriculum','random_capacity_deep','ensemble_gate'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='random_capacity_original_ar': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.synthetic_ar_coefficient_law='uniform(0.2,0.995), original generator; unchanged AR branch probability and asymptotic variance scaling' +if Path(a.code_dir).name=='log_horizon': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.requested_horizon_law='half full; half geometric quantile remap of the original uniform integer endpoint draw from min(16,max(1,H//4)) to H, then patch16 rounding; identical RNG consumption' +if Path(a.code_dir).name=='seasonal_history': + a.learned_seasonal_history_context=16384;a.recent_encoder_and_rule_context=4096 + a.history_extension_rule='extend originally full4096 real contexts before the same cutoff, preserving original recent contexts, targets, aggregation, sampler RNG and horizon RNG; synthetic extra prefix missing' +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +if a.visibility_curriculum: + assert Path(a.code_dir).name=='visibility_curriculum' and not a.teacher_package and not a.gate_package + from visibility import visible_batch + a.visibility_curriculum_rule='steps1..16000:lastC/4,firstmax(16,H/4);16001..32000:lastC/2,firstmax(16,H/2);32001..96000:unchanged; sample/prefetch full original windows and crop only current loss arrays' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None;teacher_predict=None;experts=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + teacher_predict=teacher + if a.compile_teacher: + torch._dynamo.config.recompile_limit=64 + teacher_predict=torch.compile(teacher.__call__,fullgraph=True,dynamic=False) +else: + assert not a.compile_teacher, '--compile-teacher requires a declared own-model teacher' + +if Path(a.code_dir).name=='ensemble_gate':assert a.gate_package and a.loss_mode=='paired' +if a.gate_package: + assert Path(a.code_dir).name=='ensemble_gate' and not a.teacher_package and not a.compile_loss + from experts import FrozenExperts + from model import FEATURE_NAMES + torch.backends.cuda.matmul.allow_tf32=False + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + experts=FrozenExperts(a.gate_package) + if ck.get('args',{}).get('fixed_expert_descriptor_sha256'): + assert ck['args']['fixed_expert_descriptor_sha256']==experts.descriptor_sha256 + assert ck['args']['fixed_expert_checkpoint_sha256']==experts.member_hashes + a.fixed_expert_descriptor_sha256=experts.descriptor_sha256 + a.fixed_expert_checkpoint_sha256=experts.member_hashes + a.expert_forecast_kind='four own frozen E130 raw-scale final forecasts, including exact packaged per-member transformations' + a.gate_weight_rule='0.125+0.5*softmax; same positive per-lead weight across all quantiles' + a.gate_features=FEATURE_NAMES + a.trainable_scope='6340 gate parameters only; four experts frozen and excluded from optimizer and EMA' + a.fixed_postprocessing_loss=True + a.gate_precision='FP32 gate, BF16 frozen experts, TF32 disabled' + assert sum(p.numel() for p in model.parameters())==6340 + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])+(experts.checkpoints if experts else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/watch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/watch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..3bd2f95022f87dbe1c349575c0ec77662a2d4d6e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/recovery/watch_matched_cutoffs.py @@ -0,0 +1,34 @@ +"""Complete declared primary/durability comparisons; never select a model automatically.""" +import argparse,datetime,json,os,subprocess,time +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['run','control','evaluator','label']:ap.add_argument('--'+key,required=True) +ap.add_argument('--control-evaluator');ap.add_argument('--steps',default='6000,12000');a=ap.parse_args();start=time.monotonic() +receipt=R/(a.run+'_matched_cutoffs_receipt.json') +state=dict(pid=os.getpid(),status='running',run=a.run,control=a.control,steps=[],started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) +def save(): + state['seconds']=time.monotonic()-start;tmp=receipt.with_suffix('.tmp');tmp.write_text(json.dumps(state,indent=2));os.replace(tmp,receipt) +def call(label,command): + state['status']=label;save();t=time.monotonic();result=subprocess.run(command);state['steps'].append(dict(label=label,returncode=result.returncode,seconds=time.monotonic()-t));save() + if result.returncode:state['status']='failed';save();raise SystemExit(result.returncode) +for step in map(int,a.steps.split(',')): + name=a.run+'_ema'+str(step);report=R/'evals'/name/'report.json';state['status']='waiting for main'+str(step);save() + while not report.exists(): + queue=R/(a.run+'_queue.json') + if queue.exists() and json.loads(queue.read_text()).get('status')=='failed':state['status']='training failed';save();raise SystemExit(1) + time.sleep(3) + time.sleep(1) + call('earlier cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',name,'--weights',str(R/'runs'/a.run/f'ema{step:06d}.pt'),'--evaluator',a.evaluator,'--cutoffs','1,2,3']) + control_name=a.control+'_ema'+str(step) + if any(not (R/folder/control_name/'report.json').exists() for folder in ['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert a.control_evaluator,'Missing matched control reports; pass --control-evaluator for their declared evaluation' + call('control cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',control_name,'--weights',str(R/'runs'/a.control/f'ema{step:06d}.pt'),'--evaluator',a.control_evaluator]) + out=R/(a.run+str(step//1000)+'k_four_cutoff_comparison.json') + if out.exists(): + cached=json.loads(out.read_text());assert cached['candidate']==name and cached['control']==a.control+'_ema'+str(step) and len(cached['rows'])==4 + for row,folder in zip(cached['rows'],['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert row['candidate_checkpoint']==json.loads((R/folder/name/'report.json').read_text())['checkpoint_sha256'] + assert row['control_checkpoint']==json.loads((R/folder/(a.control+'_ema'+str(step))/'report.json').read_text())['checkpoint_sha256'] + state['steps'].append(dict(label='reused verified matched comparison'+str(step),returncode=0,seconds=0));save();continue + call('matched comparison'+str(step),['python3',str(R/'recovery/matched_report.py'),'--candidate',name,'--control',a.control+'_ema'+str(step),'--label',a.label+' '+str(step)+' four-cutoff comparison','--cutoffs','0,1,2,3','--out',str(out),'--outcome',f'Declared comparison checkpoints {a.steps}. No transfer formula or automatic publication is selected by this controller.']) +state['status']='complete; research review required';save();print(json.dumps(state),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/check.py new file mode 100644 index 0000000000000000000000000000000000000000..c18b58905262b5ac8df12ab86f2f03e5ce285356 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/check.py @@ -0,0 +1,101 @@ +"""E119 exact initialization and independent seasonal dispersion arithmetic.""" +import argparse +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path +import numpy as np +import torch + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'seasonal_dispersion')) +from model import DirectForecaster,centered_seasonal_difference,loss_fn +from data import Sampler +ap=argparse.ArgumentParser();ap.add_argument('--gpu',action='store_true');a=ap.parse_args() +torch.set_num_threads(2);torch.manual_seed(577);started=time.monotonic() +spec=importlib.util.spec_from_file_location('dispersion_control',R/'long_seasonal/model.py') +code=importlib.util.module_from_spec(spec);spec.loader.exec_module(code) +parent_path=R/'long_seasonal_initial.pt';parent=torch.load(parent_path,map_location='cpu',weights_only=False) +config=dict(parent['config'],seasonal_dispersion_features=True) +candidate=DirectForecaster(**config) +missing,unexpected=candidate.load_state_dict(parent['model'],strict=False) +assert missing==['dispersion_query.weight'] and not unexpected +assert torch.count_nonzero(candidate.dispersion_query.weight)==0 +assert all(torch.equal(v,candidate.state_dict()[k]) for k,v in parent['model'].items()) +assert all(p.requires_grad for p in candidate.parameters()) +control=code.DirectForecaster(**parent['config']);control.load_state_dict(parent['model']) +assert (R/'seasonal_dispersion/data.py').read_bytes()==(R/'long_seasonal/data.py').read_bytes() + +if a.gpu: + import fcntl + lock=open(R/'.evaluation.lock','a');fcntl.flock(lock,fcntl.LOCK_EX) + torch.backends.cuda.matmul.allow_tf32=False + candidate,control=candidate.cuda(),control.cuda() + rng=np.random.default_rng(587) + ctx=torch.tensor(rng.normal(size=(8,512)).astype(np.float32),device='cuda');ctx[0,:23]=float('nan');ctx[1]=0 + periods=torch.tensor([[24,168],[7,365],[12,1],[52,1],[4,1],[1,1],[96,672],[2,14]],device='cuda') + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16): + expected=control(ctx,periods,128);actual=candidate(ctx,periods,128) + assert all(torch.equal(v,w) for v,w in zip(expected,actual)) + del control,ctx,periods,expected,actual + torch.cuda.empty_cache();torch.cuda.reset_peak_memory_stats() + sampler=Sampler(R/'packed_sample',seed=587,source_weights_from=R/'packed_sample') + tensors=[torch.from_numpy(v).cuda() for v in sampler.sample(64,4096,1024)] + placeholders=[torch.zeros_like(p) for p in candidate.parameters() for _ in range(3)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(candidate,*tensors,paired=True) + loss.backward();assert torch.isfinite(loss) + assert all(p.grad is not None and torch.isfinite(p.grad).all() for p in candidate.parameters()) + keys=['dispersion_query.weight','long_query.weight','long_head.weight','head.weight'] + gradients={k:float(dict(candidate.named_parameters())[k].grad.norm()) for k in keys} + assert all(v>0 for v in gradients.values()) + result=dict(seed=587,gpu_initial_function_bitwise_equal=True,max_shape=[64,4096,1024], + loss=float(loss.detach()),selected_gradient_norms=gradients,all_parameters_trainable=True, + reserved_mib=torch.cuda.max_memory_reserved()/2**20,allocated_mib=torch.cuda.max_memory_allocated()/2**20, + includes_ema_and_adam_placeholders=True,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) + (R/'seasonal_dispersion_gpu_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result));raise SystemExit() + +rng=np.random.default_rng(577) +z=rng.normal(size=(6,128)).astype(np.float32);valid=rng.random(z.shape)>.12 +valid[4]=False;z[5]=0;z[~valid]=0 +periods=np.array([[4,7],[2,3],[12,1],[24,168],[4,8],[4,8]],dtype=np.int64) +delta,extra,dispersion=centered_seasonal_difference(torch.from_numpy(z),torch.from_numpy(valid),torch.from_numpy(periods),29) +old_delta,old_extra=code.centered_seasonal_difference(torch.from_numpy(z),torch.from_numpy(valid),torch.from_numpy(periods),29) +assert torch.equal(delta,old_delta) and torch.equal(extra,old_extra) +expected=np.zeros((6,29,4),dtype=np.float32) +for row in range(6): + for j,period in enumerate(periods[row]): + for t in range(29): + observations,recent=[],[] + for cycle in range(16): + end=max(0,128-cycle*period);start=max(0,128-(cycle+1)*period) + index=128-period+t%period-cycle*period + if index<0 or not valid[row,index]:continue + centered=float(z[row,index])-z[row,start:end][valid[row,start:end]].mean(dtype=np.float64) + observations.append(centered) + if cycle<4:recent.append(centered) + if period>=2 and len(observations)>=8 and len(recent)>=2: + expected[row,t,2*j]=np.log1p(np.std(recent,ddof=1)) + expected[row,t,2*j+1]=np.log1p(np.std(observations,ddof=1)) +assert np.max(np.abs(dispersion.numpy()-expected))<1e-6 +assert torch.isfinite(dispersion).all() and torch.count_nonzero(dispersion[4:])==0 +z0=torch.tensor(rng.normal(size=(1,64)).astype(np.float32));offsets=torch.tensor(rng.normal(size=(1,16,1)).astype(np.float32)) +z1=(z0.view(1,16,4)+offsets).view(1,64);p=torch.tensor([[4,4]]);ones=torch.ones_like(z0,dtype=torch.bool) +v0=centered_seasonal_difference(z0,ones,p,16)[2];v1=centered_seasonal_difference(z1,ones,p,16)[2] +assert torch.max(torch.abs(v0-v1))<1e-6 +for c,h in [(32,6),(128,29),(512,128)]: + ctx=torch.tensor(rng.normal(size=(6,c)).astype(np.float32));ctx[0,:c//3]=float('nan');ctx[1]=0;ctx[2]=float('nan') + with torch.inference_mode():expected=control(ctx,torch.from_numpy(periods),h);actual=candidate(ctx,torch.from_numpy(periods),h) + assert all(torch.equal(v,w) for v,w in zip(expected,actual)) +out=R/'seasonal_dispersion_initial.pt';assert not out.exists() +checkpoint=dict(model=candidate.state_dict(),config=config,step=0,args=dict(packed=str(R/'packed_sample'),seed=577), + parent_checkpoints=[str(parent_path)],conversion=dict(method='zero-initialized phase-specific cycle-centered standard-deviation query', + parent_sha256=hashlib.sha256(parent_path.read_bytes()).hexdigest(),initial_function_bitwise_equal=True)) +torch.save(checkpoint,out) +result=dict(seed=577,independent_feature_arithmetic=True,centered_cycle_offset_invariance=True, + old_features_bitwise_equal=True,initial_function_bitwise_equal=True,inherited_weights_bitwise_equal=True, + all_parameters_trainable=True,sampler_byte_identical=True,added_parameters=candidate.dispersion_query.weight.numel(), + total_parameters=sum(p.numel() for p in candidate.parameters()),checkpoint_sha256=hashlib.sha256(out.read_bytes()).hexdigest(), + seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) +(R/'seasonal_dispersion_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/durability.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/durability.py new file mode 100644 index 0000000000000000000000000000000000000000..41afa5f1fbc5794764bfee688e8e0ae52d2b82e3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/durability.py @@ -0,0 +1,20 @@ +"""E119 final durability and the predeclared conditional E128 transfer12000.""" +import json,os,subprocess,time +from pathlib import Path +R=Path('/workspace/research');start=time.monotonic();receipt=R/'seasonal_dispersion_durability_receipt.json' +state=dict(pid=os.getpid(),status='waiting for final12000 main report',steps=[]) +def save(): + state['seconds']=time.monotonic()-start;tmp=receipt.with_suffix('.tmp');tmp.write_text(json.dumps(state,indent=2));os.replace(tmp,receipt) +def call(label,command): + state['status']=label;save();t=time.monotonic();subprocess.run(command,check=True);state['steps'].append(dict(label=label,seconds=time.monotonic()-t));save() +save() +while not (R/'evals/seasonal_dispersion_ema12000/report.json').exists():time.sleep(3) +time.sleep(1) +call('earlier final cutoffs',['python3',str(R/'evaluate_cutoffs.py'),'--name','seasonal_dispersion_ema12000','--weights',str(R/'runs/seasonal_dispersion/ema012000.pt'),'--evaluator',str(R/'seasonal_dispersion_inference/evaluate.py'),'--cutoffs','1,2,3']) +call('matched final comparison',['python3',str(R/'recovery/matched_report.py'),'--candidate','seasonal_dispersion_ema12000','--control','long_seasonal_ema12000','--label','E119 dispersion12000 durability','--cutoffs','0,1,2,3','--out',str(R/'seasonal_dispersion12k_comparison.json'),'--outcome','Predeclared E12812000 transfer requires at least3of4 positive and positive mean; no coefficient selection.']) +result=json.loads((R/'seasonal_dispersion12k_comparison.json').read_text());state['matched_gate_passed']=result['positive_cutoffs']>=3 and result['mean_delta']>0;save() +if not state['matched_gate_passed']: + state['status']='complete; matched gate failed, no12000 transfer';save();raise SystemExit() +call('fixed matched merge12000',['python3',str(R/'seasonal_dispersion_transfer/merge.py'),'--base',str(R/'long_seasonal_transfer12k.pt'),'--candidate',str(R/'runs/seasonal_dispersion/ema012000.pt'),'--control',str(R/'runs/long_seasonal/ema012000.pt'),'--out',str(R/'seasonal_dispersion_transfer12k.pt')]) +call('fixed12000 standalone and ensemble diagnostics',['python3',str(R/'seasonal_dispersion_transfer/run12.py')]) +state['status']='complete; review ensemble gate';save();print(json.dumps(state),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..4d8da258bf409fff7e3f5f62fa820bf333e9a2f7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/launch.py @@ -0,0 +1,42 @@ +"""Queue E119 after the jointly trained phase-feature comparison finishes.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R = Path('/workspace/research') + checks = json.loads((R/'seasonal_dispersion_checks.json').read_text()) + gpu = json.loads((R/'seasonal_dispersion_gpu_checks.json').read_text()) + assert checks['initial_function_bitwise_equal'] and checks['sampler_byte_identical'] + assert checks['independent_feature_arithmetic'] and checks['all_parameters_trainable'] + assert gpu['gpu_initial_function_bitwise_equal'] and gpu['all_parameters_trainable'] + assert gpu['optimizer_updates'] == 0 and not gpu['validation_data_read'] + name = 'seasonal_dispersion' + run = R/'runs'/name + packed = R/'packed_sample' + env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + command = ['python3', str(R/'recovery/train.py'), '--code-dir', str(R/name), + '--packed', str(packed), '--source-weights-from', str(packed), '--out', str(run), + '--initialize-from', str(R/'seasonal_dispersion_initial.pt'), '--steps', '12000', + '--batch', '64', '--lr', '.00002', '--seed', '197', '--loss-mode', 'paired', + '--stop-file', str(R/(name+'.stop'))] + assert command[command.index('--out')+1] == str(run) + with (R/(name+'_queue.log')).open('w') as qlog, (R/(name+'_watch.log')).open('w') as wlog: + queued = subprocess.Popen(['python3',str(R/'queued_train.py'), + '--label','E119 learned phase-specific dispersion seed197', + '--log',str(R/(name+'_train.log')),'--receipt',str(R/(name+'_queue.json')), + '--wait-pid','16340','--require-checkpoint',str(R/'runs/phase_joint/ema012000.pt'), + '--',*command], stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch = subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(run), + '--evaluator',str(R/'seasonal_dispersion_inference/evaluate.py'),'--name',name, + '--expected-packed',str(packed),'--steps','1000,3000,6000,12000'], + stdout=wlog,stderr=subprocess.STDOUT,env=env) + print(json.dumps({'queue_pid':queued.pid,'watch_pid':watch.pid}),flush=True) + result = queued.wait() + if result: + watch.terminate() + watch.wait() + raise SystemExit(result) + +if __name__ == '__main__': + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/model.py new file mode 100644 index 0000000000000000000000000000000000000000..79839282b194492635d02db0867c0db60200ee03 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_dispersion/model.py @@ -0,0 +1,268 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras, dispersion = [], [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + variance4 = (((values[:4] - mean4).square() * seen[:4]).sum(0) / (n4 - 1).clamp(min=1)) + variance16 = (((values - mean16).square() * seen).sum(0) / (n16 - 1).clamp(min=1)) + dispersion.extend([torch.where(active, variance4.sqrt().log1p(), 0.), + torch.where(active, variance16.sqrt().log1p(), 0.)]) + return torch.stack(deltas, -1), torch.stack(extras, -1), torch.stack(dispersion, -1) + + + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,long_seasonal_features=True,seasonal_dispersion_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,long_seasonal_features=long_seasonal_features,seasonal_dispersion_features=seasonal_dispersion_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + self.long_query=nn.Linear(patch*4,d,bias=False) if long_seasonal_features else None + self.long_head=nn.Linear(d,patch*2) if long_seasonal_features else None + if long_seasonal_features: + nn.init.zeros_(self.long_query.weight) + nn.init.zeros_(self.long_head.weight);nn.init.zeros_(self.long_head.bias) + assert long_seasonal_features or not seasonal_dispersion_features + self.dispersion_query=nn.Linear(patch*4,d,bias=False) if seasonal_dispersion_features else None + if self.dispersion_query is not None:nn.init.zeros_(self.dispersion_query.weight) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + if self.long_query is not None:long_delta,long_extra,dispersion_extra=centered_seasonal_difference(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + hidden=self.norm(q) + out=self.head(hidden).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + if self.long_head is not None: + gates=self.long_head(hidden).view(b,h,2).float().tanh() + median=median+(gates*long_delta).sum(-1) + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/check.py new file mode 100644 index 0000000000000000000000000000000000000000..a7fc656ca584892be9a9602177757199b5d2004f --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/check.py @@ -0,0 +1,84 @@ +"""E129 unchanged initialization and direct bounded-width arithmetic checks.""" +import argparse,hashlib,importlib.util,json,math,sys,time +from pathlib import Path +import numpy as np +import torch +R=Path('/workspace/research');sys.path.insert(0,str(R/'seasonal_width')) +from model import DirectForecaster,centered_seasonal_difference,seasonal_width_multiplier,loss_fn +from data import Sampler +ap=argparse.ArgumentParser();ap.add_argument('--gpu',action='store_true');a=ap.parse_args() +torch.set_num_threads(2);torch.manual_seed(661);started=time.monotonic() +spec=importlib.util.spec_from_file_location('seasonal_width_control',R/'seasonal_dispersion/model.py');code=importlib.util.module_from_spec(spec);spec.loader.exec_module(code) +parent_path=R/'seasonal_dispersion_initial.pt';parent=torch.load(parent_path,map_location='cpu',weights_only=False) +config=dict(parent['config'],seasonal_width_features=True) +candidate=DirectForecaster(**config);missing,unexpected=candidate.load_state_dict(parent['model'],strict=False) +assert set(missing)=={'width_head.weight','width_head.bias'} and not unexpected +assert all(torch.count_nonzero(candidate.state_dict()[k])==0 for k in missing) +assert all(torch.equal(v,candidate.state_dict()[k]) for k,v in parent['model'].items()) +assert all(p.requires_grad for p in candidate.parameters()) +assert (R/'seasonal_width/data.py').read_bytes()==(R/'seasonal_dispersion/data.py').read_bytes() +assert (R/'seasonal_width/model.py').read_bytes()==(R/'seasonal_width_inference/model.py').read_bytes() +control=code.DirectForecaster(**parent['config']);control.load_state_dict(parent['model']) +if a.gpu: + import fcntl + lock=open(R/'.evaluation.lock','a');tick=time.monotonic();fcntl.flock(lock,fcntl.LOCK_EX);wait=time.monotonic()-tick + torch.backends.cuda.matmul.allow_tf32=False + candidate,control=candidate.cuda(),control.cuda();rng=np.random.default_rng(673) + ctx=torch.tensor(rng.normal(size=(8,512)).astype(np.float32),device='cuda');ctx[0,:23]=float('nan');ctx[1]=0 + periods=torch.tensor([[24,168],[7,365],[12,1],[52,1],[4,1],[1,1],[96,672],[2,14]],device='cuda') + target=torch.tensor(rng.normal(size=(8,128)).astype(np.float32),device='cuda') + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16): + expected=control(ctx,periods,128);actual=candidate(ctx,periods,128) + loss0=code.loss_fn(control,ctx,target,periods,paired=True);loss1=loss_fn(candidate,ctx,target,periods,paired=True) + assert all(torch.equal(v,w) for v,w in zip(expected,actual)) and torch.equal(loss0,loss1) + del control,ctx,target,periods,expected,actual,loss0,loss1 + torch.cuda.empty_cache();torch.cuda.reset_peak_memory_stats();free_before=torch.cuda.mem_get_info()[0]/2**20 + sampler=Sampler(R/'packed_sample',seed=673,source_weights_from=R/'packed_sample') + tensors=[torch.from_numpy(v).cuda() for v in sampler.sample(64,4096,1024)] + placeholders=[torch.zeros_like(p) for p in candidate.parameters() for _ in range(3)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(candidate,*tensors,paired=True) + loss.backward();assert torch.isfinite(loss) + assert all(p.grad is not None and torch.isfinite(p.grad).all() for p in candidate.parameters()) + gradients={k:float(dict(candidate.named_parameters())[k].grad.norm()) for k in ['width_head.weight','width_head.bias','dispersion_query.weight','long_head.weight','head.weight']} + assert all(v>0 for v in gradients.values()) + result=dict(seed=673,gpu_initial_function_bitwise_equal=True,gpu_initial_loss_bitwise_equal=True,max_shape=[64,4096,1024],loss=float(loss.detach()),selected_gradient_norms=gradients,all_parameters_trainable=True,reserved_mib=torch.cuda.max_memory_reserved()/2**20,allocated_mib=torch.cuda.max_memory_allocated()/2**20,free_before_mib=free_before,includes_ema_and_adam_placeholders=True,lock_wait_seconds=wait,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) + (R/'seasonal_width_gpu_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result));raise SystemExit() +rng=np.random.default_rng(661);z=rng.normal(size=(6,128)).astype(np.float32);valid=rng.random(z.shape)>.12;valid[4]=False;z[5]=0;z[~valid]=0 +periods=np.array([[4,7],[2,3],[12,1],[24,168],[4,8],[4,8]],dtype=np.int64) +tensors=[torch.from_numpy(x) for x in [z,valid,periods]] +actual=centered_seasonal_difference(*tensors,29);old=code.centered_seasonal_difference(*tensors,29) +assert all(torch.equal(v,w) for v,w in zip(actual[:3],old)) +expected=np.zeros((6,29,2),dtype=np.float32) +for row in range(6): + for j,period in enumerate(periods[row]): + for t in range(29): + observations=[];recent=0 + for cycle in range(16): + end=max(0,128-cycle*period);start=max(0,128-(cycle+1)*period);index=128-period+t%period-cycle*period + if index<0 or not valid[row,index]:continue + observations.append(float(z[row,index])-z[row,start:end][valid[row,start:end]].mean(dtype=np.float64)) + if cycle<4:recent+=1 + if period>=2 and len(observations)>=8 and recent>=2:expected[row,t,j]=np.log1p(np.std(observations,ddof=1))-np.log(2.) +assert np.max(np.abs(actual[3].numpy()-expected))<1e-6 +assert torch.count_nonzero(actual[3][4])==0 and torch.all(actual[3][5]==-math.log(2.)) +raw=rng.normal(size=expected.shape).astype(np.float32)*30 +factor=seasonal_width_multiplier(torch.from_numpy(raw),actual[3]).numpy() +reference=np.exp(np.clip((np.tanh(raw)*expected).sum(-1),-np.log(4.),np.log(4.))) +assert np.max(np.abs(factor-reference))<1e-6 and np.all((factor>=.25)&(factor<=4)) +for c,h in [(32,6),(128,29),(512,128)]: + ctx=torch.tensor(rng.normal(size=(6,c)).astype(np.float32));ctx[0,:c//3]=float('nan');ctx[1]=0;ctx[2]=float('nan') + with torch.inference_mode():q0,mu0,s0=control(ctx,torch.from_numpy(periods),h);q1,mu1,s1=candidate(ctx,torch.from_numpy(periods),h) + assert torch.equal(q0,q1) and torch.equal(mu0,mu1) and torch.equal(s0,s1) + with torch.no_grad():candidate.width_head.bias.view(16,2)[:]=torch.tensor([2.,-.7]) + with torch.inference_mode():q2,_,_=candidate(ctx,torch.from_numpy(periods),h) + zz,v,_,_=candidate.standardize(ctx);wd=centered_seasonal_difference(zz,v,torch.from_numpy(periods),h)[3] + multiplier=seasonal_width_multiplier(torch.tensor([2.,-.7]).expand(6,h,2),wd) + wanted=q0[:,:,4,None]+(q0-q0[:,:,4,None])*multiplier[:,:,None] + assert torch.max(torch.abs(q2-wanted))<2e-6 and torch.equal(q0[:,:,4],q2[:,:,4]) + assert torch.isfinite(q2).all() and torch.all(q2[:,:,1:]>=q2[:,:,:-1]) + with torch.no_grad():candidate.width_head.bias.zero_() +out=R/'seasonal_width_initial.pt';assert not out.exists() +checkpoint=dict(model=candidate.state_dict(),config=config,step=0,args=dict(packed=str(R/'packed_sample'),seed=661),parent_checkpoints=[str(parent_path)],conversion=dict(method='zero-initialized direct seasonal width head',parent_sha256=hashlib.sha256(parent_path.read_bytes()).hexdigest(),initial_function_bitwise_equal=True)) +torch.save(checkpoint,out) +result=dict(seed=661,initial_function_bitwise_equal=True,inherited_features_and_weights_bitwise_equal=True,independent_width_arithmetic=True,bounded_multiplier=[.25,4.],unchanged_median_for_fixed_hidden=True,finite_ordered=True,sampler_byte_identical=True,all_parameters_trainable=True,added_parameters=sum(v.numel() for v in candidate.width_head.parameters()),total_parameters=sum(p.numel() for p in candidate.parameters()),checkpoint_sha256=hashlib.sha256(out.read_bytes()).hexdigest(),seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) +(R/'seasonal_width_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..4ab2570be7d55f94acc25ee268dd91c2e1f0f6cb --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/launch.py @@ -0,0 +1,42 @@ +"""Queue E129 after the older-history seasonal comparison finishes.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R = Path('/workspace/research') + checks = json.loads((R/'seasonal_width_checks.json').read_text()) + gpu = json.loads((R/'seasonal_width_gpu_checks.json').read_text()) + assert checks['initial_function_bitwise_equal'] and checks['sampler_byte_identical'] + assert checks['independent_width_arithmetic'] and checks['all_parameters_trainable'] + assert gpu['gpu_initial_function_bitwise_equal'] and gpu['all_parameters_trainable'] + assert gpu['optimizer_updates'] == 0 and not gpu['validation_data_read'] + name = 'seasonal_width' + run = R/'runs'/name + packed = R/'packed_sample' + env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + command = ['python3', str(R/'recovery/train.py'), '--code-dir', str(R/name), + '--packed', str(packed), '--source-weights-from', str(packed), '--out', str(run), + '--initialize-from', str(R/'seasonal_width_initial.pt'), '--steps', '12000', + '--batch', '64', '--lr', '.00002', '--seed', '197', '--loss-mode', 'paired', + '--stop-file', str(R/(name+'.stop'))] + assert command[command.index('--out')+1] == str(run) + with (R/(name+'_queue.log')).open('w') as qlog, (R/(name+'_watch.log')).open('w') as wlog: + queued = subprocess.Popen(['python3',str(R/'queued_train.py'), + '--label','E129 direct learned seasonal uncertainty head seed197', + '--log',str(R/(name+'_train.log')),'--receipt',str(R/(name+'_queue.json')), + '--wait-pid','20306','--require-checkpoint',str(R/'runs/seasonal_history/ema012000.pt'), + '--',*command], stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch = subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(run), + '--evaluator',str(R/'seasonal_width_inference/evaluate.py'),'--name',name, + '--expected-packed',str(packed),'--steps','1000,3000,6000,12000'], + stdout=wlog,stderr=subprocess.STDOUT,env=env) + print(json.dumps({'queue_pid':queued.pid,'watch_pid':watch.pid}),flush=True) + result = queued.wait() + if result: + watch.terminate() + watch.wait() + raise SystemExit(result) + +if __name__ == '__main__': + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/model.py new file mode 100644 index 0000000000000000000000000000000000000000..0fb76d7fe91edd7ea32a5e4cf8ea092b570edcfe --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width/model.py @@ -0,0 +1,279 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras, dispersion, width_deltas = [], [], [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + variance4 = (((values[:4] - mean4).square() * seen[:4]).sum(0) / (n4 - 1).clamp(min=1)) + variance16 = (((values - mean16).square() * seen).sum(0) / (n16 - 1).clamp(min=1)) + width_deltas.append(torch.where(active, variance16.sqrt().log1p() - math.log(2.), 0.)) + dispersion.extend([torch.where(active, variance4.sqrt().log1p(), 0.), + torch.where(active, variance16.sqrt().log1p(), 0.)]) + return torch.stack(deltas, -1), torch.stack(extras, -1), torch.stack(dispersion, -1), torch.stack(width_deltas, -1) + + + +def seasonal_width_multiplier(raw, delta): + return ((raw.float().tanh() * delta).sum(-1).clamp(-math.log(4.), math.log(4.))).exp() + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,long_seasonal_features=True,seasonal_dispersion_features=True,seasonal_width_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,long_seasonal_features=long_seasonal_features,seasonal_dispersion_features=seasonal_dispersion_features,seasonal_width_features=seasonal_width_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + self.long_query=nn.Linear(patch*4,d,bias=False) if long_seasonal_features else None + self.long_head=nn.Linear(d,patch*2) if long_seasonal_features else None + if long_seasonal_features: + nn.init.zeros_(self.long_query.weight) + nn.init.zeros_(self.long_head.weight);nn.init.zeros_(self.long_head.bias) + assert long_seasonal_features or not seasonal_dispersion_features + self.dispersion_query=nn.Linear(patch*4,d,bias=False) if seasonal_dispersion_features else None + if self.dispersion_query is not None:nn.init.zeros_(self.dispersion_query.weight) + assert seasonal_dispersion_features or not seasonal_width_features + self.width_head=nn.Linear(d,patch*2) if seasonal_width_features else None + if self.width_head is not None: + nn.init.zeros_(self.width_head.weight);nn.init.zeros_(self.width_head.bias) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + if self.long_query is not None:long_delta,long_extra,dispersion_extra,width_delta=centered_seasonal_difference(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + hidden=self.norm(q) + out=self.head(hidden).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + if self.long_head is not None: + gates=self.long_head(hidden).view(b,h,2).float().tanh() + median=median+(gates*long_delta).sum(-1) + widths=F.softplus(out[:,:,10:]).clamp(max=20) + if self.width_head is not None: + multiplier=seasonal_width_multiplier(self.width_head(hidden).view(b,h,2),width_delta) + widths=widths*multiplier[:,:,None] + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/assemble.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/assemble.py new file mode 100644 index 0000000000000000000000000000000000000000..91bcb5ee6127595d7a2a32cfca638ebd8f2b533d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/assemble.py @@ -0,0 +1,12 @@ +"""Assemble only a width-treatment candidate that passed its declared diagnostics.""" +import argparse,json,subprocess +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser();ap.add_argument('--duration',type=int,choices=[6,12],required=True);a=ap.parse_args();d=a.duration +selection=json.loads((R/'seasonal_width_transfer_receipt.json').read_text());result=next(v for v in selection['results'] if v['duration']==d);assert result['selection_gate_passed'] and result['positive_cutoffs']>=3 and result['mean_delta']>0 +command=['python3',str(R/'publish_full_paired.py'),'--weights',str(R/f'seasonal_width_transfer{d}k.pt'),'--report',str(R/'evals'/f'seasonal_width_transfer{d}k/report.json'),'--runtime-dir',str(R/'seasonal_width_inference'),'--out',str(R/f'candidate-width-transfer{d}k')] +for name in ['postloss','long_memory_synth','overflow_control','weekly_synth','spectral_synth','spectral_transfer','long_seasonal','seasonal_dispersion','seasonal_width','seasonal_width_transfer']:command+=['--extra-training-code',name] +subprocess.run(command,check=True) +command=['python3',str(R/'four_member_ensemble/publish.py')] +for name in [f'candidate-width-transfer{d}k','candidate-patch8-6k-complete','candidate-split-patch-12k-complete','candidate-fresh146m-48k']:command+=['--member',str(R/name)] +command+=['--out',str(R/f'candidate-width{d}-ensemble')];subprocess.run(command,check=True) +subprocess.run(['python3',str(R/'seasonal_width_transfer/validate.py'),'--duration',str(d)],check=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/check_runtime.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/check_runtime.py new file mode 100644 index 0000000000000000000000000000000000000000..0b4b2787b2b3367603c9c0df2a5c7fc73a91988b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/check_runtime.py @@ -0,0 +1,23 @@ +"""New width member and quartet replay against unchanged E130 synthetic inputs/members.""" +import argparse,fcntl,hashlib,json,shutil,subprocess,sys,time +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation');from ts_io import read_prediction_file +R=Path('/workspace/research');ap=argparse.ArgumentParser();ap.add_argument('--duration',type=int,choices=[6,12],required=True);a=ap.parse_args();started=time.monotonic() +root=R/f'width{a.duration}_fixture';reference=R/'fresh_capacity4_fixture';package=R/f'candidate-width{a.duration}-ensemble';member=R/f'candidate-width-transfer{a.duration}k' +root.mkdir(exist_ok=True);shutil.copytree(reference/'input',root/'input',dirs_exist_ok=True) +for p in (root/'input').rglob('*'): + if p.is_file():assert hashlib.sha256(p.read_bytes()).digest()==hashlib.sha256((reference/'input'/p.relative_to(root/'input')).read_bytes()).digest() +descriptor=json.loads((package/'config.json').read_text());control=json.loads((R/'candidate-fresh-capacity4-ensemble/config.json').read_text());assert descriptor['members'][1:]==control['members'][1:] +lock=open(R/'.evaluation.lock','a');fcntl.flock(lock,fcntl.LOCK_EX) +for label,source,asset in [('standalone0',member,'weights.pt'),('ensemble',package,'config.json')]: + with (root/(label+'.log')).open('w') as log:subprocess.run(['python3',str(source/'predict.py'),str(root/'input'),str(root/label),'--weights',str(source/asset),'--batch','4'],stdout=log,stderr=subprocess.STDOUT,check=True) +rows=[] +for cfg in json.loads((root/'input/index.json').read_text())['configs']: + cid=cfg['config_id'];_,expected=read_prediction_file(root/'standalone0/cases'/(cid+'.h5'));expected=expected.copy() + for i in range(1,4):expected+=read_prediction_file(reference/f'standalone{i}/cases'/(cid+'.h5'))[1] + expected/=4;mean,actual=read_prediction_file(root/'ensemble/cases'/(cid+'.h5')) + assert np.array_equal(expected,actual) and np.array_equal(mean,actual[:,:,4]) and np.isfinite(actual).all() and np.all(np.diff(actual,axis=2)>=0) + rows.append(dict(config_id=cid,instances=cfg['n_instances'],bitwise_composition=True,finite_ordered=True)) +result=dict(duration=a.duration,descriptor_sha256=hashlib.sha256((package/'config.json').read_bytes()).hexdigest(),members=[v['weights_sha256'] for v in descriptor['members']],checks=rows,unchanged_member_references_reused=str(reference),input_files_bitwise_identical=True,seconds=time.monotonic()-started) +(R/f'width{a.duration}_runtime_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..04b124b615cfba7243c3d938b8d7540bf3d2c01c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/merge.py @@ -0,0 +1,32 @@ +"""E139 transfer only the width-treatment difference, with two distinct zero extensions.""" +import argparse,hashlib,importlib.util,json,sys,time +from pathlib import Path +import numpy as np +import torch +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['base','candidate','control','out']:ap.add_argument('--'+key,required=True) +a=ap.parse_args();torch.set_num_threads(2);torch.manual_seed(769);started=time.monotonic() +paths=[Path(a.base),Path(a.candidate),Path(a.control)];base,candidate,control=[torch.load(p,map_location='cpu',weights_only=False) for p in paths] +base_extra={'dispersion_query.weight','width_head.weight','width_head.bias'};control_extra={'width_head.weight','width_head.bias'} +assert set(candidate['model'])==set(base['model'])|base_extra==set(control['model'])|control_extra +c=dict(candidate['config']);assert c.pop('seasonal_width_features') is True;assert c==control['config'];assert c.pop('seasonal_dispersion_features') is True;assert c==base['config'] +sys.path.insert(0,str(R/'seasonal_width'));from model import DirectForecaster +extended=DirectForecaster(**candidate['config']);missing,unexpected=extended.load_state_dict(base['model'],strict=False) +assert set(missing)==base_extra and not unexpected and all(torch.count_nonzero(extended.state_dict()[k])==0 for k in base_extra) +spec=importlib.util.spec_from_file_location('width_transfer_base',R/'long_seasonal/model.py');module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) +original=module.DirectForecaster(**base['config']);original.load_state_dict(base['model']);rng=np.random.default_rng(769);periods=torch.tensor([[24,168],[7,365],[52,1],[1,1]]) +for c,h in [(32,6),(512,128)]: + ctx=torch.tensor(rng.normal(size=(4,c)).astype(np.float32));ctx[0,:c//3]=float('nan');ctx[1]=0;ctx[2]=float('nan') + with torch.inference_mode():left=original(ctx,periods,h);right=extended(ctx,periods,h) + assert all(torch.equal(v,w) for v,w in zip(left,right)) +weights={k:v.clone() for k,v in extended.state_dict().items()} +for k in weights: + if k in control_extra:weights[k].copy_(candidate['model'][k]) + else:weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values());extended.load_state_dict(weights) +with torch.inference_mode():quant,mu,scale=extended(ctx,periods,128) +assert torch.isfinite(quant).all() and torch.all(quant[:,:,1:]>=quant[:,:,:-1]) +out=Path(a.out);assert not out.exists() +conversion=dict(method='matched direct-width-head training delta, separately zero-extending base and control',formula='zero_extend(E117first)+E129-zero_extend(E119)',coefficient=1.,base_zero_parameters=sorted(base_extra),control_zero_parameters=sorted(control_extra),dispersion_query='candidate-minus-control only; no E128 correction',parent_hashes={str(p):hashlib.sha256(p.read_bytes()).hexdigest() for p in paths},base_extension_forward_bitwise_equal=True,finite_ordered_fixture=True,check_seed=769,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) +ck=dict(model=weights,config=candidate['config'],step=0,args=dict(packed=base['args']['packed']),parent_checkpoints=[str(p) for p in paths],conversion=conversion);torch.save(ck,out) +result=dict(conversion,checkpoint_sha256=hashlib.sha256(out.read_bytes()).hexdigest(),parameters=sum(v.numel() for v in weights.values()));out.with_suffix('.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/run.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/run.py new file mode 100644 index 0000000000000000000000000000000000000000..9f35156c37f33a35c2e6005cbfae1e6de2676101 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/run.py @@ -0,0 +1,36 @@ +"""E139 fixed width-treatment transfers at primary6k and conditional12k durability.""" +import datetime,hashlib,json,os,subprocess,time +from pathlib import Path +R=Path('/workspace/research');start=time.monotonic();receipt=R/'seasonal_width_transfer_receipt.json' +state=dict(pid=os.getpid(),status='running',steps=[],results=[],started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) +def save(): + state['seconds']=time.monotonic()-start;tmp=receipt.with_suffix('.tmp');tmp.write_text(json.dumps(state,indent=2));os.replace(tmp,receipt) +def call(label,command): + state['status']=label;save();t=time.monotonic();result=subprocess.run(command);state['steps'].append(dict(label=label,returncode=result.returncode,seconds=time.monotonic()-t));save() + if result.returncode:state['status']='failed';save();raise SystemExit(result.returncode) +for duration in [6,12]: + step=duration*1000;comparison=R/f'seasonal_width{duration}k_four_cutoff_comparison.json';state['status']='waiting matched width gate'+str(duration);save() + while not comparison.exists():time.sleep(3) + time.sleep(1);d=json.loads(comparison.read_text());assert d['candidate']==f'seasonal_width_ema{step}' and d['control']==f'seasonal_dispersion_ema{step}' + if d['positive_cutoffs']<3 or d['mean_delta']<=0: + state['status']='complete; matched source gate failed'+str(duration);save() + with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\nE139source gate failed for'+str(duration)+'k; no additional transfer constructed. '+json.dumps(state)+'\n') + raise SystemExit() + name=f'seasonal_width_transfer{duration}k';weights=R/(name+'.pt') + if not weights.exists():call('literal matched merge'+str(duration),['python3',str(R/'seasonal_width_transfer/merge.py'),'--base',str(R/'long_seasonal_transfer12k.pt'),'--candidate',str(R/'runs/seasonal_width'/f'ema{step:06d}.pt'),'--control',str(R/'runs/seasonal_dispersion'/f'ema{step:06d}.pt'),'--out',str(weights)]) + merge=json.loads(weights.with_suffix('.json').read_text());assert hashlib.sha256(weights.read_bytes()).hexdigest()==merge['checkpoint_sha256'] + for parent,digest in merge['parent_hashes'].items():assert hashlib.sha256(Path(parent).read_bytes()).hexdigest()==digest + call('first member four cutoffs'+str(duration),['python3',str(R/'evaluate_cutoffs.py'),'--name',name,'--weights',str(weights),'--evaluator',str(R/'seasonal_width_inference/evaluate.py')]) + rows=[] + for cutoff,folder in [('valid_screen','evals'),('valid_backcast','backcast_evals'),('valid_backcast2','backcast2_evals'),('valid_backcast3','backcast3_evals')]: + call('record first '+str(duration)+' '+cutoff,['python3',str(R/'direct_v1/record.py'),str(R/folder/name/'report.json'),'--label',f'E139 width-treatment transfer{step} '+cutoff,'--outcome','Fixed zero-extended E117first + E129 - zero-extended E119, coefficient1. No E128dispersion correction; no optimizer update. Equal-quarter ensemble selected separately.']) + out=R/(f'width{duration}_ensemble_'+cutoff+'.json');command=['python3',str(R/'equal_ensemble_probe.py'),'--valid',str(R/cutoff),'--out',str(out)] + for member in [name,'patch8_ema6000','split_patch_ema12000','random_capacity_1024_ema48000']:command+=['--pred',str(R/folder/member)] + call('fixed equal quarters '+str(duration)+' '+cutoff,command) + a=json.loads(out.read_text());b=json.loads((R/('fresh_capacity4_ensemble_'+cutoff+'.json')).read_text()) + rows.append(dict(cutoff=cutoff,skill=a['skill_score'],control_skill=b['skill_score'],delta=a['skill_score']-b['skill_score'],groups=a['groups'],member_checkpoint_hashes=a['member_checkpoint_hashes'],cpu_seconds=a['cpu_seconds'])) + result=dict(duration=duration,rows=rows,positive_cutoffs=sum(v['delta']>0 for v in rows),mean_delta=sum(v['delta'] for v in rows)/4) + result['selection_gate_passed']=result['positive_cutoffs']>=3 and result['mean_delta']>0 + state['results'].append(result);save() + with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\nE139 fixed width-treatment equal-quarter ensemble diagnostics: '+json.dumps(result)+'. Full replay/runtime checks and comparison to current publication required before any promotion.\n') +state['status']='complete; research review required';save();print(json.dumps(state),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/validate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/validate.py new file mode 100644 index 0000000000000000000000000000000000000000..1cc073a620db92b2d7b1c3c564834d5ecf95f8ef --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/seasonal_width_transfer/validate.py @@ -0,0 +1,13 @@ +"""Full public replay and independent composition for E139; no automatic promotion.""" +import argparse,json,subprocess,time +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser();ap.add_argument('--duration',type=int,choices=[6,12],required=True);a=ap.parse_args();d=a.duration;started=time.monotonic() +package=R/f'candidate-width{d}-ensemble';report=R/f'valid-report-width{d}-ensemble.json';pred=R/f'valid-pred-width{d}-ensemble';firstpred=R/f'composition-pred-width-transfer{d}k';receipt=R/f'width{d}_ensemble_validation_receipt.json' +steps=[('synthetic_composition',['python3',str(R/'seasonal_width_transfer/check_runtime.py'),'--duration',str(d)]),('relocation',['python3',str(R/'verify_package_examples.py'),'--package',str(package),'--receipt',str(R/f'width{d}_ensemble_package_checks.json')]),('full_public_replay',['python3',str(R/'run_package_validation.py'),'--package',str(package),'--out',str(pred),'--report',str(report)]),('independent_first_member',['python3',str(R/'run_composition_member.py'),'--package',str(R/f'candidate-width-transfer{d}k'),'--out',str(firstpred),'--receipt',str(R/f'width{d}_composition_replay.json')]),('composition',['python3',str(R/'check_ensemble_composition.py'),'--pred',str(pred),'--member',str(firstpred),'--member',str(R/'valid-pred-patch8-6k'),'--member',str(R/'composition-pred-split-patch-12k'),'--member',str(R/'composition-pred-fresh146m48'),'--out',str(R/f'width{d}_ensemble_composition_checks.json')]),('descriptive_comparison',['python3',str(R/'compare_reports.py'),'--candidate',str(report),'--parent',str(R/'valid-report-fresh-capacity4-ensemble.json'),'--out',str(R/f'width{d}_ensemble_comparison.json')])] +state=dict(package=str(package),status='running',steps=[]) +for label,command in steps: + state['current_step']=label;receipt.write_text(json.dumps(state,indent=2));tick=time.monotonic();result=subprocess.run(command);state['steps'].append(dict(name=label,returncode=result.returncode,seconds=time.monotonic()-tick)) + if result.returncode: + state.update(status='failed',seconds=time.monotonic()-started);receipt.write_text(json.dumps(state,indent=2));raise SystemExit(result.returncode) +r=json.loads(report.read_text());assert r['n_failed']==0 and r['n_configs']==97 and r['n_instances']==151170 +state.update(status='complete',seconds=time.monotonic()-started,skill=r['skill_score']);receipt.write_text(json.dumps(state,indent=2));print(json.dumps(state),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/check.py new file mode 100644 index 0000000000000000000000000000000000000000..18b155db82902843efdf6df4164d5ed87f249a47 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/check.py @@ -0,0 +1,79 @@ +"""Check spectral covariance and unchanged control streams without validation data.""" +import copy +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path + +import numpy as np + +R = Path('/workspace/research') +sys.path.insert(0, str(R / 'spectral_synth')) +from data import Sampler +from spectral import gaussian_residual, spectral_density + +spec = importlib.util.spec_from_file_location('spectral_control_data', R / 'overflow_control/data.py') +control_code = importlib.util.module_from_spec(spec) +spec.loader.exec_module(control_code) +started = time.monotonic() +seed = 499 +candidate = Sampler(R / 'packed_sample', seed=seed, source_weights_from=R / 'packed_sample') +control = control_code.Sampler(R / 'packed_sample', seed=seed, source_weights_from=R / 'packed_sample') +rng = np.random.default_rng(seed) +rows = synthetic_rows = replaced_rows = 0 +for _ in range(120): + c = int(rng.choice([512, 1024, 2048, 4096])) + h = int(rng.choice([32, 128, 512, 1024])) + expected = control.sample(64, c, h) + actual = candidate.sample(64, c, h) + replacements = np.array(candidate.last_spectral_rows, dtype=int) + unchanged = np.ones(64, dtype=bool) + unchanged[replacements] = False + for x, y in zip(expected, actual): + assert np.array_equal(x[unchanged], y[unchanged], equal_nan=True) + assert set(replacements) <= set(candidate.last_synthetic_rows) + assert np.array_equal(expected[2], actual[2]) + for x, y in zip(expected[:2], actual[:2]): + assert np.array_equal(np.isfinite(x), np.isfinite(y)) + assert candidate.rng.bit_generator.state == control.rng.bit_generator.state + assert candidate.horizon_rng.bit_generator.state == control.horizon_rng.bit_generator.state + rows += 64 + synthetic_rows += len(candidate.last_synthetic_rows) + replaced_rows += len(replacements) +sampler_seconds = time.monotonic() - started +states = {n: copy.deepcopy(v.bit_generator.state) for n, v in vars(candidate).items() + if isinstance(v, np.random.Generator)} +next_batch = candidate.sample(64, 4096, 1024) +for name, state in states.items(): + getattr(candidate, name).bit_generator.state = state +replayed = candidate.sample(64, 4096, 1024) +assert all(np.array_equal(x, y, equal_nan=True) for x, y in zip(next_batch, replayed)) + +covariances = [] +for family in range(4): + values = np.stack([gaussian_residual(512, rng, length_scale=8, family=family) + for _ in range(1024)]) + expected = np.fft.irfft(spectral_density(2048, 8, family), n=2048) + observed = [float(np.mean(values * values))] + observed += [float(np.mean(values[:, lag:] * values[:, :-lag])) for lag in [1, 8, 32]] + wanted = expected[[0, 1, 8, 32]] + assert np.max(np.abs(np.array(observed) - wanted)) < .045 + covariances.append(dict(family=family, observed=observed, theoretical=wanted.tolist())) +for family in range(4): + for n in [8, 40, 5120]: + for scale in [1., 1e4]: + assert np.isfinite(gaussian_residual(n, rng, scale, family)).all() +model_hash = hashlib.sha256((R / 'spectral_synth/model.py').read_bytes()).hexdigest() +assert model_hash == hashlib.sha256((R / 'overflow_control/model.py').read_bytes()).hexdigest() +result = dict(seed=seed, rows=rows, original_synthetic_rows=synthetic_rows, + replaced_spectral_rows=replaced_rows, probability=.5, + original_and_horizon_rng_bitwise_preserved=True, + unmodified_rows_bitwise_preserved=True, periods_and_finite_masks_unchanged=True, + all_numpy_rng_recovery_exact=True, model_sha256=model_hash, + model_bitwise_unchanged=True, covariance_checks=covariances, + sampler_comparison_seconds=sampler_seconds, seconds=time.monotonic()-started, + optimizer_updates=0, validation_data_read=False) +(R / 'spectral_synth_checks.json').write_text(json.dumps(result, indent=2)) +print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..bf91f33740715be702c2772f3cca89b656cea4dc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/data.py @@ -0,0 +1,102 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq +from spectral import gaussian_residual + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + if self.spectral_rng.random()8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + self.spectral_rng=np.random.default_rng(seed+1100003) + self.spectral_probability=.5 + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..0134693b620294a3fb18eed15e107d649a0cc487 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/launch.py @@ -0,0 +1,29 @@ +"""Queue spectral synthetic residuals after postloss completion finishes.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + checks=json.loads((R/'spectral_synth_checks.json').read_text()) + assert checks['original_and_horizon_rng_bitwise_preserved'] and checks['unmodified_rows_bitwise_preserved'] + assert checks['all_numpy_rng_recovery_exact'] and checks['model_bitwise_unchanged'] + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'spectral_synth'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/spectral_synth'),'--initialize-from',str(R/'horizon_delta12k.pt'), + '--steps','12000','--batch','64','--lr','.00002','--seed','197','--loss-mode','paired', + '--stop-file',str(R/'spectral_synth.stop')] + with (R/'spectral_synth_queue.log').open('w') as qlog,(R/'spectral_synth_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E106 spectral synthetic residuals seed197', + '--log',str(R/'spectral_synth_train.log'),'--receipt',str(R/'spectral_synth_queue.json'), + '--wait-pid','10664','--require-checkpoint',str(R/'runs/postloss_completion/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/spectral_synth'), + '--evaluator',str(R/'postloss_inference/evaluate.py'),'--name','spectral_synth', + '--expected-packed',str(R/'packed_sample'),'--steps','1000,3000,6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/spectral.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/spectral.py new file mode 100644 index 0000000000000000000000000000000000000000..f7358c3ec944849ea619ef2e73697775b48d408c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_synth/spectral.py @@ -0,0 +1,27 @@ +"""Locally generated finite stationary Gaussian fields with varied smoothness.""" +import numpy as np + + +def spectral_density(size, length_scale, family): + omega = 2 * np.pi * np.fft.rfftfreq(size) + if family == 3: + density = np.exp(-.5 * (length_scale * omega) ** 2) + else: + nu = [.5, 1.5, 2.5][family] + density = (1 + (length_scale * omega) ** 2 / (2 * nu)) ** (-nu - .5) + # Real FFT has one DC and one Nyquist coefficient, two of each interior bin. + variance = (density[0] + density[-1] + 2 * density[1:-1].sum()) / size + return density / variance + + +def gaussian_residual(n, rng, length_scale=None, family=None): + """The covariance is the discrete inverse Fourier transform of the declared PSD.""" + if length_scale is None: + length_scale = 10 ** rng.uniform(0, 4) + if family is None: + family = int(rng.integers(4)) + size = 1 << (max(16, 4 * n) - 1).bit_length() + density = spectral_density(size, length_scale, family) + white = rng.normal(size=size) + field = np.fft.irfft(np.fft.rfft(white) * np.sqrt(density), n=size) + return field[:n].astype(np.float32) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_transfer/run.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_transfer/run.py new file mode 100644 index 0000000000000000000000000000000000000000..b12c03e56acc3688932c441fd31aa259136f1bc1 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/spectral_transfer/run.py @@ -0,0 +1,55 @@ +"""E114: two predeclared coefficient-one spectral-prior transfers; selection only.""" +import hashlib +import json +import os +import subprocess +import time +from pathlib import Path + +R = Path('/workspace/research') +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +started = time.monotonic() +receipt = {'experiment': 'E114', 'status': 'running', 'steps': []} +receipt_path = R / 'spectral_transfer_receipt.json' + +def run(label, command): + receipt['current_step'] = label + receipt_path.write_text(json.dumps(receipt, indent=2)) + print(json.dumps({'starting': label}), flush=True) + t0 = time.monotonic() + result = subprocess.run(command, env=env, check=False) + receipt['steps'].append({'name': label, 'seconds': time.monotonic()-t0, + 'returncode': result.returncode}) + if result.returncode: + receipt.update(status='failed', seconds=time.monotonic()-started) + receipt_path.write_text(json.dumps(receipt, indent=2)) + raise SystemExit(result.returncode) + +add = R/'spectral_add_delta6k.pt' +replace = R/'spectral_replace_delta6k.pt' +assert not add.exists() and not replace.exists(), 'Refuse to overwrite fixed candidates' +run('add_spectral_delta', ['python3', str(R/'partial_delta/merge.py'), + '--base', str(R/'weekly_slow_ar_delta6k.pt'), + '--candidate', str(R/'runs/spectral_synth/ema006000.pt'), + '--control', str(R/'runs/overflow_control/ema006000.pt'), '--out', str(add)]) +run('remove_old_slow_ar_delta', ['python3', str(R/'partial_delta/merge.py'), + '--base', str(add), '--candidate', str(R/'runs/partial_targets/ema006000.pt'), + '--control', str(R/'runs/long_memory_synth_recovery/ema006000.pt'), '--out', str(replace)]) +receipt['candidate_hashes'] = {p.stem: hashlib.sha256(p.read_bytes()).hexdigest() for p in [add, replace]} +for weights in [add, replace]: + run(weights.stem+'_four_cutoffs', ['python3', str(R/'evaluate_cutoffs.py'), + '--name', weights.stem, '--weights', str(weights), + '--evaluator', str(R/'postloss_inference/evaluate.py')]) + for cutoff, folder in [('valid_screen','evals'), ('valid_backcast','backcast_evals'), + ('valid_backcast2','backcast2_evals'), ('valid_backcast3','backcast3_evals')]: + run(weights.stem+'_'+cutoff+'_record', ['python3', str(R/'direct_v1/record.py'), + str(R/folder/weights.stem/'report.json'), '--label', 'E114 '+weights.stem+' '+cutoff, + '--outcome', 'Fixed coefficient-one spectral transfer; additive and old-slow-AR replacement are the two predeclared ablations. No optimization. Ensemble selection recorded separately.']) + command = ['python3', str(R/'equal_ensemble_probe.py'), '--valid', str(R/cutoff), + '--out', str(R/(weights.stem+'_ensemble_'+cutoff+'.json'))] + for name in [weights.stem, 'patch8_ema6000', 'split_patch_ema12000']: + command += ['--pred', str(R/folder/name)] + run(weights.stem+'_'+cutoff+'_ensemble', command) +receipt.update(status='complete', seconds=time.monotonic()-started) +receipt_path.write_text(json.dumps(receipt, indent=2)) +print(json.dumps(receipt), flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/check.py new file mode 100644 index 0000000000000000000000000000000000000000..1797c7ca37791de3ac143f64843434ad7beda0ba --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/check.py @@ -0,0 +1,45 @@ +"""Verify the weekly-only data change without using validation or optimizer steps.""" +import copy +import hashlib +import importlib.util +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'weekly_synth')) +from data import Sampler +spec=importlib.util.spec_from_file_location('weekly_control_data',R/'overflow_control/data.py') +control_code=importlib.util.module_from_spec(spec);spec.loader.exec_module(control_code) +started=time.monotonic();seed=467 +candidate=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +control=control_code.Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed);rows=synthetic_rows=weekly_rows=0 +for _ in range(120): + c=int(rng.choice([512,1024,2048,4096]));h=int(rng.choice([32,128,512,1024])) + expected=control.sample(64,c,h);actual=candidate.sample(64,c,h) + replacements=np.array(candidate.last_weekly_rows,dtype=int) + unchanged=np.ones(64,dtype=bool);unchanged[replacements]=False + for x,y in zip(expected,actual): + assert np.array_equal(x[unchanged],y[unchanged],equal_nan=True) + assert set(candidate.last_weekly_rows)<=set(candidate.last_synthetic_rows) + assert np.all(actual[2][replacements]==np.array([52,1])) + for x,y in zip(expected[:2],actual[:2]): + assert np.array_equal(np.isfinite(x),np.isfinite(y)) + assert candidate.rng.bit_generator.state==control.rng.bit_generator.state + assert candidate.horizon_rng.bit_generator.state==control.horizon_rng.bit_generator.state + rows+=64;synthetic_rows+=len(candidate.last_synthetic_rows);weekly_rows+=len(replacements) +states={n:copy.deepcopy(v.bit_generator.state) for n,v in vars(candidate).items() if isinstance(v,np.random.Generator)} +next_batch=candidate.sample(64,4096,1024) +for name,state in states.items():getattr(candidate,name).bit_generator.state=state +replayed=candidate.sample(64,4096,1024) +assert all(np.array_equal(x,y,equal_nan=True) for x,y in zip(next_batch,replayed)) +model_hash=hashlib.sha256((R/'weekly_synth/model.py').read_bytes()).hexdigest() +assert model_hash==hashlib.sha256((R/'overflow_control/model.py').read_bytes()).hexdigest() +result=dict(seed=seed,rows=rows,original_synthetic_rows=synthetic_rows,replaced_weekly_rows=weekly_rows, + probability=1/11,original_and_horizon_rng_bitwise_preserved=True,unmodified_rows_bitwise_preserved=True, + finite_masks_unchanged=True,all_numpy_rng_recovery_exact=True,model_sha256=model_hash, + model_bitwise_unchanged=True,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False) +(R/'weekly_synth_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/data.py new file mode 100644 index 0000000000000000000000000000000000000000..81f0f018cb212a6e2125543e0d4efa2f31b9d8fb --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/data.py @@ -0,0 +1,113 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + self.weekly_rng=np.random.default_rng(seed+1000003) + self.weekly_probability=1/11 + def synthetic(self,n,p): + # Always consume the control generator first, preserving its complete RNG stream. + original=super().synthetic(n,p) + if self.weekly_rng.random()>=self.weekly_probability: + return original + original_rng=self.rng + try: + self.rng=self.weekly_rng + result=super().synthetic(n,[52,1]) + finally: + self.rng=original_rng + p[:]=[52,1] + self.last_weekly_rows.append(self._synthetic_row) + return result + + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..ef36b1e3de2ad1cc424019100da141536161d07a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/launch.py @@ -0,0 +1,29 @@ +"""Queue weekly synthetic coverage after robust-normalization training finishes.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + checks=json.loads((R/'weekly_synth_checks.json').read_text()) + assert checks['original_and_horizon_rng_bitwise_preserved'] and checks['unmodified_rows_bitwise_preserved'] + assert checks['all_numpy_rng_recovery_exact'] and checks['model_bitwise_unchanged'] + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'weekly_synth'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/weekly_synth'),'--initialize-from',str(R/'horizon_delta12k.pt'), + '--steps','12000','--batch','64','--lr','.00002','--seed','197','--loss-mode','paired', + '--stop-file',str(R/'weekly_synth.stop')] + with (R/'weekly_synth_queue.log').open('w') as qlog,(R/'weekly_synth_watch.log').open('w') as wlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E97 weekly synthetic coverage seed197', + '--log',str(R/'weekly_synth_train.log'),'--receipt',str(R/'weekly_synth_queue.json'), + '--wait-pid','9354','--require-checkpoint',str(R/'runs/robust_normalization/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watch=subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs/weekly_synth'), + '--evaluator',str(R/'postloss_inference/evaluate.py'),'--name','weekly_synth', + '--steps','1000,3000,6000,12000'],stdout=wlog,stderr=subprocess.STDOUT,env=env) + print({'queue_pid':queued.pid,'watch_pid':watch.pid},flush=True) + result=queued.wait() + if result:watch.terminate() + watch.wait();raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member0/training/weekly_synth/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..ed7d82d53ee418c27f3691dc143ede37891db0ef --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/model_manifest.json @@ -0,0 +1,660 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36665488, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200" + ], + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 16384, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "confidence_query/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "confidence_query/model.py": "b4f11ba2018e2b50879cdc33acf0138301548971508b58035a7c96a29aaa6f2d", + "confidence_query/train.py": "fc8a7555a5a6b0a6f91e80ac8cc9cbbfddaa2b26468c57f49dfb17671b22ce93", + "direct_large/data.py": "6e6db217936f8dd79380d2ceff3eaa8598a44f1b60b17acae7bfde2363116847", + "direct_large/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "direct_large/model.py": "146d93a3f95b13bda8b1b437bc36621b91356cf946e94f62999f89e7fb348071", + "direct_large/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "direct_large/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "direct_large/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "direct_large/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "direct_large/train.py": "b9ad6b2adddeaf12961b529d6535dd33f6d044a31979b5c9e49dceafbadd3ac0", + "direct_large/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "direct_large/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "full_paired/check.py": "90ac1c78846439d51ab8acd62a19bd536c7c394bd02e94f6d5ff17c0af8bd116", + "full_paired/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "full_paired/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "horizon_jitter/data.py": "5044cf648323420095ed6058d29f837c07ff5559b606df8b00cc8d1e95c8b58e", + "horizon_jitter/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "horizon_jitter/train.py": "4e9cbca1293f18f7eea2c72dba127815c0934a13c86e8f6cc881a749676d41a6", + "large_corpus/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "large_corpus/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "large_corpus/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "large_sign/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "large_sign/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "large_sign/model.py": "3fff6445a1982a1b3c92f06a9b5f1bb627dda6a291b0b2364bcfb1a6457830d7", + "large_sign/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "large_sign/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "large_sign/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "large_sign/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "large_sign/train.py": "a597f40ab87cce04e96dc654d12e56cdf40ffd87f00034d8bc4d56dff4eb7c68", + "large_sign/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "large_sign/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "partial_delta/merge.py": "63984a0f46f7d48817037f5bf5a1c9319e45a9b1924cde62c667ac49ce47532e", + "partial_targets/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "partial_targets/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "partial_targets/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "patch16/convert.py": "11e1d30100ab25311020ac1f4ab8227ec66156836df5de613300867977091c45", + "patch16/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "patch16/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "patch16/model.py": "8031c597b354eb2cf464140bee40c3ec8dff86c775b5c55c5ce910302b443582", + "patch16/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "patch16/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "patch16/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "patch16/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "patch16/train.py": "3156710f76111a31447cbe638ee27fe2811d060917aa083aab0b5134d98accf8", + "patch16/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "patch16/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "patch8/convert.py": "9edaa0c8349310b7419d649fb4f21dd3ddb9067ebe984d5df3701a234be73780", + "patch8/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "patch8/memory_check.py": "78e8e5cca960bf1225ec0104980363c82f4c3c13c2d77ed154cea37a5b6f3fd1", + "patch8/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "recency_features/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "recency_features/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "recency_features/train.py": "a654b9a27b6c27141e1d4e517ab28fcae3f2c23d061742fa2f6c01e3d23c8a00", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/snapshot.py": "0f241a7e139e47ffff7efea40572205fd84c12efe6fb3c2dccd87c50d678a6c3", + "recovery/train.py": "63bee736565af670877b4cd7c75015fab06a18c66bbe132b0bb3faff5ebd80c7" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/direct_large/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fda928e16338305fd9912f7bc08cacff58bd8aa4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/check.py @@ -0,0 +1,34 @@ +import importlib.util,json,time +from pathlib import Path +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +r=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197);start=time.monotonic() +ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +spec=importlib.util.spec_from_file_location('parent_model',r/'confidence_inference/model.py') +old=importlib.util.module_from_spec(spec);spec.loader.exec_module(old) +parent=old.DirectForecaster(**ck['config']);parent.load_state_dict(ck['model']) +m=DirectForecaster(**ck['config']);m.load_state_dict(ck['model']) +x=torch.randn(4,512);x[0,:50]=float('nan');p=torch.tensor([[24,168]]*4);y=torch.randn(4,128);y[0,32:]=float('nan') +with torch.inference_mode(): + assert all(torch.equal(a,b) for a,b in zip(m(x,p,48),parent(x,p,48))) + short=m(x,p,32)[0];long=m(x,p,128,forecast_lengths=torch.full((4,),32))[0][:,:32] + assert torch.allclose(short,long,atol=3e-6,rtol=1e-6),(short-long).abs().max() + paired=float(loss_fn(m,x,y,p,paired=True));reverse=float(loss_fn(m,-x,-y,p,paired=True)) + assert abs(paired-reverse)<1e-7,(paired,reverse) +a=Sampler(r/'packed_sample',197);b=Sampler(r/'packed_sample',197) +for c,h in [(512,32),(4096,1024)]: + assert all(np.array_equal(v,w,equal_nan=True) for v,w in zip(a.sample(16,c,h),b.sample(16,c,h))) +assert a.rng.bit_generator.state==b.rng.bit_generator.state and a.horizon_rng.bit_generator.state==b.horizon_rng.bit_generator.state +cpu=time.monotonic()-start;del parent,ck,a,b +m=m.cuda();ema={k:v.detach().clone() for k,v in m.state_dict().items()} +moments=[torch.zeros_like(v) for v in m.parameters() for _ in range(2)] +torch.backends.cuda.matmul.allow_tf32=True;torch.cuda.reset_peak_memory_stats();start=time.monotonic() +x=torch.randn(64,4096,device='cuda');y=torch.randn(64,1024,device='cuda');p=torch.tensor([[24,168]]*64,device='cuda') +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +z={'cpu_seconds':cpu,'initial_forecast_bitwise_parent':True,'unused_future_tokens_do_not_change_requested_prefix':True,'paired_loss_sign_symmetric':True,'matched_sampler_main_and_horizon_rng':True,'gpu_fixture_seconds':time.monotonic()-start,'allocated_mib':torch.cuda.max_memory_allocated()/2**20,'reserved_mib':torch.cuda.max_memory_reserved()/2**20,'optimizer_updates':0} +(r/'full_paired_checks.json').write_text(json.dumps(z,indent=2));print(json.dumps(z),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/large_sign/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch16/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..d55bebeab8c6ff393f89b7ad031763f49531f56b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/memory_check.py @@ -0,0 +1,23 @@ +"""Maximum training-shape memory fixture, serialized with validation jobs.""" +import fcntl,json,sys,time +from pathlib import Path +import torch + +r=Path('/workspace/research');sys.path.insert(0,str(r/'patch8')) +from model import DirectForecaster,loss_fn +from data import Sampler +with open(r/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + torch.set_num_threads(1);torch.manual_seed(277);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic() + ck=torch.load(r/'patch8_initial.pt',map_location='cpu',weights_only=False) + m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) + x,y,p=[torch.from_numpy(a).cuda() for a in Sampler(r/'packed_sample',277).sample(64,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize() + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) + result={'seed':277,'batch':64,'signed_rows':128,'context':4096,'horizon':1024, + 'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started, + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + (r/'patch8_memory_check.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/relaunch_20261022b.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/relaunch_20261022b.py new file mode 100644 index 0000000000000000000000000000000000000000..d16fc19cbbb86dba2ff53b445e368b8bbd2ca218 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/relaunch_20261022b.py @@ -0,0 +1,105 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery2' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 152594, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'recent_normalization_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'postloss': 'recent_normalization_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/relaunch_20261023.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/relaunch_20261023.py new file mode 100644 index 0000000000000000000000000000000000000000..5f35a9cfcbe7ea66c8837b6d4ada8b84be36b934 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/relaunch_20261023.py @@ -0,0 +1,104 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery3' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 151596, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/schedules.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/schedules.py new file mode 100644 index 0000000000000000000000000000000000000000..4c8378f374144b802d2cd5a98afd71efc1ba0a4c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/schedules.py @@ -0,0 +1,13 @@ +"""Explicit training-only learning-rate schedules; default arithmetic unchanged.""" +import math + + +def learning_rate(step, steps, peak, reset_at=-1, anneal_from_step=None, + anneal_from_lr=None, anneal_final_lr=None): + if anneal_from_step is not None: + assert steps > anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..11ce27e43477f9c685cefeaa5f36e53c59634505 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..536677ab542342e8e9b56298e5ddb7cb2983a258 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member1/training/recovery/train.py @@ -0,0 +1,201 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..267b9cd31e3dcddf8fb57320edcd08e8bba1d9bb --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/model_manifest.json @@ -0,0 +1,744 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36601928, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404" + ], + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "training_lineage": [ + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 8192, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "confidence_query/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "confidence_query/model.py": "b4f11ba2018e2b50879cdc33acf0138301548971508b58035a7c96a29aaa6f2d", + "confidence_query/train.py": "fc8a7555a5a6b0a6f91e80ac8cc9cbbfddaa2b26468c57f49dfb17671b22ce93", + "direct_large/data.py": "6e6db217936f8dd79380d2ceff3eaa8598a44f1b60b17acae7bfde2363116847", + "direct_large/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "direct_large/model.py": "146d93a3f95b13bda8b1b437bc36621b91356cf946e94f62999f89e7fb348071", + "direct_large/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "direct_large/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "direct_large/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "direct_large/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "direct_large/train.py": "b9ad6b2adddeaf12961b529d6535dd33f6d044a31979b5c9e49dceafbadd3ac0", + "direct_large/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "direct_large/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "full_paired/check.py": "90ac1c78846439d51ab8acd62a19bd536c7c394bd02e94f6d5ff17c0af8bd116", + "full_paired/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "full_paired/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "horizon_jitter/data.py": "5044cf648323420095ed6058d29f837c07ff5559b606df8b00cc8d1e95c8b58e", + "horizon_jitter/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "horizon_jitter/train.py": "4e9cbca1293f18f7eea2c72dba127815c0934a13c86e8f6cc881a749676d41a6", + "large_corpus/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "large_corpus/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "large_corpus/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "large_sign/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "large_sign/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "large_sign/model.py": "3fff6445a1982a1b3c92f06a9b5f1bb627dda6a291b0b2364bcfb1a6457830d7", + "large_sign/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "large_sign/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "large_sign/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "large_sign/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "large_sign/train.py": "a597f40ab87cce04e96dc654d12e56cdf40ffd87f00034d8bc4d56dff4eb7c68", + "large_sign/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "large_sign/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "partial_delta/merge.py": "63984a0f46f7d48817037f5bf5a1c9319e45a9b1924cde62c667ac49ce47532e", + "partial_targets/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "partial_targets/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "partial_targets/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "patch16/convert.py": "11e1d30100ab25311020ac1f4ab8227ec66156836df5de613300867977091c45", + "patch16/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "patch16/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "patch16/model.py": "8031c597b354eb2cf464140bee40c3ec8dff86c775b5c55c5ce910302b443582", + "patch16/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "patch16/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "patch16/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "patch16/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "patch16/train.py": "3156710f76111a31447cbe638ee27fe2811d060917aa083aab0b5134d98accf8", + "patch16/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "patch16/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "patch8/convert.py": "9edaa0c8349310b7419d649fb4f21dd3ddb9067ebe984d5df3701a234be73780", + "patch8/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "patch8/memory_check.py": "78e8e5cca960bf1225ec0104980363c82f4c3c13c2d77ed154cea37a5b6f3fd1", + "patch8/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "recency_features/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "recency_features/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "recency_features/train.py": "a654b9a27b6c27141e1d4e517ab28fcae3f2c23d061742fa2f6c01e3d23c8a00", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/snapshot.py": "0f241a7e139e47ffff7efea40572205fd84c12efe6fb3c2dccd87c50d678a6c3", + "recovery/train.py": "63bee736565af670877b4cd7c75015fab06a18c66bbe132b0bb3faff5ebd80c7", + "split_patch/check.py": "2e0917eec4b70741da84f62ba19d709229fefa29fd46a8b85dd91976952560f9", + "split_patch/convert.py": "115b3f518a2157529a3c26143dabd736abc8494b7f20cdd9bea57d569d77c36e", + "split_patch/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "split_patch/launch.py": "014b171e8b8dc1f4b84242a02813af1ee8b26c3b4dc839148718caf36d77ae77", + "split_patch/memory_check.py": "8a6f6af761ac37fb5118f71e38bba0ca5c446e5c1203b9e156657e7d68a5d3e9", + "split_patch/model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/model.py new file mode 100644 index 0000000000000000000000000000000000000000..b881039b3752b3396e06415a8d01d24956fa29a7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/model.py @@ -0,0 +1,190 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + n=ctx.shape[0] + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1]) + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/train.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9d2a3a0502cee1a67c41c832266c7f87cc5a80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/confidence_query/train.py @@ -0,0 +1,54 @@ +"""Train only confidence-query features on a frozen model, using paired-sign forecast loss.""" +import argparse,json,math,time,os +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--steps',type=int,default=6000) +ap.add_argument('--batch',type=int,default=128);ap.add_argument('--lr',type=float,default=2e-4) +ap.add_argument('--seed',type=int,default=89);ap.add_argument('--save-every',type=int,default=1000);a=ap.parse_args() +torch.set_num_threads(1);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True) +ck=torch.load(a.initialize_from,map_location='cpu',weights_only=False) +config={**ck['config'],'confidence_features':True};model=DirectForecaster(**config).cuda() +missing,unexpected=model.load_state_dict(ck['model'],strict=False) +assert not unexpected and all(k.startswith('confidence.') for k in missing) +for name,param in model.named_parameters():param.requires_grad_(name.startswith('confidence.')) +params=[p for p in model.parameters() if p.requires_grad] +opt=torch.optim.AdamW(params,lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) +ema={k:v.detach().clone() for k,v in model.state_dict().items()};sampler=Sampler(a.packed,seed=a.seed) +(out/'config.json').write_text(json.dumps({**vars(a),'parameters':sum(p.numel() for p in model.parameters()),'trainable_parameters':sum(p.numel() for p in params)},indent=2)) +rng=np.random.default_rng(a.seed) +def nextbatch(): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) +def save(step): + for prefix,weights in [('step',model.state_dict()),('ema',ema)]: + state={'model':weights,'config':model.config,'step':step,'args':vars(a),'ema':prefix=='ema'} + path=out/f'{prefix}{step:06d}.pt';torch.save(state,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +save(0);pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] +for step in range(1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch);x,y,p=[torch.from_numpy(x).cuda() for x in arrays] + lr=a.lr*min(1,step/200)*(.2+.8*.5*(1+math.cos(math.pi*step/a.steps))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(params,1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items(): + if k.startswith('confidence.'):ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + if step%a.save_every==0 or step==a.steps:save(step) +pool.shutdown() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/data.py new file mode 100644 index 0000000000000000000000000000000000000000..2378e33d7352ba5ad97d566148782e63e64b367c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/data.py @@ -0,0 +1,71 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + return ctx,tgt,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/model.py new file mode 100644 index 0000000000000000000000000000000000000000..7a224cc12a159446a1e427b2052b53d1d1f7e83e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/model.py @@ -0,0 +1,142 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + pin=torch.maximum(levels*err,(levels-1)*err).mean(-1) + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + return per.mean() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/train.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccc736bfef804259199a2dd315347d9854b680 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/train.py @@ -0,0 +1,67 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(6);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/direct_large/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/check.py new file mode 100644 index 0000000000000000000000000000000000000000..fda928e16338305fd9912f7bc08cacff58bd8aa4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/check.py @@ -0,0 +1,34 @@ +import importlib.util,json,time +from pathlib import Path +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +r=Path('/workspace/research');torch.set_num_threads(1);torch.manual_seed(197);start=time.monotonic() +ck=torch.load(r/'horizon_delta12k.pt',map_location='cpu',weights_only=False) +spec=importlib.util.spec_from_file_location('parent_model',r/'confidence_inference/model.py') +old=importlib.util.module_from_spec(spec);spec.loader.exec_module(old) +parent=old.DirectForecaster(**ck['config']);parent.load_state_dict(ck['model']) +m=DirectForecaster(**ck['config']);m.load_state_dict(ck['model']) +x=torch.randn(4,512);x[0,:50]=float('nan');p=torch.tensor([[24,168]]*4);y=torch.randn(4,128);y[0,32:]=float('nan') +with torch.inference_mode(): + assert all(torch.equal(a,b) for a,b in zip(m(x,p,48),parent(x,p,48))) + short=m(x,p,32)[0];long=m(x,p,128,forecast_lengths=torch.full((4,),32))[0][:,:32] + assert torch.allclose(short,long,atol=3e-6,rtol=1e-6),(short-long).abs().max() + paired=float(loss_fn(m,x,y,p,paired=True));reverse=float(loss_fn(m,-x,-y,p,paired=True)) + assert abs(paired-reverse)<1e-7,(paired,reverse) +a=Sampler(r/'packed_sample',197);b=Sampler(r/'packed_sample',197) +for c,h in [(512,32),(4096,1024)]: + assert all(np.array_equal(v,w,equal_nan=True) for v,w in zip(a.sample(16,c,h),b.sample(16,c,h))) +assert a.rng.bit_generator.state==b.rng.bit_generator.state and a.horizon_rng.bit_generator.state==b.horizon_rng.bit_generator.state +cpu=time.monotonic()-start;del parent,ck,a,b +m=m.cuda();ema={k:v.detach().clone() for k,v in m.state_dict().items()} +moments=[torch.zeros_like(v) for v in m.parameters() for _ in range(2)] +torch.backends.cuda.matmul.allow_tf32=True;torch.cuda.reset_peak_memory_stats();start=time.monotonic() +x=torch.randn(64,4096,device='cuda');y=torch.randn(64,1024,device='cuda');p=torch.tensor([[24,168]]*64,device='cuda') +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +z={'cpu_seconds':cpu,'initial_forecast_bitwise_parent':True,'unused_future_tokens_do_not_change_requested_prefix':True,'paired_loss_sign_symmetric':True,'matched_sampler_main_and_horizon_rng':True,'gpu_fixture_seconds':time.monotonic()-start,'allocated_mib':torch.cuda.max_memory_allocated()/2**20,'reserved_mib':torch.cuda.max_memory_reserved()/2**20,'optimizer_updates':0} +(r/'full_paired_checks.json').write_text(json.dumps(z,indent=2));print(json.dumps(z),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/full_paired/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3d632af7e96a71f30b7964a2b3fd73bc1c3f3f3e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/data.py @@ -0,0 +1,86 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/train.py new file mode 100644 index 0000000000000000000000000000000000000000..768d33da4421b24bd760d7d9680d0c2cd9bd84e4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/horizon_jitter/train.py @@ -0,0 +1,74 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler,truncate_targets + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + horizon_rng=np.random.default_rng(a.seed+startstep+300003) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return truncate_targets(sampler.sample(a.batch,c,h),horizon_rng,a.patch) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_corpus/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/model.py new file mode 100644 index 0000000000000000000000000000000000000000..60aeb14b5f4fa298521ddce8a3276d076c1bb631 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(h)/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional(torch.arange(-nt,0,device=z.device),self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional(torch.arange(h//p,device=z.device),self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/train.py new file mode 100644 index 0000000000000000000000000000000000000000..d089166fb1612ddf4955fcd2f096cb0b33624dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/train.py @@ -0,0 +1,70 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/large_sign/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_delta/merge.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_delta/merge.py new file mode 100644 index 0000000000000000000000000000000000000000..3dde47d52d25ed2b013942b3887f1bf686e42ed8 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_delta/merge.py @@ -0,0 +1,16 @@ +"""Apply the difference of two matched, locally trained checkpoints to our selected model.""" +import argparse,torch,hashlib,json,time +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--base',required=True);ap.add_argument('--candidate',required=True);ap.add_argument('--control',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +torch.set_num_threads(1);start=time.monotonic() +base=torch.load(a.base,map_location='cpu',weights_only=False);candidate=torch.load(a.candidate,map_location='cpu',weights_only=False);control=torch.load(a.control,map_location='cpu',weights_only=False) +assert set(candidate['model'])==set(control['model']) +weights={k:v.clone() for k,v in base['model'].items()} +for k in candidate['model']: + assert k in weights and weights[k].shape==candidate['model'][k].shape==control['model'][k].shape + weights[k].add_(candidate['model'][k]-control['model'][k]) +assert all(torch.isfinite(v).all() for v in weights.values()) +parents=[a.base,a.candidate,a.control] +conversion={'method':'matched training delta','formula':'base + candidate - control','coefficient':1.0,'parent_hashes':{p:hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in parents},'seconds':time.monotonic()-start} +ck={'model':weights,'config':base['config'],'step':0,'args':{'packed':base['args']['packed']},'parent_checkpoints':parents,'conversion':conversion} +torch.save(ck,a.out);print(json.dumps(conversion)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a51e912d3c4b63a3ec0cd85133bf0e7aa3429569 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/data.py @@ -0,0 +1,73 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/train.py new file mode 100644 index 0000000000000000000000000000000000000000..2e77612e443d78dd80bcb6a0cc6d01169f61a3a4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/partial_targets/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--source-weights-from',required=True);ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(2);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep,source_weights_from=a.source_weights_from) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..b2cbc8fc919be6a77eca9ab19c4faa06060a2e0d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/convert.py @@ -0,0 +1,18 @@ +"""Convert only our own trained checkpoint from 32- to 16-point patches. + +Context/query projections fold the two halves by summation, preserving the +embedding of constant features. The output projection keeps the first half. +Attention/MLP weights are inherited unchanged; position units remain 32 points. +""" +import argparse,torch,hashlib +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==32 +old=state['embed.0.weight'].reshape(d,2,32);state['embed.0.weight']=(old[:,:,:16]+old[:,:,16:]).reshape(d,32) +old=state['query.0.weight'].reshape(d,32,9);state['query.0.weight']=(old[:,:16]+old[:,16:]).reshape(d,16*9) +state['head.weight']=state['head.weight'].reshape(32,18,d)[:16].reshape(16*18,d).clone() +state['head.bias']=state['head.bias'].reshape(32,18)[:16].reshape(16*18).clone() +ck['config']['patch']=16 +ck['conversion']={'from_checkpoint':str(Path(a.input).resolve()),'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(),'method':'fold input/query halves by summation; retain first 16 output rows; preserve physical positional units'} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +torch.save(ck,a.output) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/evaluate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/evaluate.py new file mode 100644 index 0000000000000000000000000000000000000000..05f086d4d84def4a48165f9e65d2948877675e56 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/evaluate.py @@ -0,0 +1,16 @@ +import sys,json,argparse,time,hashlib +from pathlib import Path +import torch +from predict import load_model,run +sys.path.insert(0,'/workspace/evaluation') +from score import score,json_safe + +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);ap.add_argument('--valid',default='/workspace/research/valid_screen');ap.add_argument('--baseline',default='/workspace/research/valid_screen/baseline.json');a=ap.parse_args() +torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cuda.matmul.allow_tf32=False +t0=time.time();out=Path(a.out);v=Path(a.valid) +run(load_model(a.weights),v/'input',out) +base=json.loads(Path(a.baseline).read_text())['configs'] +rep=score(v/'truth',out,base) +rep['checkpoint_sha256']=hashlib.sha256(Path(a.weights).read_bytes()).hexdigest();rep['eval_seconds']=time.time()-t0 +(out/'report.json').write_text(json.dumps(json_safe(rep),indent=1)) +print(json.dumps({k:rep[k] for k in ('skill_score','rel_mase_gmean','rel_wql_gmean','n_failed','groups','eval_seconds')},indent=1)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/model.py new file mode 100644 index 0000000000000000000000000000000000000000..06cce56e2ce671b6683f0246900abfcac06bb3c0 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/model.py @@ -0,0 +1,154 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/pack.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0c404bdd2e9382ab7f431cb359b6df31ed12a6 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/pack.py @@ -0,0 +1,56 @@ +"""Deterministic one-pass, source-capped pack; only mounted allow-listed Arrow data.""" +import json,time,hashlib,concurrent.futures,argparse +from pathlib import Path +import numpy as np +import pyarrow as pa + +ROOT=Path('/workspace/data/gifteval_pretrain') + +def pack_dir(job): + name,out,cap=job + rng=np.random.default_rng(int.from_bytes(hashlib.sha256(name.encode()).digest()[:4],'little')) + files=sorted((ROOT/name).glob('data-*.arrow')) + rng.shuffle(files) + # Spread large-source samples across eight shards rather than taking one contiguous slice. + files=files[:min(8,len(files))] + meta=[]; total=0; offsets=[0]; t0=time.time() + with open(out/f'{name}.bin','wb') as dest: + for file in files: + quota=max(1,cap//len(files)); kept=0 + with pa.memory_map(str(file),'r') as f: + table=pa.ipc.open_stream(f).read_all() + freq=table.column('freq')[0].as_py() if table.num_rows else '' + for target in table.column('target').chunks: + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + target=target.values + off=target.offsets.to_numpy() + flat=target.values.to_numpy(zero_copy_only=False) + ids=np.arange(len(target));rng.shuffle(ids) + for i in ids: + x=flat[off[i]:off[i+1]] + if len(x)<16 or not np.isfinite(x).any():continue + # Cap very long series at a random contiguous year-sized segment. + if len(x)>131072: + start=int(rng.integers(len(x)-131072+1));x=x[start:start+131072] + x=np.asarray(x,dtype=np.float32) + x.tofile(dest);total+=len(x);kept+=len(x);offsets.append(total) + meta.append({'dataset':name,'freq':freq,'length':len(x)}) + if kept>=quota:break + if kept>=quota:break + np.save(out/f'{name}.offsets.npy',np.asarray(offsets,np.int64)) + (out/f'{name}.json').write_text(json.dumps(meta)) + return name,total,len(meta),round(time.time()-t0,1) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--out',required=True);ap.add_argument('--cap',type=int,default=16000000);ap.add_argument('--workers',type=int,default=6);a=ap.parse_args() + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + names=sorted(p.name for p in ROOT.iterdir() if p.is_dir() and not p.name.startswith('.')) + lock=json.loads(Path('/workspace/data/sources.lock.json').read_text()) + allowed=next(s for s in lock['sources'] if s['id']=='gifteval_pretrain')['directories'] + assert set(names)<=set(allowed) + with concurrent.futures.ThreadPoolExecutor(a.workers) as pool: + for result in pool.map(pack_dir,[(n,out,a.cap) for n in names]):print(result,flush=True) + counts={n:len(json.loads((out/f'{n}.json').read_text())) for n in names} + (out/'meta.json').write_text(json.dumps({'dirs':[n for n in names if counts[n]],'counts':counts,'per_directory_point_cap':a.cap,'seed':'sha256(directory) little-endian first 4 bytes','min_length':16},indent=2)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..e20c6630475d6b4fa6906eb4ed9454b7b5aeec2c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/predict.py @@ -0,0 +1,43 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import ts_io + +def load_model(checkpoint,device='cuda'): + ck=torch.load(checkpoint,map_location='cpu',weights_only=False) + model=DirectForecaster(**ck['config']).to(device);model.load_state_dict(ck['model']);model.eval() + return model + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16):q=model.predict(x,p,h).float().cpu().numpy() + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'weights.pt'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..eaf95c9aec5936076b881c340edb960786f2d40d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/publish.py @@ -0,0 +1,31 @@ +"""Assemble a relocatable package, then atomically exchange complete directories.""" +import json,os,shutil,ctypes,hashlib,argparse +from pathlib import Path +import torch +HERE=Path(__file__).resolve().parent + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',default='/workspace/submission');ap.add_argument('--report',required=True);ap.add_argument('--experiments',default=str(HERE/'EXPERIMENTS.md'));a=ap.parse_args() + final=Path(a.out);staging=final.parent/f'.{final.name}-staging-{os.getpid()}' + shutil.rmtree(staging,ignore_errors=True);staging.mkdir(parents=True) + for file in ('model.py','predict.py','infer.sh','ts_io.py'): + shutil.copy(HERE/file,staging/file) + shutil.copy(a.weights,staging/'weights.pt');shutil.copy('/opt/runtime/requirements.txt',staging/'requirements.txt') + ck=torch.load(a.weights,map_location='cpu',weights_only=False);digest=hashlib.sha256((staging/'weights.pt').read_bytes()).hexdigest() + sources=json.loads(Path('/workspace/research/packed_sample/meta.json').read_text())['dirs'] + manifest={'name':'direct-seasonal-quantile-v1','contract':'timeseries-forecast/v1','parameters':sum(x.numel() for x in ck['model'].values()),'pretrained_assets':[],'sources_used':[f'gifteval_pretrain/{d}' for d in sources]+['synthetic:direct_v1 damped trends, random Fourier seasonality, AR noise, intermittent demand and changepoints; data.py generator seed 17'],'weights_sha256':digest,'training_step':ck['step'],'config':ck['config'],'notes':'Random initialization, direct encoder-decoder quantile forecasts with fixed per-instance seasonal context summaries. No fitting or parameter adaptation at inference. All 95 allow-listed directories sampled. Validation only used for selection.'} + (staging/'model_manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') + (staging/'config.json').write_text(json.dumps(ck['config'],indent=2)+'\n') + shutil.copy(a.experiments,staging/'EXPERIMENTS.md');shutil.copy(a.report,staging/'validation_report.json') + # Include generator/sampler provenance, which is not imported by inference. + (staging/'provenance').mkdir() + for file in ('pack.py','data.py','train.py'):shutil.copy(HERE/file,staging/'provenance'/file) + (staging/'README.md').write_text('# Direct seasonal quantile foundation forecaster\n\nRun `bash infer.sh INPUT_DIR OUTPUT_DIR`. This package contains all inference assets and uses only its supplied input directory. The 6.76M parameter encoder/decoder was trained from random initialization on source-balanced samples of the 95 allow-listed GiftEvalPretrain directories and newly generated synthetic data. It predicts nine quantiles directly, with no autoregressive rollout and no inference-time fitting. Fixed context summaries include recent levels, damped slopes and seasonal means.\n\nThe runtime is pinned in requirements.txt. Per-instance normalization is computed by the model; no external statistics are needed. The output quantiles are monotone by construction. See EXPERIMENTS.md and validation_report.json for measured results, limitations and checkpoint identity. Validation skill is not on the held-out reward scale.\n') + if final.exists(): + libc=ctypes.CDLL(None,use_errno=True) + if libc.renameat2(-100,os.fsencode(staging),-100,os.fsencode(final),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) + shutil.rmtree(staging) + else:os.replace(staging,final) + print(json.dumps(manifest,indent=1)) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/record.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/record.py new file mode 100644 index 0000000000000000000000000000000000000000..1850a33f46fa3ee4d78cac4a5d6152404801a131 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/record.py @@ -0,0 +1,9 @@ +import argparse,json,math +from pathlib import Path +ap=argparse.ArgumentParser();ap.add_argument('report');ap.add_argument('--label',required=True);ap.add_argument('--outcome',default='Screened for model selection.');a=ap.parse_args() +r=json.loads(Path(a.report).read_text());p=Path(__file__).with_name('EXPERIMENTS.md') +lines=[f'\n## {a.label}',f'- Checkpoint SHA-256: `{r.get("checkpoint_sha256","see model_manifest.json")}`.',f'- Evaluation: {r["n_configs"]} configurations, {r["n_instances"]} instances, {r["n_failed"]} failed configurations; {r.get("eval_seconds","not separately timed")} seconds.',f'- Overall skill {r["skill_score"]:.6f}; relative MASE {r["rel_mase_gmean"]:.6f}; relative WQL {r["rel_wql_gmean"]:.6f}.'] +for group,entries in r['groups'].items(): + lines.append(f'- {group} skill: '+', '.join(f'{k}={1-math.sqrt(v["rel_mase_gmean"]*v["rel_wql_gmean"]):.4f}' for k,v in entries.items())+'.') +lines.append('- Outcome: '+a.outcome) +with p.open('a') as f:f.write('\n'.join(lines)+'\n') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3cdc106980371c99d81c71d6746943c47206be83 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/train.py @@ -0,0 +1,71 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/validation_subset.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/validation_subset.py new file mode 100644 index 0000000000000000000000000000000000000000..4df83e69c4f9a3365955e5d17ffcfc0af71372b7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch16/validation_subset.py @@ -0,0 +1,18 @@ +"""Model-selection-only subset spanning all 97 configurations, seed 2026.""" +import sys,json,copy +from pathlib import Path +import numpy as np +sys.path.insert(0,'/workspace/evaluation') +import ts_io + +root=Path('/workspace/data/valid');out=Path('/workspace/research/valid_screen') +idx=json.loads((root/'input/index.json').read_text());new=copy.deepcopy(idx);rng=np.random.default_rng(2026) +for cfg in new['configs']: + cid=cfg['config_id'];case=ts_io.CaseFile(root/'input/cases'/f'{cid}.h5') + ids=np.sort(rng.choice(case.n,min(case.n,192),replace=False)) + ts_io.write_case_subset(case,ids,out/'input/cases'/f'{cid}.h5') + lab,se,meta=ts_io.read_truth_file(root/'truth/cases'/f'{cid}.h5') + ts_io.write_truth_file(out/'truth/cases'/f'{cid}.h5',lab[ids],se[ids],meta) + cfg['n_instances']=len(ids);case.close() +for kind in ('input','truth'):(out/kind/'index.json').write_text(json.dumps(new,indent=1)) +print('screen instances',sum(c['n_instances'] for c in new['configs'])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..f758dcbc0d48b531889b71dc758a7d2fb9a3afb7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/convert.py @@ -0,0 +1,44 @@ +"""Convert our own 16-point model to 8-point patches, without external assets.""" +import argparse +import hashlib +import json +import time +from pathlib import Path + +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--input',required=True) +ap.add_argument('--output',required=True) +a=ap.parse_args() +torch.set_num_threads(2) +started=time.monotonic() +ck=torch.load(a.input,map_location='cpu',weights_only=False) +state=ck['model']; d=ck['config']['d'] +assert ck['config']['patch']==16 +old=state['embed.0.weight'].reshape(d,2,16) +state['embed.0.weight']=(old[:,:,:8]+old[:,:,8:]).reshape(d,16) +old=state['query.0.weight'].reshape(d,16,9) +state['query.0.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*9) +if 'recency.weight' in state: + old=state['recency.weight'].reshape(d,16,4) + state['recency.weight']=(old[:,:8]+old[:,8:]).reshape(d,8*4) +state['head.weight']=state['head.weight'].reshape(16,18,d)[:8].reshape(8*18,d).clone() +state['head.bias']=state['head.bias'].reshape(16,18)[:8].reshape(8*18).clone() +ck['config']['patch']=8 +ck['config']['partial_target_lengths']=True +ck['conversion']={ + 'from_checkpoint':str(Path(a.input).resolve()), + 'from_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest(), + 'method':'fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units', + 'exact_function_preservation':False} +ck['args']={**ck['args'],'initialize_from':str(Path(a.input).resolve()),'converted':True} +ck['parent_checkpoints']=[str(Path(a.input).resolve())] +torch.save(ck,a.output) +receipt=dict(input_sha256=ck['conversion']['from_sha256'], + checkpoint_sha256=hashlib.sha256(Path(a.output).read_bytes()).hexdigest(), + parameters=sum(v.numel() for v in state.values()), + cpu_seconds=time.monotonic()-started, + optimizer_updates=0,conversion=ck['conversion']) +Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..d55bebeab8c6ff393f89b7ad031763f49531f56b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/memory_check.py @@ -0,0 +1,23 @@ +"""Maximum training-shape memory fixture, serialized with validation jobs.""" +import fcntl,json,sys,time +from pathlib import Path +import torch + +r=Path('/workspace/research');sys.path.insert(0,str(r/'patch8')) +from model import DirectForecaster,loss_fn +from data import Sampler +with open(r/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + torch.set_num_threads(1);torch.manual_seed(277);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic() + ck=torch.load(r/'patch8_initial.pt',map_location='cpu',weights_only=False) + m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) + x,y,p=[torch.from_numpy(a).cuda() for a in Sampler(r/'packed_sample',277).sample(64,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize() + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) + result={'seed':277,'batch':64,'signed_rows':128,'context':4096,'horizon':1024, + 'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started, + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + (r/'patch8_memory_check.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/patch8/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/data.py new file mode 100644 index 0000000000000000000000000000000000000000..40223a1f590e36dc202f2fb1e7c270f692aaef85 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/data.py @@ -0,0 +1,72 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class Sampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + w=min(len(values),20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8271c5b0bf9a5edb961e1c7839761fe50a2e40b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/model.py @@ -0,0 +1,171 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else None) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + meta=torch.cat((periods.float().log1p()/8,valid.sum(-1,keepdim=True).float().log1p()/8,torch.full((b,1),math.log1p(max(32,h))/8,device=z.device)),-1) + emb=self.metadata(meta)[:,None] + x=x+positional((torch.arange(-nt,0,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + for layer in self.encoder:x=layer(x,pmask) + q=self.query(base.reshape(b,h//p,p*9))+positional((torch.arange(h//p,device=z.device)+.5)*p/32-.5,self.d)[None]+emb + if self.recency is not None: + pos=torch.arange(c,device=z.device)[None,:];extras=[] + for j in range(2): + period=periods[:,j:j+1] + recent=valid&(pos>=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + q,mu,scale=model(ctx,periods,target.shape[-1]) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/train.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfb8b90f1a6656881b7598f864becaa737a76f4 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recency_features/train.py @@ -0,0 +1,73 @@ +import argparse,json,math,time,os,sys,shutil,hashlib +from pathlib import Path +from concurrent.futures import ThreadPoolExecutor +import numpy as np +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +def save(model,path,step,args,opt=None): + ck={'model':model.state_dict(),'config':model.config,'step':step,'args':vars(args)} + if opt is not None:ck['opt']=opt.state_dict() + tmp=str(path)+'.tmp';torch.save(ck,tmp);os.replace(tmp,path) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('--packed',required=True);ap.add_argument('--out',required=True) + ap.add_argument('--steps',type=int,default=12000);ap.add_argument('--batch',type=int,default=128);ap.add_argument('--context',type=int,default=4096) + ap.add_argument('--d',type=int,default=256);ap.add_argument('--enc',type=int,default=4);ap.add_argument('--dec',type=int,default=3) + ap.add_argument('--patch',type=int,default=32) + ap.add_argument('--lr',type=float,default=3e-4);ap.add_argument('--seed',type=int,default=17);ap.add_argument('--save-every',type=int,default=1000) + ap.add_argument('--resume',default='');ap.add_argument('--initialize-from',default='');ap.add_argument('--stop-file',default='');a=ap.parse_args() + torch.set_num_threads(3);torch.manual_seed(a.seed);np.random.seed(a.seed) + torch.backends.cuda.matmul.allow_tf32=True + out=Path(a.out);out.mkdir(parents=True,exist_ok=True) + model=DirectForecaster(d=a.d,enc_layers=a.enc,dec_layers=a.dec,patch=a.patch,max_context=a.context).cuda() + opt=torch.optim.AdamW(model.parameters(),lr=a.lr,weight_decay=.05,betas=(.9,.95),fused=True) + # Exponential averaging is a training-only stabilization; inference remains fixed. + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + startstep=0 + if a.resume: + ck=torch.load(a.resume,map_location='cuda',weights_only=False);model.load_state_dict(ck['model']);startstep=ck['step'] + if 'opt' in ck:opt.load_state_dict(ck['opt']) + if a.initialize_from: + ck=torch.load(a.initialize_from,map_location='cuda',weights_only=False) + missing,unexpected=model.load_state_dict(ck['model'],strict=False) + assert not unexpected and all(k.startswith('recency.') for k in missing) + ema={k:v.detach().clone() for k,v in model.state_dict().items()} + sampler=Sampler(a.packed,seed=a.seed+startstep) + params=sum(p.numel() for p in model.parameters());(out/'config.json').write_text(json.dumps({**vars(a),'parameters':params},indent=2)) + print('parameters',params,flush=True) + rng=np.random.default_rng(a.seed+startstep) + def nextbatch(): + c=int(rng.choice([512,1024,2048,a.context],p=[.1,.15,.35,.4]));h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + return sampler.sample(a.batch,c,h) + pool=ThreadPoolExecutor(1);future=pool.submit(nextbatch);t0=time.time();losses=[] + for step in range(startstep+1,a.steps+1): + arrays=future.result();future=pool.submit(nextbatch) + x,y,p=[torch.from_numpy(x).cuda(non_blocking=True) for x in arrays] + lr=a.lr*min(1,step/400)*(.2+.8*.5*(1+math.cos(math.pi*min(1,step/a.steps)))) + for g in opt.param_groups:g['lr']=lr + opt.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p) + loss.backward();gn=torch.nn.utils.clip_grad_norm_(model.parameters(),1.) + if torch.isfinite(gn): + opt.step() + with torch.no_grad(): + decay=min(.999,1-1/(step+1)) + for k,v in model.state_dict().items():ema[k].lerp_(v,1-decay) + losses.append(float(loss.detach())) + if step%50==0: + rec={'step':step,'loss':float(np.mean(losses)),'seconds':round(time.time()-t0,1),'lr':lr,'grad_norm':float(gn),'context':x.shape[-1],'horizon':y.shape[-1]} + print(json.dumps(rec),flush=True) + with open(out/'log.jsonl','a') as f:f.write(json.dumps(rec)+'\n') + losses=[] + stop=a.stop_file and Path(a.stop_file).exists() + if step%a.save_every==0 or step==a.steps or stop: + save(model,out/f'step{step:06d}.pt',step,a) + save(model,out/'last.pt',step,a,opt) + ck={'model':ema,'config':model.config,'step':step,'args':vars(a),'ema':True} + path=out/f'ema{step:06d}.pt';torch.save(ck,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) + if stop:break + pool.shutdown() + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/relaunch_20261022b.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/relaunch_20261022b.py new file mode 100644 index 0000000000000000000000000000000000000000..d16fc19cbbb86dba2ff53b445e368b8bbd2ca218 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/relaunch_20261022b.py @@ -0,0 +1,105 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery2' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 152594, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'recent_normalization_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'postloss': 'recent_normalization_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/relaunch_20261023.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/relaunch_20261023.py new file mode 100644 index 0000000000000000000000000000000000000000..5f35a9cfcbe7ea66c8837b6d4ada8b84be36b934 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/relaunch_20261023.py @@ -0,0 +1,104 @@ +"""Resume interrupted research jobs and preserve phase-specific recovery receipts.""" +import datetime +import json +import os +from pathlib import Path +import shutil +import subprocess +import time + +R = Path('/workspace/research') +TAG = 'recovery3' +env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') +receipt = {'recovery_utc': datetime.datetime.now(datetime.timezone.utc).isoformat(), + 'remaining_research_seconds_at_operator_recovery': 151596, + 'jobs': {}, 'queues': {}} +children = {} + +def launch(name, command, phase=TAG): + log = R / f'{name}_{phase}.log' + assert not log.exists(), log + with log.open('w') as f: + child = subprocess.Popen(command, stdout=f, stderr=subprocess.STDOUT, env=env) + children[name] = child + return {'pid': child.pid, 'command': command, 'log': str(log), 'started_monotonic': time.monotonic()} + +def persist(): + path = R / f'{TAG}_launch_receipt.json' + tmp = path.with_suffix('.tmp') + tmp.write_text(json.dumps(receipt, indent=2)); os.replace(tmp, path) + +for name in ['wide_capacity_146m_recovery', 'wide_capacity_control_recovery', + 'long_memory_synth_recovery', 'wide_graft', 'patch8']: + run = R / 'runs' / name + cfg = json.loads((run / 'config.json').read_text()) + shutil.copy2(run / 'config.json', run / f'config_before_{TAG}.json') + command = ['python3', str(R / 'recovery/train.py')] + for key in ['code_dir', 'packed', 'source_weights_from', 'out', 'initialize_from', + 'initialize_ema', 'start_step', 'steps', 'batch', 'lr', 'seed', 'context', + 'sample_context', 'save_every', 'stop_file', 'reset_at', 'reset_seed', 'loss_mode']: + if cfg.get(key) is not None: + command += ['--' + key.replace('_', '-'), str(cfg[key])] + if (run / 'recovery.pt').exists(): + command += ['--resume', str(run / 'recovery.pt')] + mode = 'complete optimizer/EMA/RNG/prefetched-batch resume' + else: + mode = 'restart saved own initialization; no complete checkpoint existed' + if cfg.get('compile_loss'): + command += ['--compile-loss'] + command = ['env', 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache'] + command + assert not Path(cfg['stop_file']).exists(), cfg['stop_file'] + receipt['jobs'][name] = dict(launch(name, command), mode=mode) + persist() + +watch_specs = { + 'wide_capacity_146m_recovery': ('wide_capacity_inference', '24000,32000'), + 'wide_capacity_control_recovery': ('wide_capacity_inference', '24000,32000'), + 'long_memory_synth_recovery': ('partial_targets_inference', '12000'), + 'recent_normalization_recovery': ('recent_normalization_inference', '12000'), + 'wide_graft': ('wide_graft_inference', '4000,8000,12000,16000,24000,32000'), + 'patch8': ('full_paired_inference', '1000,3000,6000,12000'), + 'volatility_synth': ('partial_targets_inference', '3000,6000,12000'), + 'postloss': ('full_paired_inference', '1000,3000,6000,12000'), + 'paired_long_memory': ('full_paired_inference', '1000,3000,6000,12000'), +} +for name, (runtime, steps) in watch_specs.items(): + command = ['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / runtime / 'evaluate.py'), '--name', name, '--steps', steps] + launch(name + '_watch', command) + +queue_specs = {'volatility_synth': 'long_memory_synth_recovery', + 'paired_long_memory': 'wide_capacity_control_recovery'} +for name, dependency in queue_specs.items(): + old = json.loads((R / (name + '_queue.json')).read_text()) + shutil.copy2(R / (name + '_queue.json'), R / (name + '_queue_before_' + TAG + '.json')) + receipt['queues'][name] = dict(old, dependency=dependency, status='waiting', + wait_pids=[children[dependency].pid]) +persist() + +while True: + for name, job in receipt['jobs'].items(): + if 'returncode' not in job and children[name].poll() is not None: + job.update(returncode=children[name].returncode, + phase_seconds=time.monotonic() - job['started_monotonic']) + persist() + for name, queue in receipt['queues'].items(): + if queue['status'] == 'waiting' and children[queue['dependency']].poll() is not None: + if children[queue['dependency']].returncode != 0 or not all(Path(p).exists() for p in queue['required_checkpoints']): + queue['status'] = 'blocked_by_incomplete_dependency' + else: + receipt['jobs'][name] = launch(name, queue['command']) + queue.update(status='running', pid=children[name].pid, + started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) + with (R / 'direct_v1/EXPERIMENTS.md').open('a') as f: + f.write(f'\n{name} started {queue["started_utc"]} after {queue["dependency"]} completed. Original predeclared settings and seed retained.\n') + (R / (name + '_queue.json')).write_text(json.dumps(queue, indent=2)) + persist() + if all(p.poll() is not None for n,p in children.items() if not n.endswith('_watch')) and all(q['status'] != 'waiting' for q in receipt['queues'].values()): + break + time.sleep(5) +persist() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/schedules.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/schedules.py new file mode 100644 index 0000000000000000000000000000000000000000..4c8378f374144b802d2cd5a98afd71efc1ba0a4c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/schedules.py @@ -0,0 +1,13 @@ +"""Explicit training-only learning-rate schedules; default arithmetic unchanged.""" +import math + + +def learning_rate(step, steps, peak, reset_at=-1, anneal_from_step=None, + anneal_from_lr=None, anneal_final_lr=None): + if anneal_from_step is not None: + assert steps > anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..11ce27e43477f9c685cefeaa5f36e53c59634505 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..536677ab542342e8e9b56298e5ddb7cb2983a258 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/recovery/train.py @@ -0,0 +1,201 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/check.py new file mode 100644 index 0000000000000000000000000000000000000000..1f2b82a5b0b0ad5477066245356808138d166400 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/check.py @@ -0,0 +1,49 @@ +"""Verify equal input/output patches preserve the old implementation exactly.""" +import importlib.util +import json +import sys +import time +from pathlib import Path +import torch + +R = Path('/workspace/research') +sys.path.insert(0, str(R / 'split_patch')) +from model import DirectForecaster + +started = time.monotonic() +torch.set_num_threads(2) +torch.manual_seed(457) +spec = importlib.util.spec_from_file_location('original_patch_model', R / 'full_paired_inference/model.py') +old = importlib.util.module_from_spec(spec) +spec.loader.exec_module(old) +ck = torch.load(R / 'runs/patch8/ema006000.pt', map_location='cpu', weights_only=False) +control = old.DirectForecaster(**ck['config']) +control.load_state_dict(ck['model']) +same = DirectForecaster(**ck['config'], input_patch=8) +same.load_state_dict(ck['model']) +x = torch.randn(6, 251) +x[0, :90] = float('nan') +x[1, ::7] = float('nan') +p = torch.tensor([[12, 1], [52, 1], [24, 168], [7, 365], [1, 1], [96, 672]]) +with torch.no_grad(): + before = control(x, p, 57) + after = same(x, p, 57) +assert all(torch.equal(a, b) for a, b in zip(before, after)) +candidate = torch.load(R / 'split_patch_initial.pt', map_location='cpu', weights_only=False) +full4 = torch.load(R / 'patch4_initial.pt', map_location='cpu', weights_only=False) +for name, value in candidate['model'].items(): + reference = ck['model'][name] if name == 'embed.0.weight' else full4['model'][name] + assert torch.equal(value, reference), name +net = DirectForecaster(**candidate['config']) +net.load_state_dict(candidate['model']) +with torch.no_grad(): + q = net.predict(x, p, 57) +assert q.shape == (6, 9, 57) +assert torch.isfinite(q).all() and (q[:, 1:] >= q[:, :-1]).all() +receipt = dict(seed=457, cpu_seconds=time.monotonic() - started, + equal_patch_forward_bitwise_unchanged=True, + input_tensor_retained_from_patch8=True, + output_tensors_identical_to_full_patch4_conversion=True, + candidate_finite_ordered=True, optimizer_updates=0) +(R / 'split_patch_checks.json').write_text(json.dumps(receipt, indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/convert.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..9a16c87c0cf45b0efb1b2e56008a821c8391b471 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/convert.py @@ -0,0 +1,13 @@ +"""Convert the already locally trained patch8 model to input8/output4 without external assets.""" +import argparse,hashlib,json,time +from pathlib import Path +import torch +ap=argparse.ArgumentParser();ap.add_argument('--input',required=True);ap.add_argument('--output',required=True);a=ap.parse_args() +torch.set_num_threads(1);started=time.monotonic();ck=torch.load(a.input,map_location='cpu',weights_only=False);state=ck['model'];d=ck['config']['d'];assert ck['config']['patch']==8 +x=state['query.0.weight'].reshape(d,8,9);state['query.0.weight']=(x[:,:4]+x[:,4:]).reshape(d,36) +x=state['recency.weight'].reshape(d,8,4);state['recency.weight']=(x[:,:4]+x[:,4:]).reshape(d,16) +state['head.weight']=state['head.weight'].reshape(8,18,d)[:4].reshape(72,d).clone();state['head.bias']=state['head.bias'].reshape(8,18)[:4].reshape(72).clone() +ck['config']['patch']=4;ck['config']['input_patch']=8 +conversion={'method':'retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates','exact_function_preservation':False,'parent_sha256':hashlib.sha256(Path(a.input).read_bytes()).hexdigest()} +ck.update(step=0,args={'packed':ck['args']['packed'],'initialize_from':str(Path(a.input).resolve()),'converted':True},parent_checkpoints=[str(Path(a.input).resolve())],conversion=conversion) +torch.save(ck,a.output);receipt={**conversion,'checkpoint_sha256':hashlib.sha256(Path(a.output).read_bytes()).hexdigest(),'parameters':sum(v.numel() for v in state.values()),'cpu_seconds':time.monotonic()-started,'optimizer_updates':0};Path(a.output).with_suffix('.json').write_text(json.dumps(receipt,indent=2));print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/launch.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/launch.py new file mode 100644 index 0000000000000000000000000000000000000000..d3156fc48da2d25d324c5fb7cc2a50f7f70738d7 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/launch.py @@ -0,0 +1,33 @@ +"""Run input8/output4 after late patch8 slowAR releases its allocation.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R = Path('/workspace/research') + assert json.loads((R / 'split_patch_checks.json').read_text())['equal_patch_forward_bitwise_unchanged'] + assert json.loads((R / 'split_patch_memory_check.json').read_text())['peak_reserved_mib'] < 14000 + env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + command = ['python3', str(R / 'recovery/train.py'), '--code-dir', str(R / 'split_patch'), + '--packed', str(R / 'packed_sample'), '--source-weights-from', str(R / 'packed_sample'), + '--out', str(R / 'runs/split_patch'), '--initialize-from', str(R / 'split_patch_initial.pt'), + '--steps', '12000', '--batch', '32', '--lr', '.00002', '--seed', '401', + '--loss-mode', 'paired', '--stop-file', str(R / 'split_patch.stop')] + with (R / 'split_patch_queue.log').open('w') as qlog, (R / 'split_patch_watch.log').open('w') as wlog: + queued = subprocess.Popen(['python3', str(R / 'queued_train.py'), '--label', 'E93 input8/output4 seed401', + '--log', str(R / 'split_patch_train.log'), '--receipt', str(R / 'split_patch_queue.json'), + '--wait-pid', '7349', '--require-checkpoint', str(R / 'runs/patch8_long_memory/recovery.pt'), + '--', *command], stdout=qlog, stderr=subprocess.STDOUT, env=env) + watch = subprocess.Popen(['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs/split_patch'), + '--evaluator', str(R / 'split_patch_inference/evaluate.py'), + '--name', 'split_patch', '--steps', '1000,3000,6000,12000'], + stdout=wlog, stderr=subprocess.STDOUT, env=env) + print({'queue_pid': queued.pid, 'watch_pid': watch.pid}, flush=True) + result = queued.wait() + if result: + watch.terminate() + watch.wait() + raise SystemExit(result) + +if __name__ == '__main__': + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..7ae2014f738a03f54cbd2208eb9095efe16b009c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/memory_check.py @@ -0,0 +1,18 @@ +"""Maximum-shape memory check for the matched patch comparison, including training state.""" +import argparse,fcntl,json,sys,time +from pathlib import Path +import torch +R=Path('/workspace/research');sys.path.insert(0,str(R/'split_patch')) +from model import DirectForecaster,loss_fn +from data import Sampler +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +with open(R/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX);torch.set_num_threads(1);torch.manual_seed(401);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic();ck=torch.load(a.weights,map_location='cpu',weights_only=False);model=DirectForecaster(**ck['config']).cuda();model.load_state_dict(ck['model']) + ema=[p.detach().clone() for p in model.parameters()];moments=[(torch.zeros_like(p),torch.zeros_like(p)) for p in model.parameters()] + x,y,p=[torch.from_numpy(v).cuda() for v in Sampler(R/'packed_sample',seed=401).sample(32,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize();assert torch.isfinite(loss) + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in model.parameters()) + result={'seed':401,'batch':32,'signed_rows':64,'patch':model.patch,'input_patch':model.input_patch,'context':4096,'horizon':1024,'EMA_and_AdamW_moment_storage_present':True,'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started,'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20,'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + Path(a.out).write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/model.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member2/training/split_patch/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..58fef8f33bec4188c92f98475e251ede3a91f15e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/model_manifest.json @@ -0,0 +1,307 @@ +{ + "name": "direct-seasonal-fresh146m", + "contract": "timeseries-forecast/v1", + "parameters": 146477344, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 307", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 307", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 307", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300310" + ], + "weights_sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "runs/random_capacity_1024/ema048000.pt", + "sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "step": 48000, + "seed": 307, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 48, + "lr": 0.0002, + "steps": 96000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": true, + "synthetic_ar_time_constants": [ + 1, + 10000 + ], + "requested_horizon_seed": 300310, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "random_capacity_1024_initial.pt" + ] + }, + { + "checkpoint": "random_capacity_1024_initial.pt", + "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", + "step": 0, + "seed": 307, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "predict.py": "5583ff7e00623f91b7ef4cfbefa8ba8e08c7a0666efb3be58915c1296892f19c", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe" + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 65536, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 6144, + "backbone_frozen_during_projection_training": false, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Projection trained jointly from random initialization; all training stages are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "random_capacity/check.py": "c5090883cc4e983a41041a319a5260f4d1d5c88bb3133b0651ea5e077845fb8d", + "random_capacity/check_anneal_schedule.py": "e7a431afbd93b3a542786781a4065d5802743965dadc42759cb1d3d50c3adbd5", + "random_capacity/data.py": "d84032a33937a465acfc9e1b97004ca8d9db221509bb2710e74500703ade4344", + "random_capacity/initialize.py": "2a3326d8f2340e9f3fb9ccdea4a69c94c25f9cb969b883ec5e89bb7a53e1e317", + "random_capacity/launch_anneal.py": "3e3b8784781519f77fffac9f683eea847d14df92bf829c2022e520a6074fbb25", + "random_capacity/launch_legacy.py": "d9bd7980146ccb62c292907aa50713e37d0be2dfeac829cf075c140747e9041a", + "random_capacity/launch_lower_rate.py": "44ce2d26ce1adc76023893e82734c2634c840541e7f88f9cef5b51e503a1ef97", + "random_capacity/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "random_capacity/queue_recovery3.py": "72b59dff33a62ccb584cece127fb3e0d1631a893ab3d5ffb791a3398f9d902f2", + "random_capacity/restart_corrected.py": "1f020aa304f1ce92d452ed884d0dbe5a0607f2d2c2fb6537f9e0bcf42412fde9", + "recovery/brief.py": "1d5f3d530d46c437fc5d747cac9f702835b783e0f87fea2f638d00d93acad90c", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/launch_matched_cutoffs.py": "7d5b9b569df284c143bb4fe50033ed6be21ff1b54cb4405723b2ebcdefe6e562", + "recovery/matched_report.py": "82696104e2e7da9cee48611e42aebc0f5c4916f2273fdeb9a3158c4dd3700b04", + "recovery/pack_composition.py": "66c198e44b55fc4dce50dec505a0127eb9d97390e04d0f97c271ace11ad0f49f", + "recovery/quantile_coverage.py": "7a4057d1aa38c5e7de0ca601db0003a8fd3a9a2e6123b2fdb81fa8aedbc34787", + "recovery/reclaim_completed_cache.py": "d0a23e5a73b362f03a3be0d9fcc8dd5292d17da0489484a9c52af84bd05d9638", + "recovery/refresh_journal.py": "6ccbbbf7494f3b310f2e4d47e572487b62494ae52ef6598de93ce8ae28c8a7a5", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/seasonal_history_support.py": "fe2da1a695715c3add9472f0bfebc946783b179b1a8415f85565a937885f7076", + "recovery/snapshot.py": "a6d03761df590b9cb5aedefdebd4f9e6ae6a4aa05b27ef5e3dac16388491a2da", + "recovery/synthetic_window_audit.py": "912e38fd094f35fb528a77388d8076600207b369bb3b2c2133a24c3c485019a1", + "recovery/train.py": "39170d026adb9c43071d2618fd10955acbc52bff92c5fcba4b4ba3e3f07be861", + "recovery/watch_matched_cutoffs.py": "177dbe6d8b5186dd3ce1c4b261a55cd5cfb44f6ed2922ef64b489deb2117fa6b" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3b6d1440f762d7e57f47bb267df05b5dd786c223 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/check.py @@ -0,0 +1,49 @@ +"""Measure maximum training memory and verify compiled paired-loss gradients.""" +import argparse +import fcntl +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--width',type=int,required=True);a=ap.parse_args() +R=Path('/workspace/research');lock=open(R/'.evaluation.lock','a');fcntl.flock(lock,fcntl.LOCK_EX) +torch.set_num_threads(1);torch.manual_seed(313);torch.backends.cuda.matmul.allow_tf32=True +started=time.monotonic();ck=torch.load(R/f'random_capacity_{a.width}_initial.pt',map_location='cpu',weights_only=False) +m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) +sampler=Sampler(R/'packed_sample',seed=313,source_weights_from=R/'packed_sample') +arrays=sampler.sample(48,4096,1024);x,y,p=[torch.from_numpy(v).cuda() for v in arrays] +# Placeholders account for the EMA and two Adam moments without taking any update. +state_placeholders=[torch.empty_like(v) for v in m.parameters() for _ in range(3)] +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +memory={'batch':48,'signed_rows':96,'context':4096,'horizon':1024,'loss':float(loss.detach()), + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} +del state_placeholders,loss,x,y,p,arrays +m.zero_grad(set_to_none=True);torch.cuda.empty_cache() +x,y,p=[torch.from_numpy(v).cuda() for v in sampler.sample(8,512,128)] +def step(fn): + m.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=fn(m,x,y,p,paired=True) + loss.backward() + return float(loss.detach()) +reference=step(loss_fn);grads={n:v.grad.detach().clone() for n,v in m.named_parameters()} +compile_started=time.monotonic();actual=step(torch.compile(loss_fn,fullgraph=True,dynamic=False));torch.cuda.synchronize() +dot=norma=normb=0.;maximum=0. +for name,v in m.named_parameters(): + left,right=grads[name],v.grad + assert torch.isfinite(right).all() + dot+=float((left*right).sum());norma+=float(left.square().sum());normb+=float(right.square().sum()) + maximum=max(maximum,float((left-right).abs().max())) +cosine=dot/(norma*normb)**.5 +assert abs(reference-actual)<.003*max(reference,.1) and cosine>.995 +result={'normalization_overflow_fallback':True,'width':a.width,'initialization_seed':307,'fixture_seed':313,'optimizer_updates':0, + 'maximum_shape_memory':memory,'eager_loss':reference,'compiled_loss':actual, + 'gradient_cosine':cosine,'max_gradient_difference':maximum, + 'compile_comparison_seconds':time.monotonic()-compile_started, + 'total_seconds':time.monotonic()-started,'source':'allowed packed_sample and own synthetic generator only'} +(R/f'random_capacity_{a.width}_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/check_anneal_schedule.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/check_anneal_schedule.py new file mode 100644 index 0000000000000000000000000000000000000000..6c52591b8672097d4dd3466bc7850131929588ce --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/check_anneal_schedule.py @@ -0,0 +1,24 @@ +"""Check the new cooldown and unchanged default learning-rate arithmetic.""" +import json +import math +import sys +import time +from pathlib import Path +R=Path('/workspace/research');sys.path.insert(0,str(R/'recovery')) +from schedules import learning_rate +started=time.monotonic() +checked=0 +for total,peak,reset in [(12000,2e-5,-1),(96000,2e-4,-1),(32000,3e-5,8000)]: + for step in range(1,total+1): + warm=step-reset if reset>=0 and step>reset else step + original=peak*min(1,warm/400)*(.2+.4*(1+math.cos(math.pi*step/total))) + assert learning_rate(step,total,peak,reset)==original + checked+=1 +start=learning_rate(24000,96000,2e-4) +values=[learning_rate(i,36000,2e-4,-1,24000,start,1e-5) for i in range(24000,36001)] +assert values[0]==start and values[-1]==1e-5 +assert all(08 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/initialize.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/initialize.py new file mode 100644 index 0000000000000000000000000000000000000000..ff8f0f3e2d3f9dfa2e8378e90c31bab5ecf4d22e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/initialize.py @@ -0,0 +1,26 @@ +"""Create fresh local random initializations for the matched capacity comparison.""" +import hashlib +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster + +R=Path('/workspace/research');torch.set_num_threads(2) +receipts=[] +for d,heads in [(512,8),(1024,16)]: + start=time.monotonic();torch.manual_seed(307) + model=DirectForecaster(d=d,heads=heads,enc_layers=6,dec_layers=4,patch=16, + recency_features=True,confidence_features=True,partial_target_lengths=True) + path=R/f'random_capacity_{d}_initial.pt' + assert not path.exists(),path + ck={'model':model.state_dict(),'config':model.config,'step':0, + 'args':{'packed':str(R/'packed_sample'),'seed':307}, + 'initialization':{'method':'torch modules initialized locally, zero output weights with fixed seasonal-mixture and interval biases', + 'seed':307,'parent_weights':[]}, + 'parent_checkpoints':[],'lr_multipliers':{}} + torch.save(ck,path) + receipts.append({'path':str(path),'sha256':hashlib.sha256(path.read_bytes()).hexdigest(), + 'parameters':sum(p.numel() for p in model.parameters()),'seed':307, + 'cpu_seconds':time.monotonic()-start,'optimizer_updates':0}) +(R/'random_capacity_initialization.json').write_text(json.dumps(receipts,indent=2));print(json.dumps(receipts)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_anneal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_anneal.py new file mode 100644 index 0000000000000000000000000000000000000000..b192187a1714510e172dd17378cc6b85bff26744 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_anneal.py @@ -0,0 +1,38 @@ +"""Branch one fresh37M run for a matched training-only cooldown comparison.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + snapshot=json.loads((R/'random_capacity_512_recovery024000.json').read_text());assert snapshot['step']==24000 + check=json.loads((R/'random_capacity_anneal_checks.json').read_text());assert check['default_steps_bitwise_equal']==140000 + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1',TORCHINDUCTOR_COMPILE_THREADS='2',MAX_JOBS='2', + PYTHONPATH=str(R/'compiler_support'),TRITON_CACHE_MANAGER='sibling_cache:SiblingFileCacheManager', + TRITON_CACHE_DIR='/tmp/timeseries-triton-cache',TORCHINDUCTOR_CACHE_DIR='/tmp/timeseries-inductor-cache') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'random_capacity'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/random_capacity_512_anneal'),'--initialize-from',str(R/'random_capacity_512_initial.pt'), + '--resume',str(R/'random_capacity_512_recovery024000.pt'),'--steps','36000','--batch','48', + '--lr','.0002','--seed','307','--loss-mode','paired','--compile-loss', + '--anneal-from-step','24000','--anneal-from-lr',str(check['join_lr']),'--anneal-final-lr','.00001', + '--stop-file',str(R/'random_capacity_512_anneal.stop')] + with (R/'random_capacity_512_anneal_queue.log').open('w') as qlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E99 fresh37M early cooldown', + '--log',str(R/'random_capacity_512_anneal_train.log'), + '--receipt',str(R/'random_capacity_512_anneal_queue.json'), + '--wait-pid','5689','--require-checkpoint',str(R/'runs/patch4_candidate/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watchers=[] + for name in ['random_capacity_512_anneal','random_capacity_512']: + with (R/(name+'_cooldown_watch.log')).open('w') as log: + watchers.append(subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs'/name), + '--evaluator',str(R/'random_capacity_inference/evaluate.py'),'--name',name, + '--steps','30000,36000'],stdout=log,stderr=subprocess.STDOUT,env=env)) + print({'queue_pid':queued.pid,'watch_pids':[p.pid for p in watchers]},flush=True) + result=queued.wait() + if result: + for p in watchers:p.terminate() + for p in watchers:p.wait() + raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_legacy.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_legacy.py new file mode 100644 index 0000000000000000000000000000000000000000..5bf7ac326ec15b02e9caea0b6357babc57c3d6e5 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_legacy.py @@ -0,0 +1,43 @@ +def main(): + """Queue the matched fresh-width pair after two existing allocations are released.""" + import json + from pathlib import Path + import subprocess + + R=Path('/workspace/research') + recovery=json.loads((R/'recovery2_launch_receipt.json').read_text()) + dependencies=['wide_capacity_146m_recovery','patch8'] + wait_pids=[recovery['jobs'][name]['pid'] for name in dependencies] + children=[] + for width in [512,1024]: + checks=json.loads((R/f'random_capacity_{width}_checks.json').read_text()) + assert checks['gradient_cosine']>.995 + name=f'random_capacity_{width}' + train=['env','OPENBLAS_NUM_THREADS=1','OMP_NUM_THREADS=1', + 'TORCHINDUCTOR_COMPILE_THREADS=2','MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache', + 'python3',str(R/'recovery/train.py'),'--code-dir',str(R/'random_capacity'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs'/name),'--initialize-from',str(R/f'{name}_initial.pt'), + '--steps','96000','--batch','48','--lr','.0002','--seed','307', + '--loss-mode','paired','--compile-loss','--stop-file',str(R/f'{name}.stop')] + command=['python3',str(R/'queued_train.py'),'--label',f'E79 fresh{width} seed307', + '--log',str(R/f'{name}_train.log'),'--receipt',str(R/f'{name}_queue.json')] + for pid in wait_pids:command+=['--wait-pid',str(pid)] + for dep in dependencies:command+=['--require-checkpoint',str(R/'runs'/dep/'recovery.pt')] + command+=['--']+train + with (R/f'{name}_queue.log').open('w') as f: + children.append(subprocess.Popen(command,stdout=f,stderr=subprocess.STDOUT)) + watch=['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs'/name), + '--evaluator',str(R/'random_capacity_inference/evaluate.py'),'--name',name, + '--steps','4000,8000,16000,24000,48000,72000,96000'] + with (R/f'{name}_watch.log').open('w') as f: + subprocess.Popen(watch,stdout=f,stderr=subprocess.STDOUT) + for child in children:child.wait() + assert all(child.returncode==0 for child in children) + +if __name__ == "__main__": + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_lower_rate.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_lower_rate.py new file mode 100644 index 0000000000000000000000000000000000000000..a9b2c79450b71b081832e7eaf0dce361c7da2a8d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/launch_lower_rate.py @@ -0,0 +1,40 @@ +"""Queue a single-factor lower-learning-rate arm for the fresh146M model.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R = Path('/workspace/research') + checks = json.loads((R / 'random_capacity_1024_checks.json').read_text()) + assert checks['gradient_cosine'] > .995 and checks['normalization_overflow_fallback'] + name = 'random_capacity_1024_halflr' + env = dict(os.environ, OPENBLAS_NUM_THREADS='1', OMP_NUM_THREADS='1') + train = ['env', 'OPENBLAS_NUM_THREADS=1', 'OMP_NUM_THREADS=1', + 'TORCHINDUCTOR_COMPILE_THREADS=2', 'MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache', + 'python3', str(R / 'recovery/train.py'), '--code-dir', str(R / 'random_capacity'), + '--packed', str(R / 'packed_sample'), '--source-weights-from', str(R / 'packed_sample'), + '--out', str(R / 'runs' / name), '--initialize-from', str(R / 'random_capacity_1024_initial.pt'), + '--steps', '96000', '--batch', '48', '--lr', '.0001', '--seed', '307', + '--loss-mode', 'paired', '--compile-loss', '--stop-file', str(R / (name + '.stop'))] + with (R / (name + '_queue.log')).open('w') as qlog, (R / (name + '_watch.log')).open('w') as wlog: + queued = subprocess.Popen(['python3', str(R / 'queued_train.py'), '--label', 'E94 fresh146M halfLR seed307', + '--log', str(R / (name + '_train.log')), '--receipt', str(R / (name + '_queue.json')), + '--wait-pid', '5690', '--require-checkpoint', str(R / 'runs/patch4_control/recovery.pt'), + '--', *train], stdout=qlog, stderr=subprocess.STDOUT, env=env) + watch = subprocess.Popen(['python3', str(R / 'watch_evaluate.py'), '--run', str(R / 'runs' / name), + '--evaluator', str(R / 'random_capacity_inference/evaluate.py'), '--name', name, + '--steps', '4000,8000,16000,24000,48000,72000,96000'], + stdout=wlog, stderr=subprocess.STDOUT, env=env) + print(json.dumps({'queue_pid': queued.pid, 'watch_pid': watch.pid}), flush=True) + result = queued.wait() + if result: + watch.terminate() + watch.wait() + raise SystemExit(result) + +if __name__ == '__main__': + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/model.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/queue_recovery3.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/queue_recovery3.py new file mode 100644 index 0000000000000000000000000000000000000000..ca60d7ce3a745482824790ba818da843c84274fc --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/queue_recovery3.py @@ -0,0 +1,44 @@ +def main(): + """Queue the matched fresh-width pair after two existing allocations are released.""" + import json + from pathlib import Path + import subprocess + + R=Path('/workspace/research') + recovery=json.loads((R/'recovery3_launch_receipt.json').read_text()) + dependencies=['wide_capacity_146m_recovery','patch8'] + wait_pids=[recovery['jobs'][name]['pid'] for name in dependencies] + children=[] + for width in [512,1024]: + checks=json.loads((R/f'random_capacity_{width}_checks.json').read_text()) + assert checks['gradient_cosine']>.995 and checks.get('normalization_overflow_fallback') is True + name=f'random_capacity_{width}' + train=['env','OPENBLAS_NUM_THREADS=1','OMP_NUM_THREADS=1', + 'TORCHINDUCTOR_COMPILE_THREADS=2','MAX_JOBS=2', + 'PYTHONPATH=/workspace/research/compiler_support', + 'TRITON_CACHE_MANAGER=sibling_cache:SiblingFileCacheManager', + 'TRITON_CACHE_DIR=/tmp/timeseries-triton-cache', + 'TORCHINDUCTOR_CACHE_DIR=/tmp/timeseries-inductor-cache', + 'python3',str(R/'recovery/train.py'),'--code-dir',str(R/'random_capacity'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs'/name),'--initialize-from',str(R/f'{name}_initial.pt'), + '--steps','96000','--batch','48','--lr','.0002','--seed','307', + '--loss-mode','paired','--compile-loss','--stop-file',str(R/f'{name}.stop')] + command=['python3',str(R/'queued_train.py'),'--label',f'E79 fresh{width} seed307', + '--log',str(R/f'{name}_train.log'),'--receipt',str(R/f'{name}_queue.json')] + for pid in wait_pids:command+=['--wait-pid',str(pid)] + for dep in dependencies:command+=['--require-checkpoint',str(R/'runs'/dep/'recovery.pt')] + command+=['--']+train + with (R/f'{name}_queue.log').open('w') as f: + children.append(subprocess.Popen(command,stdout=f,stderr=subprocess.STDOUT)) + watch=['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs'/name), + '--evaluator',str(R/'random_capacity_inference/evaluate.py'),'--name',name, + '--steps','4000,8000,16000,24000,48000,72000,96000'] + with (R/f'{name}_watch.log').open('w') as f: + watcher=subprocess.Popen(watch,stdout=f,stderr=subprocess.STDOUT) + print(json.dumps({'width':width,'queue_pid':children[-1].pid,'watch_pid':watcher.pid}),flush=True) + for child in children:child.wait() + assert all(child.returncode==0 for child in children) + +if __name__ == "__main__": + main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/restart_corrected.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/restart_corrected.py new file mode 100644 index 0000000000000000000000000000000000000000..0fa492437cc10d940ab177575b4583064dedfcb5 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/random_capacity/restart_corrected.py @@ -0,0 +1,13 @@ +"""Validate the shared numerical correction, then start exactly one matched fresh pair.""" +def main(): + import json,os,subprocess,time + from pathlib import Path + R=Path('/workspace/research');env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1',TORCHINDUCTOR_COMPILE_THREADS='2',MAX_JOBS='2',PYTHONPATH=str(R/'compiler_support'),TRITON_CACHE_MANAGER='sibling_cache:SiblingFileCacheManager',TRITON_CACHE_DIR='/tmp/timeseries-triton-cache',TORCHINDUCTOR_CACHE_DIR='/tmp/timeseries-inductor-cache') + for width in (512,1024): + assert not list((R/'runs'/f'random_capacity_{width}').glob('*.pt')) + log=R/f'random_capacity_{width}_corrected_check.log' + with log.open('w') as f:subprocess.run(['python3',str(R/'random_capacity/check.py'),'--width',str(width)],stdout=f,stderr=subprocess.STDOUT,env=env,check=True) + result=json.loads((R/f'random_capacity_{width}_checks.json').read_text());print(json.dumps(result),flush=True) + with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\nE79 corrected-normalization fixture: '+json.dumps(result)+'\n') + subprocess.run(['python3',str(R/'random_capacity/queue_recovery3.py')],env=env,check=True) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/brief.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/brief.py new file mode 100644 index 0000000000000000000000000000000000000000..fe8d5ced0c95c0dfa3aa225eeb7c32d6fc34111c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/brief.py @@ -0,0 +1,33 @@ +"""Write a short, current recovery handoff; never modify training state.""" +import datetime +import json +from pathlib import Path + +R = Path('/workspace/research') +s = json.loads((R/'CURRENT_RESEARCH_STATE.json').read_text()) +lines = ['# Current recovery brief', '', datetime.datetime.now(datetime.timezone.utc).isoformat(), '', + 'Continuous research; no endpoint/final hand-in. One H10080GB,22CPUs,224GiB requested RAM; no network or pretrained assets. Do not inspect credentials or spawn agents.', '', + '## Published', '', json.dumps(s['published']), '', '## Pending selection', '', + json.dumps(s.get('next_candidate',{})), '', json.dumps(s.get('selection_probes',{}).get('E124',{})), '', '## Active and queued training', ''] +for name, job in s.get('external_jobs',{}).items(): + if job['status'] not in ['running','waiting']: + continue + lines += [f'- {name}: {job["status"]}; receipt {job["receipt"]}; queue PID snapshot {job["queue_pid_at_snapshot"]}; children {job["child_pids_at_snapshot"]}.', + f' Last logged record: {json.dumps(job["last_phase_record"])}', + f' Complete recovery: {job["complete_recovery_checkpoint"]}; latest EMA: {job["latest_saved_ema"]}.'] +lines += ['', '## Recovery rules', '', + '- PIDs and launch-script dependencies are snapshots. After an operator restart, restore running jobs from each complete recovery.pt, preserving optimizer/EMA/RNG/prefetched batch and original schedules. Rewire waiting jobs to the newly launched dependency PIDs; do not blindly rerun old launch scripts.', + '- Waiting dependency chain: weekly_replication_control after long_seasonal; weekly_replication_candidate after that control; lowfreq_windows after that candidate; long_seasonal_replication after lowfreq_windows. phase_joint waits for random_capacity_512 final96000; seasonal_dispersion waits for phase_joint final12000; seasonal_history waits for seasonal_dispersion final12000. random_capacity_original_ar waits for random_capacity_1024 final96000; log_horizon waits for long_seasonal_replication final12000; seasonal_width waits for seasonal_history final12000; random_capacity_long_seasonal waits for both E94halfLR and E79wide final96000 and replaces only the E94allocation.', + '- E121 history-aware ensemble runtime is prepared at history_three_patch_ensemble; synthetic audit checks exact standalone composition and ordinary legacy equality. It also applies member finite cleanup before averaging, correcting a pre-existing extreme-value discrepancy. Use this separate publisher and complete public replay before any E121 publication; E127 published this runtime at08:29:14; use history_three_patch_ensemble for future ensembles.', + '- E126 compiled_teacher_trial completed its mandatory17000stop; do not resume it. It preserved original96000 LR schedule from immutable distill_ensemble_recovery016000.pt. Original E101 stays active; no takeover or coefficient change selected; four-cutoff comparison pending. E125 component ablations completed; both paths help. E127 finite-member numerical fix is published with all97predictions bitwise unchanged; do not republish it. E128 dispersion transfer6000 is in four-cutoff selection. Receipts are indexed in CURRENT_RESEARCH_STATE.json.', + '- E101 distillation teacher is immutable /workspace/research/distill_teacher_E96, even after later publications. Do not substitute the current submission.', + '- Restore compiler_cache_backup to the same /tmp cache paths before restarting compiled trainers. Exact environment and commands are in CURRENT_RESEARCH_STATE.json.', + '- E105 output collision is documented in incidents/stratified_volume_output_collision. Correct E105 output is runs/stratified_volume. E95final and2k..12k weights survive, but E95optimizer recovery and original1k weights were lost. Do not resume completed E95.', + '- All previous negative/stopped branches stay stopped unless a new matched experiment explicitly revisits them. Never retrain the supplied baselines.', + '- Current training-source publisher archives all Python modules from explicitly declared directories, fixing earlier omissions of spectral.py and schedules.py. Complete-source members carry a -complete suffix when rebuilt. Runtime/weight hashes were unchanged.', + '- Full evaluation and GPU diagnostics use .evaluation.lock; the six main trainers share the one H100. The bounded E126 seventh-process probe completed17000 and should remain stopped. Dataset windows under data/valid and all earlier cutoffs are selection only, never training.', + '- Master journal direct_v1/EXPERIMENTS.md, chronological SESSION_20261023_PROGRESS.md, and RESEARCH_IDEAS.md contain decisions and rejected candidates. Recheck live processes and latest reports before acting.', + '', '## Time anchor', '', + 'Latest operator recovery allowance:151596research seconds at2026-10-23T02:45:51UTC. Pauses/preflight excluded. The goal remains active and has no requested token budget.', ''] +(R/'RECOVERY_BRIEF.md').write_text('\n'.join(lines)) +print('Wrote RECOVERY_BRIEF.md with '+str(sum(j['status'] in ['running','waiting'] for j in s.get('external_jobs',{}).values()))+' active/queued jobs.') diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/launch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/launch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..6d33e64b8212b250fc38a2990604c80228b94c80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/launch_matched_cutoffs.py @@ -0,0 +1,14 @@ +"""Keep evaluation controllers alive for the declared queued comparisons.""" +from pathlib import Path +import datetime,json,os,subprocess +R=Path('/workspace/research');jobs={};processes={};env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') +for name,control,runtime,label in [('lowfreq_windows','overflow_control','postloss_inference','E113'),('seasonal_history','long_seasonal','seasonal_history_inference','E121'),('seasonal_width','seasonal_dispersion','seasonal_width_inference','E129'),('long_seasonal_replication','weekly_replication_control','long_seasonal_inference','E118'),('log_horizon','overflow_control','postloss_inference','E123')]: + path=R/(name+'_matched_cutoffs.log') + with path.open('a') as log: + command=['python3',str(R/'recovery/watch_matched_cutoffs.py'),'--run',name,'--control',control,'--evaluator',str(R/runtime/'evaluate.py'),'--label',label] + p=subprocess.Popen(command,stdout=log,stderr=subprocess.STDOUT,env=env) + processes[label]=p;jobs[label]=dict(pid=p.pid,parent_pid=os.getpid(),command=command,log=str(path),receipt=str(R/(name+'_matched_cutoffs_receipt.json'))) +q=R/'CURRENT_RESEARCH_STATE.json';state=json.loads(q.read_text());state['diagnostics']['matched_cutoff_controllers']=jobs;t=q.with_suffix('.tmp');t.write_text(json.dumps(state,indent=2));os.replace(t,q) +print(json.dumps(jobs),flush=True) +for label,p in processes.items(): + result=p.wait();print(json.dumps(dict(label=label,returncode=result)),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/matched_report.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/matched_report.py new file mode 100644 index 0000000000000000000000000000000000000000..f7755cfc0300a5a18f3e2db1d6d5aa89cda9f0fa --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/matched_report.py @@ -0,0 +1,16 @@ +"""Record matched validation reports, including all configuration-group metrics.""" +import argparse,datetime,json,math +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['candidate','control','label','out']:ap.add_argument('--'+key,required=True) +ap.add_argument('--cutoffs',default='0');ap.add_argument('--outcome',required=True);a=ap.parse_args() +folders=['evals','backcast_evals','backcast2_evals','backcast3_evals'];rows=[] +for index in map(int,a.cutoffs.split(',')): + folder=folders[index];x=json.loads((R/folder/a.candidate/'report.json').read_text());y=json.loads((R/folder/a.control/'report.json').read_text()) + assert x['n_failed']==y['n_failed']==0 and x['n_configs']==y['n_configs'] + delta={g:{k:math.sqrt(y['groups'][g][k]['rel_mase_gmean']*y['groups'][g][k]['rel_wql_gmean'])-math.sqrt(v['rel_mase_gmean']*v['rel_wql_gmean']) for k,v in entries.items()} for g,entries in x['groups'].items()} + rows.append(dict(cutoff=folder,candidate_skill=x['skill_score'],control_skill=y['skill_score'],delta=x['skill_score']-y['skill_score'],candidate_checkpoint=x['checkpoint_sha256'],control_checkpoint=y['checkpoint_sha256'],candidate_eval_seconds=x.get('eval_seconds'),candidate_groups=x['groups'],control_groups=y['groups'],group_skill_delta=delta)) +result=dict(label=a.label,utc=datetime.datetime.now(datetime.timezone.utc).isoformat(),candidate=a.candidate,control=a.control,rows=rows,mean_delta=sum(v['delta'] for v in rows)/len(rows),positive_cutoffs=sum(v['delta']>0 for v in rows),outcome=a.outcome) +p=Path(a.out);assert not p.exists(),'Refuse duplicate comparison record';p.write_text(json.dumps(result,indent=2)) +with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\n'+a.label+': '+json.dumps(result)+'\n') +print(json.dumps({k:v for k,v in result.items() if k!='rows'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/pack_composition.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/pack_composition.py new file mode 100644 index 0000000000000000000000000000000000000000..0a023de983f7c0860043b58def56406e3fd27eb9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/pack_composition.py @@ -0,0 +1,32 @@ +"""Read-only comparison of source/length composition in the two allowed packs.""" +import json,time +from pathlib import Path +import numpy as np +R=Path('/workspace/research');started=time.monotonic();old=R/'packed_sample';new=R/'packed_stratified_full' +a=json.loads((old/'meta.json').read_text());b=json.loads((new/'meta.json').read_text());assert a['dirs']==b['dirs'];names=a['dirs'] +weights=[] +for n in names: + w=min((old/(n+'.bin')).stat().st_size//4,20000000)**.25 + if n.startswith(('era5_','cmip6_')):w*=.35 + if n.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) +weights=np.array(weights)/sum(weights);bins=np.array([16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131073]) +rows=[];aggregate={k:np.zeros(len(bins)-1) for k in ['old','full']} +for n,w in zip(names,weights): + row={'source':n,'conditional_real_source_probability':float(w)} + for k,root in [('old',old),('full',new)]: + lengths=np.diff(np.load(root/(n+'.offsets.npy'),mmap_mode='r')) + hist=np.histogram(lengths,bins=bins)[0]/len(lengths);aggregate[k]+=w*hist + row[k]={'series':len(lengths),'points':int(lengths.sum()),'mean_length':float(lengths.mean()),'median_length':float(np.median(lengths)), + 'fraction_below64':float(np.mean(lengths<64)),'fraction_below256':float(np.mean(lengths<256)), + 'fraction_at_least20480':float(np.mean(lengths>=20480)),'length_bin_probabilities':hist.tolist()} + row['weighted_length_distribution_l1']=float(w*np.abs(np.array(row['old']['length_bin_probabilities'])-row['full']['length_bin_probabilities']).sum()) + row['mixed_frequency_rows_in_full']=b['receipts'][n]['mixed_frequency_rows_in_candidates'];row['full_frequencies']=b['receipts'][n]['kept_frequencies'];rows.append(row) +result=dict(kind='per-source uniform-series sampling composition; no series values or validation labels read', + length_bins=bins.tolist(),conditional_real_length_bin_probabilities={k:v.tolist() for k,v in aggregate.items()}, + source_probabilities_unchanged=True,min_length_both=16,max_crop_length_both=131072, + mixed_frequency_sources=[r['source'] for r in rows if r['mixed_frequency_rows_in_full']],sources=rows, + seconds=time.monotonic()-started,optimizer_updates=0) +(R/'pack_composition_comparison.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='sources'})) +for row in sorted(rows,key=lambda r:-r['weighted_length_distribution_l1'])[:12]:print(json.dumps({k:v for k,v in row.items() if k not in ['old','full']},separators=(',',':')), 'mean_length',row['old']['mean_length'],row['full']['mean_length']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/quantile_coverage.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/quantile_coverage.py new file mode 100644 index 0000000000000000000000000000000000000000..d7f4958ae772a15c4a580eed59bb9257b065154d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/quantile_coverage.py @@ -0,0 +1,59 @@ +"""Validation-only quantile coverage, with separate strict/inclusive coverage at atoms.""" +import argparse +import json +import sys +import time +from pathlib import Path + +import numpy as np + +sys.path.insert(0,'/workspace/evaluation') +from ts_io import read_prediction_file, read_truth_file + +parser = argparse.ArgumentParser() +parser.add_argument('--valid',required=True) +parser.add_argument('--pred',required=True) +parser.add_argument('--report',required=True) +parser.add_argument('--out',required=True) +args = parser.parse_args() +started = time.monotonic() +root = Path(args.valid) +index = json.loads((root/'input/index.json').read_text()) +report = json.loads(Path(args.report).read_text()) +levels = np.arange(1,10)/10 +rows = [] +for cfg in index['configs']: + relative = Path('cases')/(cfg['config_id']+'.h5') + y,scale,_ = read_truth_file(root/'truth'/relative) + _,q = read_prediction_file(Path(args.pred)/relative) + valid = np.isfinite(y) + assert q.shape==(*y.shape[:2],9,y.shape[-1]) and np.isfinite(q).all() + count = int(valid.sum()) + assert count>0 + strict = ((y[:,:,None,:] anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/seasonal_history_support.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/seasonal_history_support.py new file mode 100644 index 0000000000000000000000000000000000000000..84314b30b22a4a761447fc5ee1cffb9301e725b9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/seasonal_history_support.py @@ -0,0 +1,23 @@ +"""Context-metadata diagnostic of potential 8-cycle support, with no targets read.""" +import importlib.util,json,time +from pathlib import Path +import h5py,numpy as np +R=Path('/workspace/research');started=time.monotonic() +spec=importlib.util.spec_from_file_location('support_model',R/'long_seasonal/model.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m) +root=Path('/workspace/data/valid/input');index=json.loads((root/'index.json').read_text());rows=[] +for cfg in index['configs']: + with h5py.File(root/'cases'/(cfg['config_id']+'.h5'),'r') as f:lengths=np.asarray(f['context_length']) + h=cfg['prediction_length'];periods=m.periods_for_freq(cfg['freq']);row={k:cfg[k] for k in ['config_id','freq','term','domain']};row['periods']=periods;row['n_instances']=len(lengths) + for cap in [4096,16384]: + support=[];cycles=[] + for p in periods: + count=np.clip(1+(np.minimum(lengths,cap)[:,None]-p+np.arange(h)[None,:]%p)//p,0,16) + support.append(float(np.mean((count>=8)&(p>=2))));cycles.append(float(np.mean(np.where(p>=2,count,0)))) + row[str(cap)]={'phase_support_fraction':support,'mean_available_cycles':cycles} + row['support_gain_sum']=sum(row['16384']['phase_support_fraction'])-sum(row['4096']['phase_support_fraction']);rows.append(row) +changed=[r for r in rows if r['support_gain_sum']>0] +result=dict(kind='optimistic potential support before missing-value masks; not measured forecast improvement',input_metadata_only=True,validation_targets_read=False,optimizer_updates=0,configs=rows, + changed_configurations=len(changed),changed_domains=sorted(set(r['domain'] for r in changed)),seconds=time.monotonic()-started) +(R/'seasonal_history_support.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='configs'})) +for r in sorted(changed,key=lambda x:x['support_gain_sum'],reverse=True)[:20]:print(json.dumps(r)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/snapshot.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..32bac3687fc7ecb68c2255040c3d9cef721d2974 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/snapshot.py @@ -0,0 +1,99 @@ +"""Write a compact authoritative research recovery index without touching training state.""" +import datetime +import json +import os +from pathlib import Path + +R=Path('/workspace/research');p=R/'CURRENT_RESEARCH_STATE.json' +s=json.loads(p.read_text()) +s['snapshot_utc']=datetime.datetime.now(datetime.timezone.utc).isoformat() +receipt=json.loads((R/'recovery3_launch_receipt.json').read_text()) +s['runs']={} +for name,job in receipt['jobs'].items(): + run=R/'runs'/name + log=Path(job['log']) + records=[] + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if 'step' in record or 'completed_step' in record:records.append(record) + except json.JSONDecodeError:pass + s['runs'][name]={'config':json.loads((run/'config.json').read_text()) if (run/'config.json').exists() else None, + 'last_phase_record':records[-1] if records else None, + 'phase_log':str(log),'supervisor_receipt':str(R/'recovery3_launch_receipt.json'), + 'latest_saved_ema':str(max(run.glob('ema*.pt'))) if list(run.glob('ema*.pt')) else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'pid_at_snapshot':job['pid'],'returncode':job.get('returncode'), + 'note':'Check actual live process and checkpoint state before resuming; this is only a snapshot.'} +s['queues']={name:{'status':q['status'],'dependency':q['dependency'],'command':q['command'], + 'required_checkpoints':q['required_checkpoints']} + for name,q in receipt['queues'].items()} +s.pop('prepared_not_launched',None) +s['deferred_unqueued']={'E72':'temporal_mixup, prepared and checked but not queued','ideas':'RESEARCH_IDEAS.md, no jobs attached'} +s['completed_since_previous_recovery']={ + 'E67_control12000':{'skill':.37724286394256845,'training_loop_seconds':2794.8358458959847}, + 'E67_paired12000':{'skill':.377427077277383,'training_loop_seconds':2794.867385860998}, + 'E63_expanded146M':'Stopped8501, complete recovery retained; allocation moved to E73; inconclusive data scaling', + 'E61_slowAR':'Complete12000; E76 used6000 correction, final transfer rejected', + 'E65_recent_normalization':'Complete12000; E81 equal ensemble rejected', + 'E58_small_control':'Complete32000', + 'E58_wide146M':'Complete32000; no gain over37Mcontrol; do not resume', + 'E71_patch8':'Complete12000; selected6000 used in E87/E96/E102 ensembles', + 'E69_volatility':'Complete12000; final below matched control; no transfer', + 'E89_patch8_control':'Complete12000; final0.380847096,loop2729.052105s; selected starting E71parent remains stronger', + 'E89_fullpatch4':'Complete12000,main0.381640078; E96 used6000, E103final cached alternative mixed; loop5066.016522s', + 'E93_split_patch':'Complete12000,main0.381711986; selected final is E102 published thirdmember; loop3153.565149s', + 'E92_robust_normalization':'Complete12000,final0.377099312 belowcontrol; rejected;E97started', + 'E90_metric_scale':'Complete12000; final0.377373344 ties/slightly trailsE80; no selection; loop2702.166704s', + 'E84_coarse':'Complete12000; daily gain but weekly regression; not selected', + 'E88_late_patch8_slowAR':'Complete12000; small9k gain lost atfinal; rejected', + 'E80_overflow':'Complete12000; finaltiesoriginal; selected3k compositeE91rejected', + 'E78_multiscaleAR':'Complete12000; no gain over single slowAR', + 'E86_protected_graft':'Complete8000; below own initialization; no publication', + 'E75_postloss':'Stopped3653 deliberately; immutable snapshot retained; E98 separately declared completion active in another output, original stopfile remains', + 'E73_independent_graft':'Stopped8683 after negative8000; replaced by E86; stopfile remains', + 'E95_stratified_corpus':'Complete12000,final0.377983250,earliermixed; E105collision destroyed only1000weights and optimizer recovery;2k..12k preserved; do not resume', + 'E97_weekly_synth':'Complete12000,final0.380439539; E112final weekly correction now published; loop2600.472750s', + 'E105_stratified_volume':'Complete12000,final0.377529200,earlier0.336713522/0.359535697/0.390349158 mixed; corrected continuationloop2013.982814s plus original incident phase', + 'E106_spectral_synth':'Complete12000,final0.377641399,earlier0.337647555/0.361626447/0.385497870, average matched gap negligible; loop2206.272278s; E114fixed6000transfers in selection', + 'E98_postloss_completion':'Complete12000,final0.376034254 below3000 andcontrol; rejected,loop1995.386513s', + 'E99_early_cooldown':'Complete36000,final0.363306598 trails original36k0.364859034; rejected,loop1603.635706s', + 'E77_pairedslowAR':'Complete12000;6000 strongest main/earlier comparison'} +s['external_receipts']=[str(R/'postloss_recovery3_receipt.json'),str(R/'random_capacity_512_queue.json'),str(R/'random_capacity_1024_queue.json'),str(R/'multiscale_ar_queue.json'),str(R/'overflow_control_queue.json'),str(R/'coarse_aggregate_queue.json'),str(R/'patch8_long_memory_queue.json'),str(R/'wide_graft_frozen_queue.json'),str(R/'patch4_candidate_queue.json'),str(R/'patch4_control_queue.json'),str(R/'metric_scale_queue.json'),str(R/'robust_normalization_queue.json'),str(R/'split_patch_queue.json'),str(R/'random_capacity_1024_halflr_queue.json'),str(R/'stratified_corpus_queue.json'),str(R/'weekly_synth_queue.json'),str(R/'postloss_completion_queue.json'),str(R/'random_capacity_512_anneal_queue.json'),str(R/'distill_ensemble_queue.json'),str(R/'stratified_volume_queue.json'),str(R/'spectral_synth_queue.json'),str(R/'long_seasonal_queue.json'),str(R/'random_capacity_full_queue.json'),str(R/'weekly_replication_control_queue.json'),str(R/'weekly_replication_candidate_queue.json'),str(R/'lowfreq_windows_queue.json'),str(R/'phase_joint_queue.json'),str(R/'long_seasonal_replication_queue.json'),str(R/'seasonal_dispersion_queue.json'),str(R/'seasonal_history_queue.json'),str(R/'random_capacity_original_ar_queue.json'),str(R/'log_horizon_queue.json'),str(R/'compiled_teacher_trial_queue.json'),str(R/'seasonal_width_queue.json'),str(R/'random_capacity_long_seasonal_queue.json')] +queue_pids={'random_capacity_512_queue.json':965,'random_capacity_1024_queue.json':967, + 'multiscale_ar_queue.json':1678,'overflow_control_queue.json':1676, + 'coarse_aggregate_queue.json':3086,'patch8_long_memory_queue.json':3739, + 'wide_graft_frozen_queue.json':3931,'patch4_candidate_queue.json':4078, + 'patch4_control_queue.json':4080} +s['external_jobs']={} +for receipt_name in s['external_receipts']: + receipt_path=Path(receipt_name) + if not receipt_path.exists():continue + item=json.loads(receipt_path.read_text());command=item.get('command',[]) + if '--out' not in command:continue + run=Path(command[command.index('--out')+1]);log=Path(item.get('log',str(receipt_path).replace('_queue.json','_train.log'))) + last=None + if log.exists(): + for line in log.read_text().splitlines(): + try: + record=json.loads(line) + if isinstance(record,dict) and ('step' in record or 'completed_step' in record):last=record + except json.JSONDecodeError:pass + queue_pid=item.get('launcher_pid',queue_pids.get(receipt_path.name)) + children_file=Path(f'/proc/{queue_pid}/task/{queue_pid}/children') if queue_pid else None + children=list(map(int,children_file.read_text().split())) if children_file and children_file.exists() else [] + checkpoints=list(run.glob('ema*.pt')) + s['external_jobs'][run.name]={'receipt':str(receipt_path),'status':item.get('status'), + 'queue_pid_at_snapshot':queue_pid,'child_pids_at_snapshot':children, + 'last_phase_record':last,'log':str(log), + 'latest_saved_ema':str(max(checkpoints)) if checkpoints else None, + 'complete_recovery_checkpoint':str(run/'recovery.pt') if (run/'recovery.pt').exists() else None, + 'command':command,'note':'PIDs are only a snapshot; check actual processes and serialized state before recovery.'} +s['compiler_environment']={'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1','TORCHINDUCTOR_COMPILE_THREADS':'2','MAX_JOBS':'2','PYTHONPATH':str(R/'compiler_support'),'TRITON_CACHE_MANAGER':'sibling_cache:SiblingFileCacheManager','TRITON_CACHE_DIR':'/tmp/timeseries-triton-cache','TORCHINDUCTOR_CACHE_DIR':'/tmp/timeseries-inductor-cache'} +for job in s['external_jobs'].values(): + job['environment']=s['compiler_environment'] if '--compile-loss' in job['command'] else {'OPENBLAS_NUM_THREADS':'1','OMP_NUM_THREADS':'1'} +s['compiler_cache_backup']=str(R/'compiler_cache_backup') +for stale in ['pending','pending_actions','active_experiments','next_experiments','prepared_experiments']: + s.pop(stale,None) +tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(s,indent=2));os.replace(tmp,p) +print(s['snapshot_utc']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/synthetic_window_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/synthetic_window_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..5a6455bbd9926f9d342ee1a24ca825328a9e7e1f --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/synthetic_window_audit.py @@ -0,0 +1,63 @@ +"""Compare actual allowed/synthetic training-window dynamics without validation data.""" +import datetime +import json +from pathlib import Path +import sys +import time +import types +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'overflow_control')) +source=(R/'overflow_control/data.py').read_text() +needle='r=self.rng;ctx=np.full((batch,context),np.nan,np.float32);tgt=np.full((batch,horizon),np.nan,np.float32);periods=np.ones((batch,2),np.int64)' +assert source.count(needle)==1 +instrumented=source.replace(needle,needle+';self.audit_synthetic=np.zeros(batch,bool)') +needle='if r.random()=16 and len(target)>=4: + k=min(16,n//4,len(target)) + # Descriptive finite-observation means, not a proposed inference feature. + scale=max(float(np.std(values)),float(np.mean(np.abs(values)))*1e-4,1e-4) + past=(float(np.mean(values[-k:]))-float(np.mean(values[-2*k:-k])))/scale + future=(float(np.mean(target[:k].astype(np.float64)))-float(np.mean(values[-k:])))/scale + item.update(past_change=float(np.clip(past,-20,20)),future_change=float(np.clip(future,-20,20))) + groups.setdefault(frequency+'_'+kind,[]).append(item);counts+=1 +summary={} +for name,rows in groups.items(): + c=np.array([x['context'] for x in rows]);h=np.array([x['target'] for x in rows]) + valid=[x for x in rows if x['past_change'] is not None] + past=np.array([x['past_change'] for x in valid]);future=np.array([x['future_change'] for x in valid]) + summary[name]=dict(rows=len(rows),median_finite_context=float(np.median(c)), + context_at_most128=float(np.mean(c<=128)),context_above512=float(np.mean(c>512)), + median_finite_target=float(np.median(h)),dynamic_rows=len(valid), + median_abs_recent_change=float(np.median(np.abs(past))), + median_abs_future_change=float(np.median(np.abs(future))), + recent_future_change_correlation=float(np.corrcoef(past,future)[0,1])) +result=dict(seed=seed,rows=counts,batches=160,groups=summary,seconds=time.monotonic()-started, + generated_utc=datetime.datetime.now(datetime.timezone.utc).isoformat(), + instrumentation_first640_rows_and_rng_bitwise=True,optimizer_updates=0, + validation_data_read=False,decision='Descriptive audit only. E113 remains unchanged; no new generator selected.') +(R/'synthetic_window_audit.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..4cdae7818edfd782494fe444a1504b539d5baccf --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/train.py @@ -0,0 +1,217 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +ap.add_argument('--compile-teacher',action='store_true') +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble','random_capacity_long_seasonal'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint','seasonal_dispersion','seasonal_history','seasonal_width','random_capacity_long_seasonal'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='random_capacity_original_ar': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.synthetic_ar_coefficient_law='uniform(0.2,0.995), original generator; unchanged AR branch probability and asymptotic variance scaling' +if Path(a.code_dir).name=='log_horizon': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.requested_horizon_law='half full; half geometric quantile remap of the original uniform integer endpoint draw from min(16,max(1,H//4)) to H, then patch16 rounding; identical RNG consumption' +if Path(a.code_dir).name=='seasonal_history': + a.learned_seasonal_history_context=16384;a.recent_encoder_and_rule_context=4096 + a.history_extension_rule='extend originally full4096 real contexts before the same cutoff, preserving original recent contexts, targets, aggregation, sampler RNG and horizon RNG; synthetic extra prefix missing' +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None;teacher_predict=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + teacher_predict=teacher + if a.compile_teacher: + torch._dynamo.config.recompile_limit=64 + teacher_predict=torch.compile(teacher.__call__,fullgraph=True,dynamic=False) +else: + assert not a.compile_teacher, '--compile-teacher requires a declared own-model teacher' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/watch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/watch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..3bd2f95022f87dbe1c349575c0ec77662a2d4d6e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/member3/training/recovery/watch_matched_cutoffs.py @@ -0,0 +1,34 @@ +"""Complete declared primary/durability comparisons; never select a model automatically.""" +import argparse,datetime,json,os,subprocess,time +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['run','control','evaluator','label']:ap.add_argument('--'+key,required=True) +ap.add_argument('--control-evaluator');ap.add_argument('--steps',default='6000,12000');a=ap.parse_args();start=time.monotonic() +receipt=R/(a.run+'_matched_cutoffs_receipt.json') +state=dict(pid=os.getpid(),status='running',run=a.run,control=a.control,steps=[],started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) +def save(): + state['seconds']=time.monotonic()-start;tmp=receipt.with_suffix('.tmp');tmp.write_text(json.dumps(state,indent=2));os.replace(tmp,receipt) +def call(label,command): + state['status']=label;save();t=time.monotonic();result=subprocess.run(command);state['steps'].append(dict(label=label,returncode=result.returncode,seconds=time.monotonic()-t));save() + if result.returncode:state['status']='failed';save();raise SystemExit(result.returncode) +for step in map(int,a.steps.split(',')): + name=a.run+'_ema'+str(step);report=R/'evals'/name/'report.json';state['status']='waiting for main'+str(step);save() + while not report.exists(): + queue=R/(a.run+'_queue.json') + if queue.exists() and json.loads(queue.read_text()).get('status')=='failed':state['status']='training failed';save();raise SystemExit(1) + time.sleep(3) + time.sleep(1) + call('earlier cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',name,'--weights',str(R/'runs'/a.run/f'ema{step:06d}.pt'),'--evaluator',a.evaluator,'--cutoffs','1,2,3']) + control_name=a.control+'_ema'+str(step) + if any(not (R/folder/control_name/'report.json').exists() for folder in ['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert a.control_evaluator,'Missing matched control reports; pass --control-evaluator for their declared evaluation' + call('control cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',control_name,'--weights',str(R/'runs'/a.control/f'ema{step:06d}.pt'),'--evaluator',a.control_evaluator]) + out=R/(a.run+str(step//1000)+'k_four_cutoff_comparison.json') + if out.exists(): + cached=json.loads(out.read_text());assert cached['candidate']==name and cached['control']==a.control+'_ema'+str(step) and len(cached['rows'])==4 + for row,folder in zip(cached['rows'],['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert row['candidate_checkpoint']==json.loads((R/folder/name/'report.json').read_text())['checkpoint_sha256'] + assert row['control_checkpoint']==json.loads((R/folder/(a.control+'_ema'+str(step))/'report.json').read_text())['checkpoint_sha256'] + state['steps'].append(dict(label='reused verified matched comparison'+str(step),returncode=0,seconds=0));save();continue + call('matched comparison'+str(step),['python3',str(R/'recovery/matched_report.py'),'--candidate',name,'--control',a.control+'_ema'+str(step),'--label',a.label+' '+str(step)+' four-cutoff comparison','--cutoffs','0,1,2,3','--out',str(out),'--outcome',f'Declared comparison checkpoints {a.steps}. No transfer formula or automatic publication is selected by this controller.']) +state['status']='complete; research review required';save();print(json.dumps(state),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..40313237b17a9a47accb31b4fa27835776886c9c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/provenance/publish.py @@ -0,0 +1,104 @@ +"""Assemble and atomically publish a complete four-member, fixed-weight package.""" +import argparse +import ctypes +import hashlib +import json +import os +import shutil +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ap = argparse.ArgumentParser() +ap.add_argument('--member', action='append', required=True) +ap.add_argument('--out', required=True) +ap.add_argument('--report') +ap.add_argument('--experiments', default='/workspace/research/direct_v1/EXPERIMENTS.md') +a = ap.parse_args() +assert len(a.member) == 4 +final = Path(a.out) +stage = final.parent / f'.{final.name}-staging-{os.getpid()}' +shutil.rmtree(stage, ignore_errors=True) +stage.mkdir(parents=True) + +def digest(path): + h = hashlib.sha256() + with Path(path).open('rb') as f: + for block in iter(lambda: f.read(8 * 1024 * 1024), b''): + h.update(block) + return h.hexdigest() + +for name in ('infer.sh', 'predict.py', 'model.py', 'seasonal.py', 'continuity.py', + 'zero_mass.py', 'ts_io.py'): + shutil.copy2(HERE / 'runtime' / name, stage / name) +shutil.copy2('/opt/runtime/requirements.txt', stage / 'requirements.txt') +shutil.copy2(a.experiments, stage / 'EXPERIMENTS.md') +members, sources, lineage = [], set(), {} +for i, source in enumerate(map(Path, a.member)): + manifest = json.loads((source / 'model_manifest.json').read_text()) + assert manifest['pretrained_assets'] == [] + for shared in ['seasonal.py','continuity.py','zero_mass.py']: + assert digest(source/shared)==digest(stage/shared),'Members must retain identical fixed postprocessing rules' + name = f'member{i}.pt' + model_code = f'model{i}.py' + shutil.copy2(source / 'model.py', stage / model_code) + assert digest(stage / model_code) == manifest['runtime_code_sha256']['model.py'] + shutil.copy2(source / 'weights.pt', stage / name) + assert digest(stage / name) == manifest['weights_sha256'] + members.append({'weights': name, 'weights_sha256': manifest['weights_sha256'], + 'parameters': manifest['parameters'], 'config': manifest['config'], 'model_code': model_code}) + sources.update(manifest['sources_used']) + for item in manifest['training_lineage']: + lineage.setdefault(item['sha256'], item) + dst = stage / 'provenance' / f'member{i}' + dst.mkdir(parents=True) + shutil.copy2(source / 'model_manifest.json', dst / 'model_manifest.json') + shutil.copytree(source / 'provenance', dst / 'training') +shutil.copy2(__file__, stage / 'provenance' / 'publish.py') +descriptor = {'members': members, 'weights': [1/4]*4, + 'composition': 'mean after each member applies its fixed inference rules'} +(stage / 'config.json').write_text(json.dumps(descriptor, indent=2) + '\n') +identifier = digest(stage / 'config.json') +manifest = { + 'name': 'direct-seasonal-four-member-foundation', 'contract': 'timeseries-forecast/v1', + 'parameters': sum(m['parameters'] for m in members), 'pretrained_assets': [], + 'sources_used': sorted(sources), 'members': members, + 'checkpoint_sha256': identifier, + 'checkpoint_digest_method': 'SHA-256 of config.json, including ordered member weight hashes', + 'training_lineage': list(lineage.values()), 'ensemble_weights': [1/4]*4, + 'every_member_forecasts_every_instance': True, + 'member_history_caps': [{'input_and_summary': m['config']['max_context'], 'encoder_and_normalization': m['config'].get('encoder_context',m['config']['max_context']), 'fixed_rules': m['config'].get('encoder_context',m['config']['max_context'])} for m in members], + 'postprocessing_order': 'each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4, finite-value replacement; then equal quantile average', + 'runtime_code_sha256': {p.name: digest(p) for p in stage.iterdir() if p.suffix in ('.py', '.sh')}, + 'notes': 'All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation.', +} +(stage / 'model_manifest.json').write_text(json.dumps(manifest, indent=2) + '\n') +if a.report: + report = json.loads(Path(a.report).read_text()) + assert report['checkpoint_sha256'] == identifier + shutil.copy2(a.report, stage / 'validation_report.json') +else: + report = {'status': 'candidate validation pending'} + (stage / 'validation_report.json').write_text(json.dumps(report) + '\n') +if final.resolve() == Path('/workspace/submission').resolve(): + assert a.report and report['n_configs'] == 97 and report['n_instances'] == 151170 + assert report['n_failed'] == 0 +patch_sizes = ', '.join(str(m['config'].get('input_patch', m['config']['patch'])) + '/' + str(m['config']['patch']) for m in members) +(stage / 'README.md').write_text(f'''# Four-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains four locally trained models totaling {manifest['parameters']:,} parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed equal weights of 1/4 each. + +Each member retains its declared context limits, listed in model_manifest.json under member_history_caps. A model with a separate encoder_context uses longer history only for learned seasonal summaries; its encoder, normalization and fixed forecast rules use the shorter declared limit. Their history/forecast patch sizes are {patch_sizes}, in member order. Each member retains its own original model implementation and normalization; overflow handling follows each member's own implementation. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary uses a fixed width of 128 observations. The zero projection threshold is 0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. +''') +if final.exists(): + libc = ctypes.CDLL(None, use_errno=True) + if libc.renameat2(-100, os.fsencode(stage), -100, os.fsencode(final), 2): + raise OSError(ctypes.get_errno(), os.strerror(ctypes.get_errno())) + shutil.rmtree(stage) +else: + os.replace(stage, final) +print(json.dumps({'out': str(final), 'checkpoint_sha256': identifier, + 'parameters': manifest['parameters']})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/requirements.txt b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca733199990e5dc8e6a90509cc691f00ab8e9f5d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/requirements.txt @@ -0,0 +1,12 @@ +# Runtime pins recorded from the contributor's working environment on 2026-09-17 (Python 3.11). +# torch comes from the pytorch/pytorch:2.14.0-cuda12.6-cudnn9-runtime base image (cu130 needs driver >= 580). +torch==2.14.0 +numpy==2.4.6 +h5py==3.16.0 +pandas==2.3.3 +scipy==1.17.1 +pyarrow==25.0.1 +huggingface-hub==0.36.2 +einops==0.8.2 +safetensors==0.8.0 +pytest==9.1.1 diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/seasonal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/seasonal.py new file mode 100644 index 0000000000000000000000000000000000000000..cd8d8ebbf65c59c69f3d1c537e8cd5cb024d0330 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/seasonal.py @@ -0,0 +1,51 @@ +"""A fixed confidence gate for highly repeatable history; no fitted parameters.""" +import numpy as np + +def apply_gate(ctx,periods,quant,threshold=.25,strength=1.,cycles=4,mode='aligned'): + # Each row uses only its own context. Quantile blending preserves ordering. + b,_,h=quant.shape + out=quant.copy() + for i in range(b): + x=ctx[i];valid=np.isfinite(x) + if not valid.any():continue + x=x[np.flatnonzero(valid)[0]:] + best=None + for p in periods[i]: + p=int(p) + if p<2 or len(x)<3*p:continue + k=min(len(x)//p,8);history=x[-k*p:] + pairs=np.isfinite(history[p:])&np.isfinite(history[:-p]) + if pairs.sum()0) + if mode in ('centered','aligned'): + mu=mu+np.nanmean(seasons[-1])-np.nanmean(mu) + if mode=='aligned' and np.isfinite(seasons[-1]).sum()>=max(2,.75*p): + noise=float(np.mean(err.astype(np.float64)**2)/2) + target_var=max(0.,float(np.nanvar(seasons[-1]))-noise) + template_var=max(0.,float(np.nanvar(mu))-noise/min(k,cycles)) + ratio=float(np.clip(np.sqrt(target_var/max(template_var,1e-12)),.5,2.)) + center=float(np.nanmean(mu));mu=center+(mu-center)*ratio + if mode=='exponential': + w=.5**np.arange(len(recent)-1,-1,-1,dtype=np.float32) + den=(w[:,None]*np.isfinite(recent)).sum(0) + mu=np.divide((w[:,None]*np.nan_to_num(recent)).sum(0),den,out=np.full(p,np.nan,np.float32),where=den>0) + # Error of a season relative to the previous one, corrected for averaging. + sigma=float(np.sqrt(np.mean(err.astype(np.float64)**2)/2*(1+1/min(k,cycles)))) + idx=np.arange(h)%p;median=mu[idx] + z=np.array([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0,.2533471031,.5244005127,.8416212336,1.2815515655]) + sq=median[None]+z[:,None]*sigma + sq=np.where(np.isfinite(sq),sq,quant[i]) + if np.nanmin(x)>=0:sq=np.maximum(0,sq) + best=(weight,sq) + if best is not None:out[i]=(1-best[0])*quant[i]+best[0]*best[1] + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..00a65dee8167663b7efe5594742a9e099d4f1489 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.3843356309048914, + "skill_score": 0.3843356309048914, + "rel_mase_gmean": 0.7359642442141643, + "rel_wql_gmean": 0.5150285742183113, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.737118960218793, + "rel_wql_gmean": 0.48667183514735635 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7035172396977293, + "rel_wql_gmean": 0.4964403554946446 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.7482961321370007, + "rel_wql_gmean": 0.5337250973880802 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.893578930735471, + "rel_wql_gmean": 0.8473388865636031 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.8934383819228326, + "rel_wql_gmean": 0.6441670685939594 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.5483401243523415, + "rel_wql_gmean": 0.4812368345835373 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.7952712794599404, + "rel_wql_gmean": 0.3894018030522033 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8218554935452521, + "rel_wql_gmean": 0.5047300757718958 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.637795110308104, + "rel_wql_gmean": 0.43490202133038397 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5631095098301198, + "rel_wql_gmean": 0.443377410953268 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6753196159664212, + "rel_wql_gmean": 0.7204585967467494 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7564062231320686, + "rel_wql_gmean": 0.5135018526992328 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7311529321708659, + "rel_wql_gmean": 0.4964506341553277 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 0.9343468429014872, + "rel_wql_gmean": 0.776257411102681 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.7919765320929799, + "rel_wql_gmean": 0.8300240379038908 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.6586269271207137, + "rel_wql_gmean": 0.5044889652359165 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.6849694605495583, + "rel_wql_gmean": 0.4585273852593319 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.8802338504255324, + "rel_wql_gmean": 0.6554946529894189 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7098655437346444, + "rel_wql_gmean": 0.5131512616033498 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.7574311013501122, + "rel_wql_gmean": 0.5165283819925589 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.1948042884643897, + "wql": 0.1124084765367892, + "wsql_by_level": [ + 0.06296747351073721, + 0.09705563758206011, + 0.11893946343008378, + 0.13191424104015254, + 0.1378204885356627, + 0.13771564654954432, + 0.13003577346456974, + 0.11299911062839252, + 0.08222845408989979 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 715.413497108727, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6753196159664212, + "wql": 0.7204585967467494 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.259962856521928, + "wql": 0.08266963346128621, + "wsql_by_level": [ + 0.04848852161038842, + 0.07358676366452106, + 0.08900123959578611, + 0.09807547862763887, + 0.10178683065345603, + 0.10040268435809113, + 0.093977286933296, + 0.08082681133866045, + 0.05788108436973783 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 579.6037566447901, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7919765320929799, + "wql": 0.8300240379038908 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.988564261982904, + "wql": 0.09223802710020251, + "wsql_by_level": [ + 0.05364962935874241, + 0.0818573272252259, + 0.0994997480990505, + 0.11000818379123849, + 0.11453215034534737, + 0.11298871513084648, + 0.1049538183919038, + 0.08940546453973397, + 0.0632472070197337 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 543.0756111173652, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7993765245249927, + "wql": 0.7829308059152125 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.230306870405303, + "wql": 0.0498652289949664, + "wsql_by_level": [ + 0.02554952781724058, + 0.0402804140768341, + 0.05133611326215863, + 0.058372837637074404, + 0.062477608668266495, + 0.06375907584312981, + 0.06047395394999364, + 0.05125911049654252, + 0.035278419203457416 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 325.18698083747375, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.115773192120335, + "wql": 0.7661301323682388 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2829450608042885, + "wql": 0.021965826873171352, + "wsql_by_level": [ + 0.013872956689683295, + 0.020074834919048722, + 0.02378088172321693, + 0.025823118861531748, + 0.026681734465554996, + 0.02646162214581857, + 0.024821776416652577, + 0.021161825739822514, + 0.01501369089721284 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 170.95649596726716, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0207793016865263, + "wql": 0.9508350537765693 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2842299173378704, + "wql": 0.03741240560692395, + "wsql_by_level": [ + 0.018895528891515214, + 0.03156120884009426, + 0.04023149362787627, + 0.04515607342202668, + 0.04751184966593015, + 0.04736786474828016, + 0.04403272556898336, + 0.0367958481136938, + 0.025159057583915647 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 357.90679174598796, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0454822782942692, + "wql": 1.0852055826577411 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9740671670413092, + "wql": 0.0480153092047249, + "wsql_by_level": [ + 0.03043318416955859, + 0.04634438833851187, + 0.056225240381056335, + 0.06124977060764387, + 0.062279146573383015, + 0.05888411418510382, + 0.05092921291043495, + 0.03951861918627234, + 0.026274106490559352 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 63.260204493273015, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8922624424336174, + "wql": 0.7745824437031936 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9567750281638162, + "wql": 0.08968614059591033, + "wsql_by_level": [ + 0.04174029900371922, + 0.06669443226862115, + 0.08487989678163489, + 0.0990397825662582, + 0.10945781624911267, + 0.11426623166135888, + 0.11232660599807393, + 0.10162631508658099, + 0.07714388574783307 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 78.7243871905626, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.633628493279298, + "wql": 0.744020170872598 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8795474001499775, + "wql": 0.08607768135654768, + "wsql_by_level": [ + 0.04017425180329674, + 0.06445826678041845, + 0.08154564970175295, + 0.09384222886790874, + 0.1033128450870355, + 0.10801441675325536, + 0.10738158773465557, + 0.09862202571048524, + 0.07734785977012056 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 74.49336197613526, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8038946727816201, + "wql": 0.8002436731270509 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0355827880800808, + "wql": 0.07525985281775573, + "wsql_by_level": [ + 0.04743525815605429, + 0.06846221219777972, + 0.08282219191761397, + 0.09077728213743134, + 0.09383351884543883, + 0.09232236393551821, + 0.0854428277333006, + 0.07103379739159325, + 0.045209223045071266 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 284.9752612346135, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0501171281422095, + "wql": 1.1127979848029894 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.969107247962361, + "wql": 0.07846544645475942, + "wsql_by_level": [ + 0.04245773428697155, + 0.06416913170143425, + 0.07780389469129374, + 0.08701535432318927, + 0.09452848102417917, + 0.0975354924993394, + 0.09480408798134542, + 0.08476787130933841, + 0.06310697027574355 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 254.39183212454455, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.776626387642099, + "wql": 0.637352537724698 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1900645113758865, + "wql": 0.09190610059225464, + "wsql_by_level": [ + 0.04322225461152905, + 0.06898944237391355, + 0.08733189830947721, + 0.10034571850331248, + 0.10882435326648626, + 0.11278890635792796, + 0.11218331203470229, + 0.10581805034221656, + 0.08765096953072639 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 298.2654596747439, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8771760888390864, + "wql": 0.6262815629273538 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4756723681893873, + "wql": 0.06690785549769457, + "wsql_by_level": [ + 0.028881768568078055, + 0.048640149892749986, + 0.06446476527270426, + 0.07558131800693724, + 0.08326745546109192, + 0.08593913999153883, + 0.0835098845534602, + 0.07499474240033627, + 0.05689147533235442 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 5477.260588082604, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8967018855348735, + "wql": 0.7224395109941081 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4376949683132059, + "wql": 0.06595998547907803, + "wsql_by_level": [ + 0.026727913520746965, + 0.047400912528145295, + 0.06694928983133605, + 0.07733054160406459, + 0.08440806917210256, + 0.08565995365068016, + 0.08078199401150679, + 0.07114628769619037, + 0.05323490729692939 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 36349.323766837595, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0917426217178616, + "wql": 1.0110471171462432 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.018199829778994283, + "wql": 0.42891773281702794, + "wsql_by_level": [ + 0.18489396799094973, + 0.34931103024493143, + 0.4493207551865027, + 0.500474050313378, + 0.5256192011179047, + 0.5195454685272037, + 0.5090275174721609, + 0.4739478135118323, + 0.3481197909883883 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.05079546859521881, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1361852492805937, + "wql": 0.03539344741619335 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6711441872006577, + "wql": 0.27383892342927735, + "wsql_by_level": [ + 0.21881890928853337, + 0.3164411545629472, + 0.35079035207431253, + 0.3485810508323807, + 0.324757893453615, + 0.29325518611067386, + 0.25595554843299445, + 0.21027225585908843, + 0.1456779602489508 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.5517577612412858, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8055574024171199, + "wql": 0.48463360280634876 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7044384119574697, + "wql": 0.22334037419737107, + "wsql_by_level": [ + 0.1683165184681457, + 0.25824916454672964, + 0.2947499493642864, + 0.299144011543009, + 0.28132324134649167, + 0.24622584165063305, + 0.19768207696383236, + 0.1502116410015934, + 0.1141609228916184 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.6529775341609394, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.32885175932946653, + "wql": 0.2472689464032499 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8696878898168143, + "wql": 0.33237113298133303, + "wsql_by_level": [ + 0.24626922131335702, + 0.3807587960860813, + 0.4346540586296976, + 0.43845361133387095, + 0.41177184350510226, + 0.3691529598824275, + 0.31047256074292673, + 0.2416852015700221, + 0.15812194376851202 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 11.357385665738565, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8228417330210402, + "wql": 0.5518389375333662 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1994386657842757, + "wql": 0.4489464884912274, + "wsql_by_level": [ + 0.47993796463016575, + 0.5789815480058882, + 0.5945334748401463, + 0.569834882088997, + 0.5225037959565622, + 0.45871575052715097, + 0.37923286594259276, + 0.2828737065188741, + 0.1739044079106697 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 15.657886591703583, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8702495215682853, + "wql": 0.46379609203605937 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0400490206626296, + "wql": 0.3571653221427422, + "wsql_by_level": [ + 0.43122898290396733, + 0.4674079386536643, + 0.46472780344234715, + 0.44167797780435963, + 0.4054445310187596, + 0.35752957579291833, + 0.2967231540648518, + 0.22080436946550125, + 0.12894356613831065 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.667924185776902, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.969887298867603, + "wql": 0.39562468435985343 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1423757096618505, + "wql": 0.28748478880965783, + "wsql_by_level": [ + 0.2433118054913274, + 0.3467582240187444, + 0.38166603718620584, + 0.38215093041698067, + 0.3571615046091433, + 0.315201218144837, + 0.2585908018469241, + 0.1907472119643454, + 0.11177536560841213 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 288.9661689855757, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9788504619977161, + "wql": 0.6098256333648794 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0230690508286733, + "wql": 0.1212170978466349, + "wsql_by_level": [ + 0.05865500803121881, + 0.11413092230559128, + 0.14500771101534485, + 0.1542089842973762, + 0.15301058333821754, + 0.14491192432895914, + 0.1312171096732136, + 0.1110820550780701, + 0.07872958255172276 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 939.5978346775918, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0150926221246703, + "wql": 0.8726335378433838 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7940631195865495, + "wql": 0.05582677481106199, + "wsql_by_level": [ + 0.03087298754392222, + 0.04695620597456365, + 0.05752130968927458, + 0.06550521489688386, + 0.06970950665094526, + 0.06980556823482545, + 0.06552672162862581, + 0.056334269580708723, + 0.04020918909980844 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 19.35423407115298, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8513752218639122, + "wql": 0.8806442520953449 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 43.619616184352246, + "wql": 0.07364468041410649, + "wsql_by_level": [ + 0.06298540070505483, + 0.09163684118879453, + 0.10715379223539133, + 0.10359241725314157, + 0.08997559427851616, + 0.05823655187519927, + 0.03985982027947779, + 0.05110411401584741, + 0.05825759189553551 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 182.79058378961003, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8628067057885818, + "wql": 0.5868536507045349 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.45622264028997533, + "wql": 0.024482242452389065, + "wsql_by_level": [ + 0.010328608945230227, + 0.015723699389836455, + 0.020652966000026203, + 0.02361631355290268, + 0.0296075297844733, + 0.03388701784099879, + 0.03520691377601241, + 0.030845007116254534, + 0.020472125665766967 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 301.2931315104167, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.19596301236449865, + "wql": 0.1875076380654643 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.27044780914458144, + "wql": 0.0075860913243754585, + "wsql_by_level": [ + 0.005389060763757084, + 0.005850367151087013, + 0.0058451974110685255, + 0.007635563325134309, + 0.008080846172958928, + 0.00817411219835662, + 0.009665782944184862, + 0.009899517906811418, + 0.007734374046020373 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 2536.7890625, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8946005862818854, + "wql": 0.6833206665921662 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4853326901754125, + "wql": 0.016455395565286503, + "wsql_by_level": [ + 0.006451515590054493, + 0.01551332665684237, + 0.020181177357453835, + 0.021673192978594342, + 0.02172843891094782, + 0.020615691000011763, + 0.018443881558938238, + 0.014980952466969009, + 0.008510383567766662 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 1616.38671875, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3849570941621268, + "wql": 0.3897808271244097 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.1241553951598195, + "wql": 0.314461857758526, + "wsql_by_level": [ + 0.1464271899200915, + 0.2547131323681452, + 0.3410136683436466, + 0.4079116722489819, + 0.44213513949915473, + 0.42589423730009135, + 0.3544751716976757, + 0.22749028636413376, + 0.23009622208481328 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 13.735665098826091, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8013806766755347, + "wql": 0.5803337549912835 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4265226589769706, + "wql": 0.22454826783099366, + "wsql_by_level": [ + 0.12297502644337333, + 0.20446393042771416, + 0.2469467780094047, + 0.257985843545447, + 0.2542377147597786, + 0.23937239987591719, + 0.2490333993918837, + 0.25510408418405606, + 0.1908152338413682 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 7.393807093302409, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2836202353981057, + "wql": 0.8586886422676113 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6924476423174394, + "wql": 0.22751689096409183, + "wsql_by_level": [ + 0.10622398402608459, + 0.16559155054464766, + 0.2389762956989773, + 0.3035157787600391, + 0.33937532330188147, + 0.33754460329561503, + 0.2621097041773069, + 0.13269052201719478, + 0.16162425685507964 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.298938632011414, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2178735651859662, + "wql": 0.3795685844096483 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.1079464560556977, + "wql": 0.5238587037661242, + "wsql_by_level": [ + 0.1770107091656451, + 0.3331105156093134, + 0.46814517239813613, + 0.5779582280297731, + 0.6574660910989982, + 0.7029590050927433, + 0.7024252954224887, + 0.6345496065972202, + 0.4611037104807999 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.6055370950018215, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6404746285519165, + "wql": 0.4765890894031431 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5385210417286712, + "wql": 0.38318627908473535, + "wsql_by_level": [ + 0.14859754076948958, + 0.2571480599390896, + 0.3511661200143019, + 0.428257165652696, + 0.48184252838876723, + 0.5029950888764306, + 0.49490513564870203, + 0.4512328576983499, + 0.33253201477479066 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.384548824472105, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.790637274024618, + "wql": 0.6115180419433353 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9243796119719839, + "wql": 0.4586571954988542, + "wsql_by_level": [ + 0.17813870654273375, + 0.32775906564227025, + 0.4485463365173416, + 0.5391301901381726, + 0.5960277665038458, + 0.6108163518257288, + 0.5797475325694479, + 0.49743915496305713, + 0.3503096547870901 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 19.97666710344774, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7232196298114318, + "wql": 0.43685842574230094 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8716494751402017, + "wql": 0.4751284458174234, + "wsql_by_level": [ + 0.1848934239503441, + 0.3337696836429818, + 0.45566511585971137, + 0.5485447229226587, + 0.6093798024700382, + 0.6330944229168565, + 0.6146227493165287, + 0.536233708458402, + 0.3599523828192895 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.584961563494304, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8884856746768572, + "wql": 0.38433855810897843 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0150473354705567, + "wql": 0.39124051004615346, + "wsql_by_level": [ + 0.1654410233536927, + 0.29041231883530344, + 0.38169621689870054, + 0.4468904003603233, + 0.48756718251341086, + 0.5042851322007338, + 0.4941103498588946, + 0.44169760006835873, + 0.30906436632596335 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 15.132368607247288, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8366114242611304, + "wql": 0.4349603000725704 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4185302646596178, + "wql": 1.1244101999088318, + "wsql_by_level": [ + 0.27971761424682506, + 0.5467973917218049, + 0.8170341323288485, + 1.0839988701924081, + 1.3191033427887835, + 1.511081136458883, + 1.6284917774810117, + 1.6018162034076795, + 1.3316513305532431 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6241950752196027, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.9111764415821143, + "wql": 0.6966981169203571 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6945802010011527, + "wql": 0.26213632327995307, + "wsql_by_level": [ + 0.13169721477745955, + 0.2150148867904739, + 0.2741549634658024, + 0.3132306545137657, + 0.33342217116278955, + 0.3338177215062785, + 0.311877730305093, + 0.2646661617566459, + 0.1813454052412689 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.131356949367394, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6926283812457086, + "wql": 0.387720382017869 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9568859546034584, + "wql": 0.6322085912378053, + "wsql_by_level": [ + 0.19791027228709143, + 0.37118498396338007, + 0.5229645311719724, + 0.654722669602655, + 0.7610711671663276, + 0.8369523879151254, + 0.8715817573612059, + 0.8311050327653878, + 0.6423845189071009 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 2.984624428866255, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8733627424471724, + "wql": 0.43338193466641173 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.823753990777682, + "wql": 0.4092936144468439, + "wsql_by_level": [ + 0.15224158039294716, + 0.2716194304856199, + 0.36272474009871736, + 0.433088215983095, + 0.4875400933888367, + 0.5249362021216601, + 0.5382756071690624, + 0.512123735820911, + 0.40109292456074547 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 11.90444825488632, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8277218561459492, + "wql": 0.5543737577853572 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3952898701705953, + "wql": 0.028723544957939932, + "wsql_by_level": [ + 0.019529757893431116, + 0.027394631509447553, + 0.03222599665680956, + 0.034907422781096514, + 0.035933749572980525, + 0.035028247648647155, + 0.031832535757142684, + 0.025797937269634946, + 0.015861625532269333 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.3306111099796274, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.649248541134488, + "wql": 0.5007490681605482 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6124257865650427, + "wql": 0.05101569882924481, + "wsql_by_level": [ + 0.0406767929468326, + 0.054101328307947574, + 0.060915983712435375, + 0.06350186776257577, + 0.06279834962901416, + 0.05886086640471062, + 0.05171483763827766, + 0.0409793238540245, + 0.02559193920738509 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.815243762205629, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38457256021624614, + "wql": 0.36156164091079346 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6783221336209623, + "wql": 0.05770762029448021, + "wsql_by_level": [ + 0.045417027010268084, + 0.06174742327618872, + 0.06965667374659534, + 0.07245789410995851, + 0.07113144577520258, + 0.0663038499317708, + 0.05802238841427871, + 0.04587649131981347, + 0.0287553890662458 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.184454003547449, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.42634317558834756, + "wql": 0.3911339752459067 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.676196082660409, + "wql": 0.043389725980982695, + "wsql_by_level": [ + 0.03469753365332969, + 0.04632418713564002, + 0.051537053076255085, + 0.0534702436432689, + 0.052794278551931854, + 0.05011241748101232, + 0.044560162479593254, + 0.035258871504410136, + 0.02175278630340301 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.1978558414799263, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.33639129293460673, + "wql": 0.31750868094489976 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7162311876942064, + "wql": 0.050712998995196434, + "wsql_by_level": [ + 0.042468919361204366, + 0.05598703221267306, + 0.06154678119063926, + 0.06262528509824712, + 0.060752557384215915, + 0.05636502232098626, + 0.04972277569917441, + 0.040384506431945445, + 0.026564111257682106 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.3894341651646283, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6209032379562128, + "wql": 0.3400981554391857 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7196723597121933, + "wql": 0.050662986866567644, + "wsql_by_level": [ + 0.04237977114843666, + 0.055233652265532764, + 0.060557531869901204, + 0.06175871482462763, + 0.060216853791031276, + 0.056347851267805726, + 0.05024036921587203, + 0.04135398801034828, + 0.027878149405553148 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.379780891737066, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.578117896761879, + "wql": 0.28906701832786813 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6022298750138277, + "wql": 0.027895112416676235, + "wsql_by_level": [ + 0.020400823176962783, + 0.028969744739730817, + 0.0333117890314601, + 0.03500304048142266, + 0.034596384136024935, + 0.032329024749899495, + 0.02846003345124984, + 0.02294820167754015, + 0.015036970305795325 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 1.9417852419448711, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5080340329739439, + "wql": 0.3005378961175458 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5173985992033879, + "wql": 0.19552652170393103, + "wsql_by_level": [ + 0.10182332529202912, + 0.16577689229146184, + 0.2088461897265203, + 0.2359904652780309, + 0.24842091455431606, + 0.24602437890749868, + 0.22872112336750514, + 0.1927028409049342, + 0.13143256501308298 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.7804363867732937, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7135459155725661, + "wql": 0.6466897387194808 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46653893337494046, + "wql": 0.1947473304840706, + "wsql_by_level": [ + 0.1011772963444461, + 0.16037443518572939, + 0.2008324413424897, + 0.22722179159132963, + 0.24102345291590552, + 0.24201108498086898, + 0.229858988109962, + 0.20209515061364944, + 0.1481313332722546 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.667472180733375, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7347010253889573, + "wql": 0.4973065596702163 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4864794451423971, + "wql": 0.21814599731739187, + "wsql_by_level": [ + 0.11580177745142659, + 0.17973628026006186, + 0.2202136372041763, + 0.245281518473127, + 0.25832097381044444, + 0.26287349770119894, + 0.2585335699382811, + 0.2389484531463499, + 0.1836042678714607 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.868840496000874, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7995758080337461, + "wql": 0.479207180935158 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4788383595311784, + "wql": 0.12990847696156274, + "wsql_by_level": [ + 0.0693350450046388, + 0.10820191744069667, + 0.13443580960182744, + 0.15102113653944568, + 0.1588888577606774, + 0.1585727686246662, + 0.15024442340060146, + 0.1346211136941753, + 0.10385522058733583 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7565392549614856, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7866389872289359, + "wql": 0.6290029684222165 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7029923603350416, + "wql": 0.12686954816991064, + "wsql_by_level": [ + 0.09292660404223954, + 0.12584309398659704, + 0.14370436434612496, + 0.15344383095983477, + 0.1554863001757256, + 0.1488317128976077, + 0.13516505502795334, + 0.11193113569615228, + 0.07449383639696072 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 97.9342344601949, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8039106691095662, + "wql": 0.6683230677813562 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.789740940074338, + "wql": 0.13991455396953037, + "wsql_by_level": [ + 0.08338143611101692, + 0.12181510636299231, + 0.1444581599756719, + 0.15897588165644108, + 0.16831739307790594, + 0.17060589092265416, + 0.16333518609729264, + 0.1435459690838079, + 0.10479596243799062 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 98.7956645568212, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6740565778592846, + "wql": 0.4000458737007571 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0883728093899687, + "wql": 0.18118844091441824, + "wsql_by_level": [ + 0.08920475378318142, + 0.14225397582474333, + 0.18049939119607997, + 0.2081514118858792, + 0.22730762825599993, + 0.23388445675952413, + 0.22501130735349492, + 0.19296790496158012, + 0.13141513820928097 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 133.21716985172696, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0072691775151206, + "wql": 0.47169856724213716 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0078601228388522, + "wql": 0.09237271803385658, + "wsql_by_level": [ + 0.062014753871224154, + 0.0920953027396964, + 0.11106855752482792, + 0.12069023417153978, + 0.12221528821479481, + 0.11288287543086636, + 0.0963571059800797, + 0.07028748986316993, + 0.04374285450851014 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 71.62616996341282, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0001702361387326, + "wql": 0.46369105017189544 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7792670725012937, + "wql": 0.2771256401263645, + "wsql_by_level": [ + 0.1622870132655, + 0.2594302912958132, + 0.31297369780926576, + 0.34422889751595664, + 0.3555063768554017, + 0.35369384845368756, + 0.32193425652282875, + 0.24869586718111647, + 0.13538051223771058 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.2992996251365792, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.646435936053477, + "wql": 0.576092244714447 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9690611278203007, + "wql": 0.37382782066137804, + "wsql_by_level": [ + 0.1780821562462553, + 0.3212749220780595, + 0.4369606659849464, + 0.4965946181623379, + 0.5077102368975966, + 0.48140372349240124, + 0.41913287994419535, + 0.32477039328322854, + 0.1985207898633813 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.6555977510532276, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2510989091473843, + "wql": 0.8521662712288303 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.318040612432724, + "wql": 0.48423844913140535, + "wsql_by_level": [ + 0.30903680240358644, + 0.4719940191754897, + 0.5896014079219133, + 0.643093174016933, + 0.6398947643934825, + 0.5897234021384264, + 0.5024628318624462, + 0.38344447059383785, + 0.22889516967653184 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.1937819459712102, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9931936852294566, + "wql": 0.8353547268679373 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7667972303814656, + "wql": 0.3416215190296967, + "wsql_by_level": [ + 0.20445952541076456, + 0.3041701331233287, + 0.3639243279657139, + 0.41814264578344223, + 0.4413933515473588, + 0.4390226141205447, + 0.40210137385921807, + 0.3207950432881793, + 0.18058465616871955 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.334196607449225, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7343671726226191, + "wql": 0.6772673499881364 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4100528982992926, + "wql": 0.4315848684200791, + "wsql_by_level": [ + 0.29557499310090113, + 0.4615250209419889, + 0.533735556941607, + 0.555588417417536, + 0.5433363289710713, + 0.5017789649941564, + 0.43452515720415064, + 0.3431009395790043, + 0.21509843663029632 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.314164360854331, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.152392636952906, + "wql": 0.7847920346996464 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4513775334578436, + "wql": 0.4170863303923378, + "wsql_by_level": [ + 0.3006866448381515, + 0.4590885347847776, + 0.5388458974306606, + 0.5586332411190716, + 0.5364769029506072, + 0.481463751169066, + 0.3999567405231289, + 0.2986764832645038, + 0.17994877745107302 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 9.03301777251449, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0134870876324262, + "wql": 0.7211980869493088 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.746562283477312, + "wql": 0.33806480885952167, + "wsql_by_level": [ + 0.17049164881847834, + 0.3000446187975746, + 0.3947578375141409, + 0.4489323873667105, + 0.4545266136834692, + 0.4252420132456831, + 0.363330909270671, + 0.290245433789625, + 0.19501181724934263 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 144.27778090068273, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9606013795606854, + "wql": 0.6966340610732451 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0099837453413099, + "wql": 0.19347235636366605, + "wsql_by_level": [ + 0.1326600774260313, + 0.1827589616523599, + 0.21861932616335902, + 0.22611918465900263, + 0.21669437834724123, + 0.21339247371962075, + 0.21590241249673928, + 0.19229527736447077, + 0.14280911544416963 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 540.8124885559082, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8116147907036451, + "wql": 0.7494758075324048 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0755823285978838, + "wql": 0.13027784672641138, + "wsql_by_level": [ + 0.06639711920983479, + 0.10682391696591424, + 0.13586049246501852, + 0.1553619853474353, + 0.16660105979278905, + 0.16758370501703235, + 0.15707269556771356, + 0.13210247161035116, + 0.0846971745616134 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.6584317850924672, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.4118494461424689, + "wql": 1.3869731079923626 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8115506713617351, + "wql": 0.09798651242969872, + "wsql_by_level": [ + 0.06544394485587729, + 0.09914577493360122, + 0.11790251405971768, + 0.12551895376080557, + 0.12431662942943597, + 0.11594925663577339, + 0.10107275154338213, + 0.07975170289571022, + 0.05277708375298499 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.8918874638110754, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8990069992887395, + "wql": 0.7178974965176406 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9990940788629532, + "wql": 0.12568556522566846, + "wsql_by_level": [ + 0.08685013817238525, + 0.12813896371699016, + 0.15290804691166054, + 0.16458397400327182, + 0.1626934861784697, + 0.14956730318541184, + 0.12600959677510307, + 0.0961670059301924, + 0.06425157215753108 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.4537414943573936, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9455785577047144, + "wql": 0.7500957774853293 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6812847001044282, + "wql": 0.07440808360377531, + "wsql_by_level": [ + 0.05171239388782455, + 0.07700397802451021, + 0.09058877285625234, + 0.09545950651419811, + 0.09250538856135564, + 0.08351762495242594, + 0.07103380977003679, + 0.06140657395410014, + 0.046444703913273995 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.671704429955709, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6870819881523864, + "wql": 0.6236319848723232 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.6273647707242653, + "wql": 0.25440696854501194, + "wsql_by_level": [ + 0.10436673708903506, + 0.18133816976213887, + 0.25172583876939963, + 0.3101674678296093, + 0.34765938890312953, + 0.35581239034615436, + 0.32661089791310594, + 0.25964333169948267, + 0.15233849459305207 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 19.773542396679876, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9918052294034111, + "wql": 0.7356657021011143 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.192794893134073, + "wql": 0.3524108095799723, + "wsql_by_level": [ + 0.27381221565663877, + 0.3809635741778294, + 0.4333194156938304, + 0.4532398670535666, + 0.44666962296023127, + 0.41314444565953645, + 0.3539340097095855, + 0.2675436817122181, + 0.1490704535963138 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.204126850010027, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0066255983125527, + "wql": 0.9516984955565204 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.724247965370452, + "wql": 0.3279217205158214, + "wsql_by_level": [ + 0.29346433672373073, + 0.3946950663911099, + 0.4291619695699159, + 0.43063314073523823, + 0.4063888337403443, + 0.3598222512121351, + 0.2960744746210319, + 0.21874186213330016, + 0.12231354951558636 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 549.538259111132, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0042104549128161, + "wql": 1.0290164506493649 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6361797159398732, + "wql": 0.173363077120703, + "wsql_by_level": [ + 0.09896348951784022, + 0.1734833633051303, + 0.20832083344517113, + 0.22471091973735283, + 0.22417987244018792, + 0.20962171751596662, + 0.17675304696424304, + 0.1426707831176564, + 0.10156366804277871 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2181.8339796066284, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9254090878115121, + "wql": 0.820306914577111 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.41801859389044044, + "wql": 0.018495271902973745, + "wsql_by_level": [ + 0.007495112597820055, + 0.012639601576801685, + 0.016150710037686856, + 0.018958848514974813, + 0.021502437366320067, + 0.023086781697763608, + 0.024097855562295354, + 0.023444849919862395, + 0.019081249853238884 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.3884485804490625, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5484604497237827, + "wql": 0.13532397067465968 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8205652967133099, + "wql": 0.08354456853151657, + "wsql_by_level": [ + 0.0271360623600238, + 0.054994341318548176, + 0.07681042560793847, + 0.09182367804466392, + 0.10157360792888484, + 0.10673325850069341, + 0.10638940101941154, + 0.10041822512678793, + 0.08602211687669704 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.177617378764978, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8391573922478734, + "wql": 0.3665777092105574 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7027347559716686, + "wql": 0.07791974859560245, + "wsql_by_level": [ + 0.030916145335751353, + 0.05676175795925001, + 0.07523099231461919, + 0.0875676854717029, + 0.09483507767204118, + 0.09687784977207864, + 0.09476374649623781, + 0.08863004838616381, + 0.07569443395257729 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.21244884375926, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7760288851193998, + "wql": 0.32080160613526243 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5015417402397853, + "wql": 0.05818833644858755, + "wsql_by_level": [ + 0.02411027921362717, + 0.050381756642118365, + 0.06369087695790264, + 0.06960458267368023, + 0.07020286471638436, + 0.06870997714125483, + 0.06693331457806571, + 0.061731508520739664, + 0.048329867593514965 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 11.73077568294765, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.66063831813718, + "wql": 0.317073430389058 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.813012078825529, + "wql": 0.09338948318013397, + "wsql_by_level": [ + 0.04611690530358781, + 0.07875114381281337, + 0.09611611026104018, + 0.10496545754696694, + 0.10852047581170449, + 0.11025773188084591, + 0.10856095232665544, + 0.10205150727068767, + 0.08516506440690398 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 18.69212562664558, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7593055619569768, + "wql": 0.256494766903847 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9989966491138594, + "wql": 0.12505554872696006, + "wsql_by_level": [ + 0.07222387139896622, + 0.1222705306057121, + 0.14609755510353717, + 0.15311808793605683, + 0.14971672049693413, + 0.142403231726703, + 0.13111372821106693, + 0.11565351482097905, + 0.09290269824268493 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 26.09638348896179, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6693187045182615, + "wql": 0.281733882686647 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4623730320302106, + "wql": 0.11313175411296449, + "wsql_by_level": [ + 0.04915775725032128, + 0.09570348298364056, + 0.12492434364017857, + 0.14044820702719932, + 0.14604293284706374, + 0.14371937267932075, + 0.13209595772160823, + 0.11047668442334975, + 0.07561704844399812 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 25.45602355709841, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7871332935412477, + "wql": 0.48893726392369746 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0676721586534572, + "wql": 0.4707195208338831, + "wsql_by_level": [ + 0.1818068410897941, + 0.3208981857071005, + 0.4248170668736018, + 0.511955216323085, + 0.579862425475907, + 0.615486435767518, + 0.6129213028142877, + 0.5598837982202942, + 0.4288444152333593 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 170.34685602662648, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5412311092676768, + "wql": 0.24797428645125616 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1144568211620487, + "wql": 0.669901983594182, + "wsql_by_level": [ + 0.48768236775101775, + 0.8436048580942659, + 0.9224717021110068, + 0.8984046350368772, + 0.8238590880112334, + 0.7194991630853683, + 0.5975206927421431, + 0.4553313157826734, + 0.2807440297330531 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 512.0740723088344, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8364873186732031, + "wql": 0.8409875494082119 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.255646914927661, + "wql": 0.49796040071929215, + "wsql_by_level": [ + 0.329721946226751, + 0.549722059917878, + 0.634363862944355, + 0.6560966582180611, + 0.6351358638230178, + 0.5758230154349707, + 0.49000474541883016, + 0.3770229349910998, + 0.23375251949866646 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 463.65943164960595, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8332903681081022, + "wql": 0.7135070451047972 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3553382400618266, + "wql": 0.48763246949916667, + "wsql_by_level": [ + 0.34916309791875266, + 0.5595324296766325, + 0.6386599620429473, + 0.6470817488226815, + 0.6071019845417432, + 0.5388797844681785, + 0.45832879903018614, + 0.3629279198219533, + 0.2270164991694247 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 428.61705174374197, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8703787097949613, + "wql": 0.782563223503573 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5523889911100425, + "wql": 0.22571157400744696, + "wsql_by_level": [ + 0.1131057242513793, + 0.17445112177448088, + 0.21634748639048207, + 0.24570233641345907, + 0.26143642316401544, + 0.2659561975883508, + 0.26131705131545696, + 0.26402392207125813, + 0.22906390309813984 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 140.09766312636629, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6599863980878441, + "wql": 0.25202665743248903 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8198698741296788, + "wql": 0.8616536979722395, + "wsql_by_level": [ + 0.32010909922085695, + 0.6595498096096698, + 0.8546481055996562, + 0.9700148921911155, + 1.0315497957218205, + 1.0534593110289037, + 1.0339320519840067, + 0.9664003443180418, + 0.8652198720760836 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 309.7934968741615, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8417490264259152, + "wql": 0.780134912114945 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9692527255681676, + "wql": 0.7326256861270896, + "wsql_by_level": [ + 0.26263660730001903, + 0.43035849058558157, + 0.5733525786245764, + 0.7039097082674953, + 0.8213701245812066, + 0.9253508584807146, + 1.003541121933375, + 1.029847152396359, + 0.8432645329744795 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 268.68965337826086, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.8312572759199147, + "wql": 0.7342751751845104 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9084046625434794, + "wql": 0.622536539602229, + "wsql_by_level": [ + 0.189925747281607, + 0.35196329395360215, + 0.5228660710223745, + 0.6738508513518403, + 0.7921600166787235, + 0.8482021033842203, + 0.8382341418513866, + 0.7695852008392039, + 0.6160414300571025 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 256.60982612202304, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8128648157271284, + "wql": 0.6683428008325799 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5379122199959857, + "wql": 0.009676879239102616, + "wsql_by_level": [ + 0.005718467655354671, + 0.009206984695805857, + 0.011471343999923288, + 0.012675483251410383, + 0.012982018380355252, + 0.01235919817482769, + 0.010597702580521477, + 0.007799868107892501, + 0.0042808463058324015 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 335.91491915384927, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38599662493535986, + "wql": 0.5257866902299666 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6728074099399378, + "wql": 0.009014031471967528, + "wsql_by_level": [ + 0.0053250351284929685, + 0.008041441151050504, + 0.009908143149045047, + 0.011061027538477717, + 0.01156326206471626, + 0.011305031155121423, + 0.010290640480738588, + 0.008378738143149095, + 0.005252964436916157 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 276.82573771476746, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7326393993843424, + "wql": 0.6559251213258029 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7114945427683419, + "wql": 0.00940337973906831, + "wsql_by_level": [ + 0.005639516750790043, + 0.008817811456991695, + 0.01080228549296925, + 0.01181406681168754, + 0.011975589781002357, + 0.011501616966335516, + 0.010350575974267487, + 0.00840323022831662, + 0.0053257241892542715 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 291.7896762805515, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9502736830335604, + "wql": 0.7265403905671058 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5102648424971503, + "wql": 0.00904185014062834, + "wsql_by_level": [ + 0.005545437074498282, + 0.008741895644593614, + 0.010797017043072362, + 0.011864628909435404, + 0.012058016719976115, + 0.011448188676307505, + 0.009927471707947886, + 0.007316889145958133, + 0.0036771063438657495 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 16.168332891686568, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.48324721735918685, + "wql": 0.3543733879230849 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6766911315666555, + "wql": 0.009833083124587555, + "wsql_by_level": [ + 0.006065002034213274, + 0.009208565086854319, + 0.011176904774080563, + 0.01223673436303715, + 0.012505026776257849, + 0.012060348129904525, + 0.01087762421830998, + 0.008826761746961245, + 0.005540780991669091 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.772737826158602, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7088263857680894, + "wql": 0.41819022089697877 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7375108265657856, + "wql": 0.010512706148302308, + "wsql_by_level": [ + 0.006327609946412664, + 0.009846294645371574, + 0.011993186891569965, + 0.013153113865717507, + 0.013463195946880219, + 0.013006712814559103, + 0.011656061502422215, + 0.009304181995745483, + 0.00586399772604204 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 17.203744626739727, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8867581258012341, + "wql": 0.4439677651021599 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.1784254793858558, + "wql": 0.05323072425789363, + "wsql_by_level": [ + 0.03970182457378459, + 0.05775852056963114, + 0.06703829855448888, + 0.06901463098362451, + 0.06659773554679885, + 0.06116060968073027, + 0.05082032905282235, + 0.03929716658487994, + 0.027687402774282183 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.7108462807678042, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.23107885307599263, + "wql": 0.24092338197064853 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46805803394275275, + "wql": 0.15066586604671037, + "wsql_by_level": [ + 0.1208427399305252, + 0.16793213995804585, + 0.18917614577471148, + 0.18641543347087966, + 0.17931542261645622, + 0.1677535731947947, + 0.14704437936180462, + 0.11428143795344119, + 0.0832315221597343 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.990776801073835, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3246587058632487, + "wql": 0.319944953353637 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7196329677417436, + "wql": 0.27185704393516835, + "wsql_by_level": [ + 0.14155478957197806, + 0.22828112504036294, + 0.2902655383397438, + 0.3297569020541137, + 0.3637855372922853, + 0.36509794056814077, + 0.33677113158024635, + 0.2553209101210849, + 0.13587952084855892 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.654949705799421, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.427836269207881, + "wql": 0.40241180486719863 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6952348623053873, + "wql": 0.20895363767782557, + "wsql_by_level": [ + 0.12418647773963183, + 0.21202435812786236, + 0.2764826410276723, + 0.301108516570164, + 0.30035380467378076, + 0.263396214548654, + 0.19578584889703815, + 0.12997040175604285, + 0.07727447575958389 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.284077222148578, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.43874931854040505, + "wql": 0.3748879106342641 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3495375366297277, + "wql": 0.21041907395256548, + "wsql_by_level": [ + 0.11046361583678962, + 0.1751552490600116, + 0.2136761194848542, + 0.23856316205990177, + 0.252148627532323, + 0.25206635937769073, + 0.2449662063774942, + 0.22894169797653735, + 0.17779062786748706 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.4510963549039193, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.21630288225721017, + "wql": 0.18841399424504193 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.42928385600442015, + "wql": 0.21523677136601738, + "wsql_by_level": [ + 0.11733496985287416, + 0.18677046685527376, + 0.23119674672292032, + 0.25482145806493955, + 0.26198003129010716, + 0.25564538874355563, + 0.24492265382843087, + 0.2187686365114728, + 0.16569059042458212 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.958209639982808, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.33531933673173936, + "wql": 0.21238971646472382 + } + } + ], + "checkpoint_sha256": "dfc20235aeb4b9fc799001d69f5be390d9892448dbbf51fc2abb8ca0be453bf7", + "inference_seconds": 469.96330363093875 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/zero_mass.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/zero_mass.py new file mode 100644 index 0000000000000000000000000000000000000000..7e9c7067950c67da130e2c2538ffb42f34537402 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S069/zero_mass.py @@ -0,0 +1,12 @@ +"""Fixed zero-mass projection from the supplied history only.""" +import numpy as np + +def project(ctx,q,threshold=.4): + finite=np.isfinite(ctx);n=finite.sum(-1).clip(min=1) + x=np.where(finite,ctx,0.) + mean=x.sum(-1)/n + scale=np.sqrt((np.where(finite,ctx-mean[...,None],0.)**2).sum(-1)/n) + zero=((ctx==0)&finite).sum(-1) + active=((ctx>=0)|~finite).all(-1)&(zero>=4)&(zero/n>=.1) + cutoff=np.where(active,threshold*scale,0.) + return np.where((q>=0)&(q=0)|~np.isfinite(ctx)).all(-1) + for i in range(b): + x=ctx[i,-512:].astype(np.float64) + if len(x)<8 or not np.isfinite(x[-1]):continue + diff=np.diff(x) + if np.isfinite(diff).sum()<8 or not np.isfinite(diff[-8:]).any():continue + ratio=np.nanmean(diff*diff)/(np.nanvar(x)+1e-12) + weight=float(np.clip(1-ratio/.5,0,.95)) + bias[i]=weight*(x[-1]+np.nanmedian(diff[-8:])-quant[i,4,0]) + out=quant+bias[:,None,None]*np.exp(-np.arange(h)/tau)[None,None,:] + out=np.where(positive[:,None,None],np.maximum(0,out),out) + return out.astype(np.float32) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/infer.sh b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/infer.sh new file mode 100644 index 0000000000000000000000000000000000000000..cd8b850fa281f16a1fdf4147cb8e3ce1412f2702 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/infer.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail +export OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=4 +exec python3 "$(dirname "$(readlink -f "$0")")/predict.py" "$1" "$2" diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model0.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model0.py new file mode 100644 index 0000000000000000000000000000000000000000..0fb76d7fe91edd7ea32a5e4cf8ea092b570edcfe --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model0.py @@ -0,0 +1,279 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + + +def centered_seasonal_difference(z, valid, periods, horizon): + b, c = z.shape + time = torch.arange(horizon, device=z.device)[None, :] + sums = F.pad((z * valid).cumsum(-1), (1, 0)) + counts = F.pad(valid.float().cumsum(-1), (1, 0)) + deltas, extras, dispersion, width_deltas = [], [], [], [] + for j in range(2): + period = periods[:, j:j+1].clamp(min=1) + anchor = c - period + time % period + centered, masks = [], [] + for cycle in range(16): + end = (c - cycle * period).clamp(min=0, max=c) + start = (c - (cycle + 1) * period).clamp(min=0, max=c) + count = counts.gather(1, end) - counts.gather(1, start) + mean = (sums.gather(1, end) - sums.gather(1, start)) / count.clamp(min=1) + index = anchor - cycle * period + safe = index.clamp(min=0, max=c-1) + present = (index >= 0) & valid.gather(1, safe) + centered.append(z.gather(1, safe) - mean) + masks.append(present) + values = torch.stack(centered) + seen = torch.stack(masks) + n4 = seen[:4].sum(0) + n16 = seen.sum(0) + mean4 = (values[:4] * seen[:4]).sum(0) / n4.clamp(min=1) + mean16 = (values * seen).sum(0) / n16.clamp(min=1) + active = (period >= 2) & (n4 >= 2) & (n16 >= 8) + delta = torch.where(active, mean16 - mean4, 0.) + support = torch.where(active, n16.float() / 16, 0.) + deltas.append(delta) + extras.extend([delta, support]) + variance4 = (((values[:4] - mean4).square() * seen[:4]).sum(0) / (n4 - 1).clamp(min=1)) + variance16 = (((values - mean16).square() * seen).sum(0) / (n16 - 1).clamp(min=1)) + width_deltas.append(torch.where(active, variance16.sqrt().log1p() - math.log(2.), 0.)) + dispersion.extend([torch.where(active, variance4.sqrt().log1p(), 0.), + torch.where(active, variance16.sqrt().log1p(), 0.)]) + return torch.stack(deltas, -1), torch.stack(extras, -1), torch.stack(dispersion, -1), torch.stack(width_deltas, -1) + + + +def seasonal_width_multiplier(raw, delta): + return ((raw.float().tanh() * delta).sum(-1).clamp(-math.log(4.), math.log(4.))).exp() + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,long_seasonal_features=True,seasonal_dispersion_features=True,seasonal_width_features=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,long_seasonal_features=long_seasonal_features,seasonal_dispersion_features=seasonal_dispersion_features,seasonal_width_features=seasonal_width_features) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + self.long_query=nn.Linear(patch*4,d,bias=False) if long_seasonal_features else None + self.long_head=nn.Linear(d,patch*2) if long_seasonal_features else None + if long_seasonal_features: + nn.init.zeros_(self.long_query.weight) + nn.init.zeros_(self.long_head.weight);nn.init.zeros_(self.long_head.bias) + assert long_seasonal_features or not seasonal_dispersion_features + self.dispersion_query=nn.Linear(patch*4,d,bias=False) if seasonal_dispersion_features else None + if self.dispersion_query is not None:nn.init.zeros_(self.dispersion_query.weight) + assert seasonal_dispersion_features or not seasonal_width_features + self.width_head=nn.Linear(d,patch*2) if seasonal_width_features else None + if self.width_head is not None: + nn.init.zeros_(self.width_head.weight);nn.init.zeros_(self.width_head.bias) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + if self.long_query is not None:long_delta,long_extra,dispersion_extra,width_delta=centered_seasonal_difference(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + hidden=self.norm(q) + out=self.head(hidden).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + if self.long_head is not None: + gates=self.long_head(hidden).view(b,h,2).float().tanh() + median=median+(gates*long_delta).sum(-1) + widths=F.softplus(out[:,:,10:]).clamp(max=20) + if self.width_head is not None: + multiplier=seasonal_width_multiplier(self.width_head(hidden).view(b,h,2),width_delta) + widths=widths*multiplier[:,:,None] + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model1.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model1.py new file mode 100644 index 0000000000000000000000000000000000000000..dedcdff4698028a8ba655865f8425d0dc3ef0dfd --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model1.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model2.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model2.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model2.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model3.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model3.py new file mode 100644 index 0000000000000000000000000000000000000000..3532e5063bd8b5013f6b6e35703707ffef66e00b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model3.py @@ -0,0 +1,213 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + # Rare permitted-corpus rows exceed float32 variance accumulation range. + # Preserve the original arithmetic on every ordinary row. + bad=~torch.isfinite(mu)|~torch.isfinite(scale) + precise=x.double();mean64=precise.sum(-1,keepdim=True)/count + variance64=torch.where(valid,(precise-mean64).square(),0.).sum(-1,keepdim=True)/count + scale64=torch.maximum(variance64.sqrt(),mean64.abs()*1e-4+1e-4) + z64=torch.where(valid,(precise-mean64)/scale64,0.).clamp(-30,30) + z=torch.where(bad,z64.float(),z) + mu=torch.where(bad,mean64.float(),mu);scale=torch.where(bad,scale64.float(),scale) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3505aecc4d8ceb2547378f79de0abe015cb93662 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/model_manifest.json @@ -0,0 +1,1558 @@ +{ + "name": "direct-seasonal-four-member-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 256643928, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 307", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own Fourier/trend/AR/intermittent/changepoint generator at weekly periods52,1, replacing a Bernoulli1/11 share of the original synthetic rows with unchanged total synthetic fraction; independent seed 1000200", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 307", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 79", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,503,577,661", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 307", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300310", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404", + "synthetic:own stationary Gaussian residuals generated by FFT, equal Matern0.5/1.5/2.5 and RBF spectral families, length scale log-uniform1to10000, theoretical unit marginal variance, FFT size next power of two at least4times window; replacing half of original synthetic residuals with all other generator components unchanged; independent seed 1100200" + ], + "members": [ + { + "weights": "member0.pt", + "weights_sha256": "82d50d0b2f7abfb963562f5f7966644b05612a49725f066392c022ccd6ba18ca", + "parameters": 36899168, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "model_code": "model0.py" + }, + { + "weights": "member1.pt", + "weights_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "parameters": 36665488, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model1.py" + }, + { + "weights": "member2.pt", + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "parameters": 36601928, + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "model_code": "model2.py" + }, + { + "weights": "member3.pt", + "weights_sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "parameters": 146477344, + "config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "model_code": "model3.py" + } + ], + "checkpoint_sha256": "dfc20235aeb4b9fc799001d69f5be390d9892448dbbf51fc2abb8ca0be453bf7", + "checkpoint_digest_method": "SHA-256 of config.json, including ordered member weight hashes", + "training_lineage": [ + { + "checkpoint": "seasonal_width_transfer6k.pt", + "sha256": "82d50d0b2f7abfb963562f5f7966644b05612a49725f066392c022ccd6ba18ca", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "conversion": { + "method": "matched direct-width-head training delta, separately zero-extending base and control", + "formula": "zero_extend(E117first)+E129-zero_extend(E119)", + "coefficient": 1.0, + "base_zero_parameters": [ + "dispersion_query.weight", + "width_head.bias", + "width_head.weight" + ], + "control_zero_parameters": [ + "width_head.bias", + "width_head.weight" + ], + "dispersion_query": "candidate-minus-control only; no E128 correction", + "parent_hashes": { + "/workspace/research/long_seasonal_transfer12k.pt": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "/workspace/research/runs/seasonal_width/ema006000.pt": "4565c9b6447aab0d457738b65543c5cbee2a90f79e4a87dd9afa7f567aaf685a", + "/workspace/research/runs/seasonal_dispersion/ema006000.pt": "6b640ad1ce200544da2d530578e59eb353f8b9dabc5cc98473403cfe7383c49f" + }, + "base_extension_forward_bitwise_equal": true, + "finite_ordered_fixture": true, + "check_seed": 769, + "seconds": 2.319647100986913, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "long_seasonal_transfer12k.pt", + "runs/seasonal_width/ema006000.pt", + "runs/seasonal_dispersion/ema006000.pt" + ] + }, + { + "checkpoint": "long_seasonal_transfer12k.pt", + "sha256": "8a2b252b733cc79c31778ea27ba00fbe61206fef50454514b667c54a928d80a4", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "matched training delta after zero extension of new seasonal query/head parameters", + "formula": "extend_zero(base) + candidate - extend_zero(control)", + "coefficient": 1.0, + "new_parameters_from_candidate": [ + "long_head.bias", + "long_head.weight", + "long_query.weight" + ], + "parent_hashes": { + "/workspace/research/spectral_add_delta6k.pt": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "/workspace/research/runs/long_seasonal/ema012000.pt": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "/workspace/research/runs/overflow_control/ema012000.pt": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819" + }, + "base_extension_forward_bitwise_equal": true, + "check_seed": 571, + "seconds": 2.5279976530000567, + "optimizer_updates": 0, + "validation_data_read": false + }, + "parents": [ + "spectral_add_delta6k.pt", + "runs/long_seasonal/ema012000.pt", + "runs/overflow_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/seasonal_width/ema006000.pt", + "sha256": "4565c9b6447aab0d457738b65543c5cbee2a90f79e4a87dd9afa7f567aaf685a", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "compile_teacher": false, + "visibility_curriculum": false + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "parents": [ + "seasonal_width_initial.pt", + "seasonal_dispersion_initial.pt" + ] + }, + { + "checkpoint": "runs/seasonal_dispersion/ema006000.pt", + "sha256": "6b640ad1ce200544da2d530578e59eb353f8b9dabc5cc98473403cfe7383c49f", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true + }, + "parents": [ + "seasonal_dispersion_initial.pt", + "long_seasonal_initial.pt" + ] + }, + { + "checkpoint": "spectral_add_delta6k.pt", + "sha256": "c3dfc433d51355228fc13d04913db1a7edf83030c33283b150bdcc50f5ae6ea2", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/weekly_slow_ar_delta6k.pt": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "/workspace/research/runs/spectral_synth/ema006000.pt": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 1.4204325219616294 + }, + "parents": [ + "weekly_slow_ar_delta6k.pt", + "runs/spectral_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/long_seasonal/ema012000.pt", + "sha256": "d512cdac520239f0c10e021721424d87cee30086fa70f6cbc41f21e2e04988c3", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "long_seasonal_features": true + }, + "parents": [ + "long_seasonal_initial.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema012000.pt", + "sha256": "f11d056b95f1c5eeef174265ebc51742952600e0dae1fa52900860447d5be819", + "step": 12000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "seasonal_width_initial.pt", + "sha256": "94ba155b90c6b510bccf92358cc225afe8f317285a19637ab5ca68072bbb83d1", + "step": 0, + "seed": 661, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true, + "seasonal_width_features": true + }, + "conversion": { + "method": "zero-initialized direct seasonal width head", + "parent_sha256": "5f07cac4fe7de3e878a01cb90384e79905fdb3156122b568e82c5923526aca3c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "seasonal_dispersion_initial.pt" + ] + }, + { + "checkpoint": "seasonal_dispersion_initial.pt", + "sha256": "5f07cac4fe7de3e878a01cb90384e79905fdb3156122b568e82c5923526aca3c", + "step": 0, + "seed": 577, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true, + "seasonal_dispersion_features": true + }, + "conversion": { + "method": "zero-initialized phase-specific cycle-centered standard-deviation query", + "parent_sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "initial_function_bitwise_equal": true + }, + "parents": [ + "long_seasonal_initial.pt" + ] + }, + { + "checkpoint": "long_seasonal_initial.pt", + "sha256": "470ef98d69d00b17defbf41c70a92b22574154cdb6e0317993bccf113e4af93b", + "step": 0, + "seed": 503, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "long_seasonal_features": true + }, + "conversion": { + "method": "zero-initialized sixteen-cycle centered seasonal query/head additions", + "parent_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "initial_function_bitwise_equal": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "weekly_slow_ar_delta6k.pt", + "sha256": "c8adf9cadf97dac5e120d8d4d2c8c025bffa2e8b55d8664bf900cce55d00a70b", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/postloss_slow_ar_delta6k.pt": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "/workspace/research/runs/weekly_synth/ema006000.pt": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "/workspace/research/runs/overflow_control/ema006000.pt": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af" + }, + "seconds": 2.0751679679378867 + }, + "parents": [ + "postloss_slow_ar_delta6k.pt", + "runs/weekly_synth/ema006000.pt", + "runs/overflow_control/ema006000.pt" + ] + }, + { + "checkpoint": "runs/spectral_synth/ema006000.pt", + "sha256": "683f3824d3c1f605d17bb08d3eef127a54c67eca3867cfbcf1158710a55c4b24", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null, + "teacher_coefficient": null, + "spectral_synthetic_seed": 1100200, + "spectral_replacement_probability": 0.5, + "spectral_length_scale": [ + 1, + 10000 + ], + "spectral_families": [ + "Matern0.5", + "Matern1.5", + "Matern2.5", + "RBF" + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt", + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/overflow_control/ema006000.pt", + "sha256": "b19875c52ed5024383fb69ccc48cb07a5629ad8011abf134c7dcfcdc50fae2af", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "postloss_slow_ar_delta6k.pt", + "sha256": "0ae7875b49b99a44c295dc2b8243327aeacadc25b2354988abb2c37250359a49", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/postloss/ema003000.pt": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "/workspace/research/runs/long_memory_synth_recovery/ema006000.pt": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "/workspace/research/runs/partial_targets/ema006000.pt": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb" + }, + "seconds": 1.0092943429481238 + }, + "parents": [ + "runs/postloss/ema003000.pt", + "runs/long_memory_synth_recovery/ema006000.pt", + "runs/partial_targets/ema006000.pt" + ] + }, + { + "checkpoint": "runs/weekly_synth/ema006000.pt", + "sha256": "de053e5baf9641e9245519990d6e5193fc91392cb76e72ceffee1ce63f578fca", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "normalization_overflow_fallback": true, + "weekly_synthetic_seed": 1000200, + "weekly_replacement_probability": 0.09090909090909091, + "anneal_from_step": null, + "anneal_from_lr": null, + "anneal_final_lr": null + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/postloss/ema003000.pt", + "sha256": "82c785d40998e155a20290c9965c346c26cd397fa0f3cf36278377ad2aed5c7d", + "step": 3000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200, + "fixed_postprocessing_loss": true, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/long_memory_synth_recovery/ema006000.pt", + "sha256": "fea5b5290a3a9be5618eaeaf67e918e4f677d5be908d562040ce4bdfeb549bd9", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "context": null, + "sample_context": 4096, + "synthetic_ar_time_constants": [ + 1, + 10000 + ] + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/partial_targets/ema006000.pt", + "sha256": "67562486b099a350da53c3caa5ff0932fe7fecdfe72c1879b064b2a9bb173dfb", + "step": 6000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/random_capacity_1024/ema048000.pt", + "sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "step": 48000, + "seed": 307, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 48, + "lr": 0.0002, + "steps": 96000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": true, + "synthetic_ar_time_constants": [ + 1, + 10000 + ], + "requested_horizon_seed": 300310, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "random_capacity_1024_initial.pt" + ] + }, + { + "checkpoint": "random_capacity_1024_initial.pt", + "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", + "step": 0, + "seed": 307, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "initialization": "random initialization in this workspace" + } + ], + "ensemble_weights": [ + 0.25, + 0.25, + 0.25, + 0.25 + ], + "every_member_forecasts_every_instance": true, + "member_history_caps": [ + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + }, + { + "input_and_summary": 4096, + "encoder_and_normalization": 4096, + "fixed_rules": 4096 + } + ], + "postprocessing_order": "each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4, finite-value replacement; then equal quantile average", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "model3.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "model0.py": "0d9557eca352e3c493f47c310355aa576da2e75c8f7cb5b69786c3d162644f38", + "model2.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "predict.py": "4de2b53c821ad17baf1b78341dc4fb0bc170faab2493a4a64e0ec63c1e459c5c", + "model1.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37" + }, + "notes": "All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation.", + "runtime_optimization": "Meta-device construction, assign own saved tensors then transfer to CUDA; no changed parameters or forecast rules." +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/predict.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..fde30310df2c940e774703b0c7da641cb590c829 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/predict.py @@ -0,0 +1,74 @@ +import os,json,sys,time,argparse +from pathlib import Path +import numpy as np +import torch +HERE=Path(__file__).resolve().parent +sys.path.insert(0,str(HERE)) +from model import DirectForecaster,periods_for_freq +import importlib.util +from seasonal import apply_gate +from continuity import apply_continuity +from zero_mass import project +import ts_io + +def load_model(checkpoint,device='cuda'): + from types import SimpleNamespace + path=Path(checkpoint);descriptor=json.loads(path.read_text());members=[] + for entry in descriptor['members']: + ck=torch.load(path.parent/entry['weights'],map_location='cpu',weights_only=False) + spec=importlib.util.spec_from_file_location('member_model_'+str(len(members)),path.parent/entry['model_code']) + module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) + with torch.device('meta'): + model=module.DirectForecaster(**ck['config']) + model.load_state_dict(ck['model'],assign=True);model=model.to(device);model.eval();members.append(model) + assert len(members)==4 + return SimpleNamespace(models=members,max_context=max(m.max_context for m in members)) + +def run(model,inp,out,batch=128,configs=None): + inp,out=Path(inp),Path(out);(out/'cases').mkdir(parents=True,exist_ok=True) + index=json.loads((inp/'index.json').read_text());start=time.time() + for cfg in index['configs']: + cid=cfg['config_id'] + if configs and cid not in configs:continue + case=ts_io.CaseFile(inp/'cases'/f'{cid}.h5');n,d,h=case.n,case.n_variates,case.prediction_length + quant=np.zeros((n,d,9,h),np.float32) + order=np.argsort(np.repeat(case.context_length,d),kind='stable') + for s in range(0,n*d,batch): + ids=order[s:s+batch];l=min(model.max_context,max(int(case.context_length[i//d]) for i in ids)) + ctx=np.full((len(ids),l),np.nan,np.float32) + for j,k in enumerate(ids): + x=case.context(int(k//d))[k%d,-l:];ctx[j,-len(x):]=x + x=torch.from_numpy(ctx).cuda();p=torch.tensor([periods_for_freq(cfg['freq'])]*len(ids),device=x.device) + forecasts=[] + for member in model.models: + member_ctx=ctx[:,-member.max_context:] + member_x=x[:,-member.max_context:] + rule_context=getattr(member,'rule_context',member.max_context) + rule_ctx=member_ctx[:,-rule_context:] + rule_x=member_x[:,-rule_context:] + with torch.inference_mode(),torch.autocast('cuda',dtype=torch.bfloat16): + qq,mu,scale=member(torch.cat((member_x,-member_x),0),p.repeat(2,1),h) + qq=qq*scale[:,:,None]+mu[:,:,None] + qq=(qq[:len(ids)]-qq[len(ids):].flip(-1))*.5 + recent=rule_x[:,-4096:] + positive=((recent>=0)|~torch.isfinite(recent)).all(-1) + qq=torch.where(positive[:,None,None],qq.clamp(min=0),qq) + q=qq.transpose(1,2).float().cpu().numpy() + q=apply_gate(rule_ctx[:,-4096:],p.cpu().numpy(),q) + q=project(rule_ctx,apply_continuity(rule_ctx,q)) + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + forecasts.append(q) + q=(forecasts[0]+forecasts[1]+forecasts[2]+forecasts[3])/4 + q=np.nan_to_num(q,nan=0,posinf=1e20,neginf=-1e20) + quant.reshape(n*d,9,h)[ids]=q + ts_io.write_prediction_file(out/'cases'/f'{cid}.h5',quant[:,:,4],quant) + case.close();print(f'{cid}: {n} instances, elapsed {time.time()-start:.1f}s',flush=True) + if (HERE/'model_manifest.json').exists():(out/'model_manifest.json').write_text((HERE/'model_manifest.json').read_text()) + +def main(): + ap=argparse.ArgumentParser();ap.add_argument('input');ap.add_argument('output');ap.add_argument('--weights',default=str(HERE/'config.json'));ap.add_argument('--batch',type=int,default=128);a=ap.parse_args() + torch.set_num_threads(4);torch.manual_seed(0);torch.backends.cudnn.benchmark=False + torch.backends.cuda.matmul.allow_tf32=False + run(load_model(a.weights),a.input,a.output,a.batch) + +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..267b9cd31e3dcddf8fb57320edcd08e8bba1d9bb --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/model_manifest.json @@ -0,0 +1,744 @@ +{ + "name": "direct-seasonal-foundation", + "contract": "timeseries-forecast/v1", + "parameters": 36601928, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 197", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 401", + "synthetic:both original and sign-reflected orientations of each sampled window, seed 197", + "synthetic:independent sign reflection of sampled allowed-corpus and locally generated windows; seeds 43,47,59,79,89,197", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 23,43,47,59,79,89,197,401", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300200", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300404" + ], + "weights_sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "training_lineage": [ + { + "checkpoint": "runs/split_patch/ema012000.pt", + "sha256": "1a2fb20a9fb5cae6526f2e36ea47559626bece78fd9c284899836505030ae9fe", + "step": 12000, + "seed": 401, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 32, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300404 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "parents": [ + "split_patch_initial.pt" + ] + }, + { + "checkpoint": "split_patch_initial.pt", + "sha256": "0719b4dce554764ef69181d8b19d8da11849ef32b35391ffee6700e639a73114", + "step": 0, + "seed": null, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 4, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true, + "input_patch": 8 + }, + "conversion": { + "method": "retain input8; sum query/recency halves and keep first4 output rows; same physical position coordinates", + "exact_function_preservation": false, + "parent_sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988" + }, + "parents": [ + "runs/patch8/ema006000.pt", + "runs/patch8/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch8/ema006000.pt", + "sha256": "308389b7217c080af9eb185559d4ee3cafa0f3e0f8c4dd8f5526b68198c89988", + "step": 6000, + "seed": 197, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 2e-05, + "steps": 12000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": false, + "requested_horizon_seed": 300200 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "patch8_initial.pt" + ] + }, + { + "checkpoint": "patch8_initial.pt", + "sha256": "e7da4d47a9cc984a9423296679d7c9127ef2d679be950b9e8d3758e6fca074cc", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 8, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/horizon_delta12k.pt", + "from_sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "method": "fold input/query/recency halves by summation; retain first8 output rows; preserve physical position units", + "exact_function_preservation": false + }, + "parents": [ + "horizon_delta12k.pt", + "horizon_delta12k.pt" + ] + }, + { + "checkpoint": "horizon_delta12k.pt", + "sha256": "22c08571978be31ba57368eb983089a40a44d56d4ae5e17da41afd2a761a258c", + "step": 0, + "seed": null, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "conversion": { + "method": "matched training delta", + "formula": "base + candidate - control", + "coefficient": 1.0, + "parent_hashes": { + "/workspace/research/runs/confidence_query/ema006000.pt": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "/workspace/research/runs/horizon_jitter/ema012000.pt": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "/workspace/research/runs/large_corpus_control/ema012000.pt": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add" + }, + "seconds": 1.2663014469435439 + }, + "parents": [ + "runs/confidence_query/ema006000.pt", + "runs/horizon_jitter/ema012000.pt", + "runs/large_corpus_control/ema012000.pt" + ] + }, + { + "checkpoint": "runs/confidence_query/ema006000.pt", + "sha256": "0bad97e8994aac49ea173443db0a4fa8d72d33f9eb9e2660f06de75f7f1403eb", + "step": 6000, + "seed": 89, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 64, + "lr": 0.0002, + "steps": 6000 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true + }, + "parents": [ + "runs/recency_features/ema024000.pt" + ] + }, + { + "checkpoint": "runs/horizon_jitter/ema012000.pt", + "sha256": "830179d763916a1065fc615d2c5e22f4a3b5b19390dde707ab0f057e13cadff6", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "partial_target_lengths": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/large_corpus_control/ema012000.pt", + "sha256": "7f9ba5e01ac59c51a3b63d3067b442e23e15d0abc51ddbcccdd04d6083ae4add", + "step": 12000, + "seed": 79, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 5e-05, + "steps": 12000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/recency_features/ema012000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema024000.pt", + "sha256": "1530fbb577a87ca4eb39da83d6fee9b8ee5bc924202e021e3a7b56493112f564", + "step": 24000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/recency_features/ema012000.pt", + "sha256": "8ccb6870a025e1097331a3a288b1183741a413f3460fbf3352d0c589c6a4394c", + "step": 12000, + "seed": 59, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true + }, + "parents": [ + "runs/patch16_trial/ema006000.pt" + ] + }, + { + "checkpoint": "runs/patch16_trial/ema006000.pt", + "sha256": "0ff54447074e0271d2e331c7d3e6e9e0fdd73353e4d8cef0175ff627385f71c3", + "step": 6000, + "seed": 47, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "patch16_init.pt" + ] + }, + { + "checkpoint": "patch16_init.pt", + "sha256": "d69531bfde5bf801e7f36c515bf15fd0cae0bd84f7d1479d35f4a7b67f26b508", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024 + }, + "conversion": { + "from_checkpoint": "/run-state/workspace/research/runs/large_sign/ema006000.pt", + "from_sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "method": "fold input/query halves by summation; retain first 16 output rows; preserve physical positional units" + }, + "parents": [ + "runs/large_sign/ema006000.pt" + ] + }, + { + "checkpoint": "runs/large_sign/ema006000.pt", + "sha256": "96c9d350412c076594f4cc026aaf7396eacc45478f3d402c5d60dcf85dce8547", + "step": 6000, + "seed": 43, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 256, + "lr": 8e-05, + "steps": 6000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "parents": [ + "runs/direct_large/step024000.pt" + ] + }, + { + "checkpoint": "runs/direct_large/step024000.pt", + "sha256": "b7e4f38aebcd2cf38ce484edaad8d19851317fb3b8df485e2faa0d0423cbcb48", + "step": 24000, + "seed": 23, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 128, + "lr": 0.0002, + "steps": 24000, + "context": 4096 + }, + "model_config": { + "d": 512, + "heads": 8, + "enc_layers": 6, + "dec_layers": 4, + "patch": 32, + "max_context": 4096, + "max_horizon": 1024 + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "predict.py": "9bde896945a2cd8f892e7eeb6328ed2dfda09293532f3a4a64d929c9943614ef", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436" + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 8192, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 3072, + "backbone_frozen_during_projection_training": true, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Frozen-backbone details refer to projection introduction; subsequent updates are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "confidence_query/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "confidence_query/model.py": "b4f11ba2018e2b50879cdc33acf0138301548971508b58035a7c96a29aaa6f2d", + "confidence_query/train.py": "fc8a7555a5a6b0a6f91e80ac8cc9cbbfddaa2b26468c57f49dfb17671b22ce93", + "direct_large/data.py": "6e6db217936f8dd79380d2ceff3eaa8598a44f1b60b17acae7bfde2363116847", + "direct_large/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "direct_large/model.py": "146d93a3f95b13bda8b1b437bc36621b91356cf946e94f62999f89e7fb348071", + "direct_large/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "direct_large/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "direct_large/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "direct_large/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "direct_large/train.py": "b9ad6b2adddeaf12961b529d6535dd33f6d044a31979b5c9e49dceafbadd3ac0", + "direct_large/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "direct_large/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "full_paired/check.py": "90ac1c78846439d51ab8acd62a19bd536c7c394bd02e94f6d5ff17c0af8bd116", + "full_paired/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "full_paired/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "horizon_jitter/data.py": "5044cf648323420095ed6058d29f837c07ff5559b606df8b00cc8d1e95c8b58e", + "horizon_jitter/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "horizon_jitter/train.py": "4e9cbca1293f18f7eea2c72dba127815c0934a13c86e8f6cc881a749676d41a6", + "large_corpus/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "large_corpus/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "large_corpus/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "large_sign/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "large_sign/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "large_sign/model.py": "3fff6445a1982a1b3c92f06a9b5f1bb627dda6a291b0b2364bcfb1a6457830d7", + "large_sign/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "large_sign/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "large_sign/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "large_sign/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "large_sign/train.py": "a597f40ab87cce04e96dc654d12e56cdf40ffd87f00034d8bc4d56dff4eb7c68", + "large_sign/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "large_sign/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "partial_delta/merge.py": "63984a0f46f7d48817037f5bf5a1c9319e45a9b1924cde62c667ac49ce47532e", + "partial_targets/data.py": "27c078cb0ed085717a364f556b5ff976fd803d5af37612cf3a03a0a3ca12a678", + "partial_targets/model.py": "186bb282236f23cc665a012194d26e58f51004c680393352ec053f5308f1240f", + "partial_targets/train.py": "3baca16c3945e6ef241ccbc9c13644539e3c265f71095cbbaa61a3d338e4fafe", + "patch16/convert.py": "11e1d30100ab25311020ac1f4ab8227ec66156836df5de613300867977091c45", + "patch16/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "patch16/evaluate.py": "eaea99e8cd44c9f7c70a45fa9abf51354ae5449dbad273fcb55e48ad02652223", + "patch16/model.py": "8031c597b354eb2cf464140bee40c3ec8dff86c775b5c55c5ce910302b443582", + "patch16/pack.py": "3bcc4ce9eb3361ad741ceebd7efce7a2fb86fb49543f52c72aabd0e3e8cd17ce", + "patch16/predict.py": "930a9f18f9f5da47c03859698c9d2f5567d1e1c73fd61edac1ed20b3a6f9bb50", + "patch16/publish.py": "3c167f33e8571731c26f1cb70168eda54ef9cb4c76423dfd374240b75ca5f106", + "patch16/record.py": "b3b00b0ed14bc3af00c7b1ad97195238ecb8f06e96bc41f0c07913bc3f6ed949", + "patch16/train.py": "3156710f76111a31447cbe638ee27fe2811d060917aa083aab0b5134d98accf8", + "patch16/ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "patch16/validation_subset.py": "8d3eb9d3f3aa124368761ef402ff066935c0be31a62b25b8551a45dcb922e28d", + "patch8/convert.py": "9edaa0c8349310b7419d649fb4f21dd3ddb9067ebe984d5df3701a234be73780", + "patch8/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "patch8/memory_check.py": "78e8e5cca960bf1225ec0104980363c82f4c3c13c2d77ed154cea37a5b6f3fd1", + "patch8/model.py": "c27748fa4b1186b513f76eca26052753b8dcd1794994e5989addaf371ca70f2e", + "recency_features/data.py": "b64786d13e8a73646e8e1da25d5073e2e9222eb27830bf55d24f4af14b156b04", + "recency_features/model.py": "e3a1bc01e89a0d6d750ede2cc969272ad01e1ca580b174af7dee00db029f1cf7", + "recency_features/train.py": "a654b9a27b6c27141e1d4e517ab28fcae3f2c23d061742fa2f6c01e3d23c8a00", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/snapshot.py": "0f241a7e139e47ffff7efea40572205fd84c12efe6fb3c2dccd87c50d678a6c3", + "recovery/train.py": "63bee736565af670877b4cd7c75015fab06a18c66bbe132b0bb3faff5ebd80c7", + "split_patch/check.py": "2e0917eec4b70741da84f62ba19d709229fefa29fd46a8b85dd91976952560f9", + "split_patch/convert.py": "115b3f518a2157529a3c26143dabd736abc8494b7f20cdd9bea57d569d77c36e", + "split_patch/data.py": "6537d67ec1d76490015e5bb71a24a0317734ba7bec879628e6547e0a21a2b6e0", + "split_patch/launch.py": "014b171e8b8dc1f4b84242a02813af1ee8b26c3b4dc839148718caf36d77ae77", + "split_patch/memory_check.py": "8a6f6af761ac37fb5118f71e38bba0ca5c446e5c1203b9e156657e7d68a5d3e9", + "split_patch/model.py": "89bb87b2501b117ac02daf001a68f389ec488931ce18905445d15874760685be" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/horizon_jitter/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/horizon_jitter/model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ffe50d9aadf21d73949e2052ceb7f3642bf65d3 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/horizon_jitter/model.py @@ -0,0 +1,180 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,partial_target_lengths=True): + super().__init__();self.patch=patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,partial_target_lengths=partial_target_lengths) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=min(128,max(4,c//4));recent=avg(k) + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%p,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//p + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,p),valid.view(b,nt,p).float()),-1)) + pmask=valid.view(b,nt,p).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods): + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(ctx,periods,target.shape[-1],forecast_lengths=lengths) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/patch8/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/patch8/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..d55bebeab8c6ff393f89b7ad031763f49531f56b --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/patch8/memory_check.py @@ -0,0 +1,23 @@ +"""Maximum training-shape memory fixture, serialized with validation jobs.""" +import fcntl,json,sys,time +from pathlib import Path +import torch + +r=Path('/workspace/research');sys.path.insert(0,str(r/'patch8')) +from model import DirectForecaster,loss_fn +from data import Sampler +with open(r/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX) + torch.set_num_threads(1);torch.manual_seed(277);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic() + ck=torch.load(r/'patch8_initial.pt',map_location='cpu',weights_only=False) + m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) + x,y,p=[torch.from_numpy(a).cuda() for a in Sampler(r/'packed_sample',277).sample(64,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize() + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) + result={'seed':277,'batch':64,'signed_rows':128,'context':4096,'horizon':1024, + 'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started, + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + (r/'patch8_memory_check.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/check.py new file mode 100644 index 0000000000000000000000000000000000000000..1f2b82a5b0b0ad5477066245356808138d166400 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/check.py @@ -0,0 +1,49 @@ +"""Verify equal input/output patches preserve the old implementation exactly.""" +import importlib.util +import json +import sys +import time +from pathlib import Path +import torch + +R = Path('/workspace/research') +sys.path.insert(0, str(R / 'split_patch')) +from model import DirectForecaster + +started = time.monotonic() +torch.set_num_threads(2) +torch.manual_seed(457) +spec = importlib.util.spec_from_file_location('original_patch_model', R / 'full_paired_inference/model.py') +old = importlib.util.module_from_spec(spec) +spec.loader.exec_module(old) +ck = torch.load(R / 'runs/patch8/ema006000.pt', map_location='cpu', weights_only=False) +control = old.DirectForecaster(**ck['config']) +control.load_state_dict(ck['model']) +same = DirectForecaster(**ck['config'], input_patch=8) +same.load_state_dict(ck['model']) +x = torch.randn(6, 251) +x[0, :90] = float('nan') +x[1, ::7] = float('nan') +p = torch.tensor([[12, 1], [52, 1], [24, 168], [7, 365], [1, 1], [96, 672]]) +with torch.no_grad(): + before = control(x, p, 57) + after = same(x, p, 57) +assert all(torch.equal(a, b) for a, b in zip(before, after)) +candidate = torch.load(R / 'split_patch_initial.pt', map_location='cpu', weights_only=False) +full4 = torch.load(R / 'patch4_initial.pt', map_location='cpu', weights_only=False) +for name, value in candidate['model'].items(): + reference = ck['model'][name] if name == 'embed.0.weight' else full4['model'][name] + assert torch.equal(value, reference), name +net = DirectForecaster(**candidate['config']) +net.load_state_dict(candidate['model']) +with torch.no_grad(): + q = net.predict(x, p, 57) +assert q.shape == (6, 9, 57) +assert torch.isfinite(q).all() and (q[:, 1:] >= q[:, :-1]).all() +receipt = dict(seed=457, cpu_seconds=time.monotonic() - started, + equal_patch_forward_bitwise_unchanged=True, + input_tensor_retained_from_patch8=True, + output_tensors_identical_to_full_patch4_conversion=True, + candidate_finite_ordered=True, optimizer_updates=0) +(R / 'split_patch_checks.json').write_text(json.dumps(receipt, indent=2)) +print(json.dumps(receipt)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/data.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/data.py new file mode 100644 index 0000000000000000000000000000000000000000..30d82fdb16762eef87bad4277abf3cc957178684 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/data.py @@ -0,0 +1,94 @@ +import json,re +from pathlib import Path +import numpy as np +from model import periods_for_freq + +class BaseSampler: + def __init__(self,packed,seed=17,synthetic_fraction=.2,source_weights_from=None): + self.rng=np.random.default_rng(seed);self.synthetic_fraction=synthetic_fraction + self.root=Path(packed);meta=json.loads((self.root/'meta.json').read_text());self.dirs=meta['dirs'] + self.values=[];self.offsets=[];self.periods=[];self.lengths=[];weights=[] + for name in self.dirs: + records=json.loads((self.root/f'{name}.json').read_text()) + values=np.memmap(self.root/f'{name}.bin',dtype=np.float32,mode='r') + offsets=np.load(self.root/f'{name}.offsets.npy') + self.values.append(values);self.offsets.append(offsets);self.lengths.append(np.diff(offsets)) + self.periods.append(np.array([periods_for_freq(s['freq']) for s in records],np.int64)) + # Temperature 0.25 protects small, distinctive and low-frequency corpora. + weight_points=(Path(source_weights_from)/f'{name}.bin').stat().st_size//4 if source_weights_from else len(values) + w=min(weight_points,20_000_000)**.25 + if name.startswith(('era5_','cmip6_')):w*=.35 + if name.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) + self.probs=np.array(weights)/sum(weights) + + def synthetic(self,n,p): + r=self.rng;t=np.arange(n,dtype=np.float32) + # New generator: damped trends, random Fourier seasonality, AR noise, + # intermittent demand, changepoints, and randomly scaled observation noise. + level=r.normal(0,2);sigma=10**r.uniform(-2,.1) + x=np.full(n,level,np.float32) + if r.random()<.8: + for period in p: + if period<2:continue + for k in range(1,int(r.integers(2,5))): + x+=r.normal()/k*np.sin((2*np.pi*k/period)*t+r.uniform(0,2*np.pi)) + if r.random()<.6: + slope=r.normal(0,.006);tau=10**r.uniform(2,4) + x+=slope*tau*(1-np.exp(-t/tau)) + noise=r.normal(0,sigma,n).astype(np.float32) + if r.random()<.5: + from scipy.signal import lfilter + phi=r.uniform(.2,.995);noise=lfilter([np.sqrt(1-phi*phi)],[1,-phi],noise) + x+=noise + if r.random()<.2: + start=int(r.integers(n));x[start:]+=r.normal(0,1) + if r.random()<.15:x=np.maximum(0,x)*(r.random(n)8 else nc + nh=min(horizon,l-cut);win=self.values[d][off+cut-nc:off+cut+nh].copy() + # Random aggregation teaches the same dynamics at coarser sampling frequencies. + if r.random()<.12 and l>=4*(context+horizon): + factor=int(r.choice([2,4]));end=int(r.integers(factor*(context+horizon),l+1));raw=self.values[d][off+end-factor*(context+horizon):off+end] + win=raw.reshape(-1,factor).mean(-1);nc=context;nh=horizon + periods[b]=np.maximum(1,np.rint(self.periods[d][i]/factor)).astype(np.int64) + else:periods[b]=self.periods[d][i] + ctx[b,-nc:]=win[:nc];tgt[b,:nh]=win[nc:nc+nh] + if r.random()<.05:ctx[b,r.random(context)<.05]=np.nan + sign=self.rng.choice(np.array([-1.,1.],np.float32),size=(batch,1)) + return ctx*sign,tgt*sign,periods + + +def truncate_targets(arrays,rng,patch=16): + """Random requested horizons; corpus windows and the original RNG remain unchanged.""" + ctx,target,periods=arrays + h=target.shape[-1] + active=rng.random(len(target))<.5 + end=rng.integers(max(1,h//4),h+1,size=len(target)) + end=np.where(active,end,h) + end=np.minimum(h,((end+patch-1)//patch)*patch) + target=target.copy() + target[np.arange(h)[None,:]>=end[:,None]]=np.nan + return ctx,target,periods + + +class Sampler(BaseSampler): + def __init__(self,packed,seed=197,synthetic_fraction=.2,source_weights_from=None): + super().__init__(packed,seed,synthetic_fraction,source_weights_from) + self.horizon_rng=np.random.default_rng(seed+300003) + def sample(self,batch,context=2048,horizon=1024): + return truncate_targets(super().sample(batch,context,horizon),self.horizon_rng,patch=16) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/memory_check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/memory_check.py new file mode 100644 index 0000000000000000000000000000000000000000..7ae2014f738a03f54cbd2208eb9095efe16b009c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/memory_check.py @@ -0,0 +1,18 @@ +"""Maximum-shape memory check for the matched patch comparison, including training state.""" +import argparse,fcntl,json,sys,time +from pathlib import Path +import torch +R=Path('/workspace/research');sys.path.insert(0,str(R/'split_patch')) +from model import DirectForecaster,loss_fn +from data import Sampler +ap=argparse.ArgumentParser();ap.add_argument('--weights',required=True);ap.add_argument('--out',required=True);a=ap.parse_args() +with open(R/'.evaluation.lock','a') as lock: + fcntl.flock(lock,fcntl.LOCK_EX);torch.set_num_threads(1);torch.manual_seed(401);torch.backends.cuda.matmul.allow_tf32=True + started=time.monotonic();ck=torch.load(a.weights,map_location='cpu',weights_only=False);model=DirectForecaster(**ck['config']).cuda();model.load_state_dict(ck['model']) + ema=[p.detach().clone() for p in model.parameters()];moments=[(torch.zeros_like(p),torch.zeros_like(p)) for p in model.parameters()] + x,y,p=[torch.from_numpy(v).cuda() for v in Sampler(R/'packed_sample',seed=401).sample(32,4096,1024)] + with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(model,x,y,p,paired=True) + loss.backward();torch.cuda.synchronize();assert torch.isfinite(loss) + assert all(v.grad is not None and torch.isfinite(v.grad).all() for v in model.parameters()) + result={'seed':401,'batch':32,'signed_rows':64,'patch':model.patch,'input_patch':model.input_patch,'context':4096,'horizon':1024,'EMA_and_AdamW_moment_storage_present':True,'optimizer_updates':0,'loss':float(loss.detach()),'seconds':time.monotonic()-started,'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20,'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} + Path(a.out).write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/model.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/model.py new file mode 100644 index 0000000000000000000000000000000000000000..af1af318784c94a1d9ee75ed377582745bd30136 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member2/training/split_patch/model.py @@ -0,0 +1,204 @@ +"""Direct quantile encoder/decoder, random initialization; fixed history-derived seasonal features.""" +import math +import torch +from torch import nn +from torch.nn import functional as F + +def periods_for_freq(freq): + import re + m=re.match(r'^(\d*)([A-Za-z]+)',str(freq));n=int(m[1] or 1) if m else 1;u=m[2] if m else 'D' + if u in ('s','S'):p=(3600/n,86400/n) + elif u in ('T','min'):p=(1440/n,10080/n) + elif u in ('H','h'):p=(24/n,168/n) + elif u=='D':p=(7/n,365/n) + elif u=='B':p=(5/n,260/n) + elif u=='W':p=(52/n,1) + elif u in ('M','MS','ME'):p=(12/n,1) + elif u in ('Q','QS','QE'):p=(4/n,1) + else:p=(1,1) + return [max(1,round(x)) for x in p] + +def positional(pos,d): + freq=torch.exp(torch.arange(0,d,2,device=pos.device).float()*(-math.log(10000)/d)) + a=pos.float()[...,None]*freq + return torch.stack((a.sin(),a.cos()),dim=-1).flatten(-2) + +class Attention(nn.Module): + def __init__(self,d,heads): + super().__init__();self.h=heads;self.q=nn.Linear(d,d);self.kv=nn.Linear(d,2*d);self.out=nn.Linear(d,d) + def forward(self,x,context,mask=None): + b,t,d=x.shape;s=context.shape[1] + q=self.q(x).view(b,t,self.h,d//self.h).transpose(1,2) + k,v=self.kv(context).view(b,s,2,self.h,d//self.h).permute(2,0,3,1,4).unbind(0) + a=F.scaled_dot_product_attention(q,k,v,attn_mask=None if mask is None else mask[:,None,None,:]) + return self.out(a.transpose(1,2).reshape(b,t,d)) + +class Block(nn.Module): + def __init__(self,d,heads,cross=False): + super().__init__();self.norm1=nn.LayerNorm(d);self.attn=Attention(d,heads) + self.norm2=nn.LayerNorm(d);self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Linear(4*d,d)) + self.cross=Attention(d,heads) if cross else None + if cross:self.normc=nn.LayerNorm(d);self.normctx=nn.LayerNorm(d) + def forward(self,x,mask=None,context=None,future_mask=None): + y=self.norm1(x);x=x+self.attn(y,y,mask if context is None else future_mask) + if self.cross is not None:x=x+self.cross(self.normc(x),self.normctx(context),mask) + return x+self.ff(self.norm2(x)) + +class DirectForecaster(nn.Module): + def __init__(self,d=256,heads=8,enc_layers=4,dec_layers=3,patch=32,max_context=4096,max_horizon=1024,recency_features=True,confidence_features=True,partial_target_lengths=True,input_patch=None): + super().__init__();self.patch=patch;self.input_patch=patch if input_patch is None else input_patch;self.d=d;self.max_context=max_context;self.max_horizon=max_horizon + self.config=dict(d=d,heads=heads,enc_layers=enc_layers,dec_layers=dec_layers,patch=patch,max_context=max_context,max_horizon=max_horizon,recency_features=recency_features,confidence_features=confidence_features,partial_target_lengths=partial_target_lengths,input_patch=self.input_patch) + self.confidence=nn.Linear(6,d,bias=False) + nn.init.zeros_(self.confidence.weight) + self.recency=nn.Linear(patch*4,d,bias=False) if recency_features else None + if self.recency is not None:nn.init.zeros_(self.recency.weight) + self.embed=nn.Sequential(nn.Linear(self.input_patch*2,d),nn.GELU(),nn.Linear(d,d)) + self.query=nn.Sequential(nn.Linear(patch*9,d),nn.GELU(),nn.Linear(d,d)) + self.metadata=nn.Sequential(nn.Linear(4,d),nn.GELU(),nn.Linear(d,d)) + self.encoder=nn.ModuleList(Block(d,heads) for _ in range(enc_layers)) + self.decoder=nn.ModuleList(Block(d,heads,True) for _ in range(dec_layers)) + self.norm=nn.LayerNorm(d);self.head=nn.Linear(d,patch*18) + nn.init.zeros_(self.head.weight);nn.init.zeros_(self.head.bias) + with torch.no_grad(): + bias=self.head.bias.view(patch,18);bias[:,10:]=math.log(math.expm1(.22)) + bias[:,:9]=torch.tensor([0.,0.,0.,0.,-.5,.5,-.5,.5,-1.]) + + @staticmethod + def standardize(ctx): + valid=torch.isfinite(ctx);x=torch.where(valid,ctx,0.) + count=valid.sum(-1,keepdim=True).clamp(min=1) + mu=x.sum(-1,keepdim=True)/count + var=torch.where(valid,(x-mu).square(),0.).sum(-1,keepdim=True)/count + scale=torch.maximum(var.sqrt(),mu.abs()*1e-4+1e-4) + z=torch.where(valid,(x-mu)/scale,0.).clamp(-30,30) + return z,valid,mu,scale + + @staticmethod + def features(z,valid,periods,h): + b,c=z.shape;dev=z.device + def avg(k): + return (z[:,-k:]*valid[:,-k:]).sum(-1)/valid[:,-k:].sum(-1).clamp(min=1) + last_idx=torch.where(valid,torch.arange(c,device=dev),-1).max(-1).values.clamp(min=0) + last=z.gather(1,last_idx[:,None])[:,0] + small=avg(32);medium=avg(128);level=avg(min(1024,c)) + bases=[x[:,None].expand(-1,h) for x in (last,small,medium,level)] + t=torch.arange(h,device=dev)[None,:] + for j in range(2): + p=periods[:,j:j+1].clamp(min=1) + anchor=c-p+t%p + vals=[];masks=[] + for cycle in range(4): + idx=anchor-cycle*p;safe=idx.clamp(min=0,max=c-1) + ok=(idx>=0)&valid.gather(1,safe) + vals.append(z.gather(1,safe));masks.append(ok) + vals=torch.stack(vals);masks=torch.stack(masks) + avgseason=(vals*masks).sum(0)/masks.sum(0).clamp(min=1) + avgseason=torch.where(masks.any(0),avgseason,level[:,None]) + bases.extend([torch.where(masks[0],vals[0],level[:,None]),avgseason]) + # A damped slope using two recent nonoverlapping means, a fixed transformation. + k=128;recent=avg(k) # Match the training width, independently of padding. + older=(z[:,-2*k:-k]*valid[:,-2*k:-k]).sum(-1)/valid[:,-2*k:-k].sum(-1).clamp(min=1) + slope=((recent-older)/k).clamp(-.03,.03) + trend=recent[:,None]+slope[:,None]*(k*(1-torch.exp(-(t+k/2)/k))) + bases.append(trend) + return torch.stack(bases,-1) + + def forward(self,ctx,periods,horizon,forecast_lengths=None): + p=self.patch;ip=self.input_patch;h=math.ceil(horizon/p)*p + ctx=ctx[:,-self.max_context:] + ctx=F.pad(ctx,((-ctx.shape[1])%ip,0),value=float('nan')) + z,valid,mu,scale=self.standardize(ctx) + b,c=z.shape;nt=c//ip + base=self.features(z,valid,periods,h) + x=self.embed(torch.cat((z.view(b,nt,ip),valid.view(b,nt,ip).float()),-1)) + pmask=valid.view(b,nt,ip).any(-1);pmask[:,-1]=True + future_mask=None + horizon_meta=torch.full((b,1),math.log1p(max(32,h))/8,device=z.device) + if forecast_lengths is not None: + patch_count=((forecast_lengths+p-1)//p).clamp(min=1,max=h//p) + future_mask=torch.arange(h//p,device=z.device)[None,:]=c-period);pooled=valid&(pos>=c-4*period) + nr=recent.sum(-1,keepdim=True).clamp(min=1);npool=pooled.sum(-1,keepdim=True).clamp(min=1) + mr=(z*recent).sum(-1,keepdim=True)/nr;mp=(z*pooled).sum(-1,keepdim=True)/npool + sr=(((z-mr).square()*recent).sum(-1,keepdim=True)/nr).sqrt() + sp=(((z-mp).square()*pooled).sum(-1,keepdim=True)/npool).sqrt().clamp(min=1e-4) + active=(period>=2)&(npool>=3*period) + shift=torch.where(active,mr-mp,0.).expand(-1,h) + amplitude=torch.where(active,(sr/sp).clamp(.5,2.)-1,0.) + extras.extend([shift,(base[:,:,5+2*j]-mp)*amplitude]) + extra=torch.stack(extras,-1) + q=q+self.recency(extra.reshape(b,h//p,p*4)) + # Fixed normalized difference statistics expose local and seasonal repeatability. + pos=torch.arange(c,device=z.device)[None,:];stats=[] + for j in range(3): + lag=torch.ones((b,1),dtype=torch.long,device=z.device) if j==0 else periods[:,j-1:j] + window=torch.full_like(lag,512) if j==0 else 8*lag + idx=pos-lag;safe=idx.clamp(min=0,max=c-1) + pairs=(idx>=0)&(pos>=c-window)&valid&valid.gather(1,safe) + count=pairs.sum(-1);difference=z-z.gather(1,safe) + absolute=(difference.abs()*pairs).sum(-1)/count.clamp(min=1) + rms=((difference.square()*pairs).sum(-1)/count.clamp(min=1)).sqrt() + absolute=torch.where(count>=8,absolute,1.) + rms=torch.where(count>=8,rms,math.sqrt(2.)) + stats.extend([absolute.clamp(max=10).log1p(),rms.clamp(max=10).log1p()]) + q=q+self.confidence(torch.stack(stats,-1))[:,None] + for layer in self.decoder:q=layer(q,pmask,x,future_mask=future_mask) + out=self.head(self.norm(q)).view(b,h,18).float() + median=(out[:,:,:9].softmax(-1)*base).sum(-1)+out[:,:,9] + widths=F.softplus(out[:,:,10:]).clamp(max=20) + low=median[:,:,None]-widths[:,:,:4].flip(-1).cumsum(-1).flip(-1) + high=median[:,:,None]+widths[:,:,4:].cumsum(-1) + quant=torch.cat((low,median[:,:,None],high),-1)[:,:horizon] + return quant,mu,scale + + @torch.no_grad() + def predict(self,ctx,periods,horizon): + q,mu,scale=self(ctx,periods,horizon) + q=q*scale[:,:,None]+mu[:,:,None] + # Positivity is a fixed context rule, as in released foundation forecasters. + positive=((ctx>=0)|~torch.isfinite(ctx)).all(-1) + q=torch.where(positive[:,None,None],q.clamp(min=0),q) + return q.transpose(1,2) + +def loss_fn(model,ctx,target,periods,paired=True): + n=ctx.shape[0] + seen=torch.isfinite(target) + pos=torch.arange(target.shape[-1],device=target.device)[None,:]+1 + lengths=torch.where(seen,pos,0).max(-1).values.clamp(min=1) + q,mu,scale=model(torch.cat((ctx,-ctx),0),periods.repeat(2,1),target.shape[-1],forecast_lengths=lengths.repeat(2)) + if paired: + q=(q[:n]-q[n:].flip(-1))*.5 + mu=mu[:n];scale=scale[:n] + else: + ctx=torch.cat((ctx,-ctx),0) + target=torch.cat((target,-target),0) + periods=periods.repeat(2,1) + valid=torch.isfinite(target) + y=torch.nan_to_num((target-mu)/scale).clamp(-30,30) + err=y[:,:,None]-q + levels=torch.arange(1,10,device=q.device)/10 + # The evaluation gives equal importance to median MASE and average quantile loss. + pin=.5*torch.maximum(levels*err,(levels-1)*err).mean(-1)+.25*err[:,:,4].abs() + per=(pin*valid).sum(-1)/valid.sum(-1).clamp(min=1) + # A context-only seasonal scale makes highly predictable windows count more. + # It is used solely in the training loss; no inference adaptation is introduced. + with torch.no_grad(): + z,seen,_,_=model.standardize(ctx) + n=ctx.shape[-1];pos=torch.arange(n,device=ctx.device)[None,:] + lag=periods[:,0:1].clamp(min=1);idx=pos-lag;safe=idx.clamp(min=0) + pairs=(idx>=0)&seen&seen.gather(1,safe) + count=pairs.sum(-1) + errscale=((z-z.gather(1,safe)).abs()*pairs).sum(-1)/count.clamp(min=1) + errscale=torch.where(count>=8,errscale,1.) + weight=(.25+errscale).reciprocal().clamp(.25,4.) + return (per*weight).sum()/weight.sum() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/model_manifest.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/model_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..58fef8f33bec4188c92f98475e251ede3a91f15e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/model_manifest.json @@ -0,0 +1,307 @@ +{ + "name": "direct-seasonal-fresh146m", + "contract": "timeseries-forecast/v1", + "parameters": 146477344, + "pretrained_assets": [], + "sources_used": [ + "gifteval_pretrain/BEIJING_SUBWAY_30MIN", + "gifteval_pretrain/HZMETRO", + "gifteval_pretrain/LOS_LOOP", + "gifteval_pretrain/PEMS03", + "gifteval_pretrain/PEMS04", + "gifteval_pretrain/PEMS07", + "gifteval_pretrain/PEMS08", + "gifteval_pretrain/PEMS_BAY", + "gifteval_pretrain/Q-TRAFFIC", + "gifteval_pretrain/SHMETRO", + "gifteval_pretrain/alibaba_cluster_trace_2018", + "gifteval_pretrain/australian_electricity_demand", + "gifteval_pretrain/azure_vm_traces_2017", + "gifteval_pretrain/bdg-2_bear", + "gifteval_pretrain/bdg-2_fox", + "gifteval_pretrain/bdg-2_panther", + "gifteval_pretrain/bdg-2_rat", + "gifteval_pretrain/bitcoin_with_missing", + "gifteval_pretrain/borealis", + "gifteval_pretrain/borg_cluster_data_2011", + "gifteval_pretrain/buildings_900k", + "gifteval_pretrain/bull", + "gifteval_pretrain/cdc_fluview_ilinet", + "gifteval_pretrain/cdc_fluview_who_nrevss", + "gifteval_pretrain/china_air_quality", + "gifteval_pretrain/cif_2016_12", + "gifteval_pretrain/cif_2016_6", + "gifteval_pretrain/cmip6_2000", + "gifteval_pretrain/cmip6_2005", + "gifteval_pretrain/cmip6_2010", + "gifteval_pretrain/cockatoo", + "gifteval_pretrain/covid19_energy", + "gifteval_pretrain/covid_mobility", + "gifteval_pretrain/elecdemand", + "gifteval_pretrain/elf", + "gifteval_pretrain/era5_2010", + "gifteval_pretrain/era5_2011", + "gifteval_pretrain/era5_2012", + "gifteval_pretrain/era5_2013", + "gifteval_pretrain/era5_2014", + "gifteval_pretrain/era5_2015", + "gifteval_pretrain/era5_2016", + "gifteval_pretrain/era5_2017", + "gifteval_pretrain/era5_2018", + "gifteval_pretrain/extended_web_traffic_with_missing", + "gifteval_pretrain/favorita_sales", + "gifteval_pretrain/favorita_transactions", + "gifteval_pretrain/gfc12_load", + "gifteval_pretrain/gfc14_load", + "gifteval_pretrain/gfc17_load", + "gifteval_pretrain/godaddy", + "gifteval_pretrain/hog", + "gifteval_pretrain/ideal", + "gifteval_pretrain/kaggle_web_traffic_weekly", + "gifteval_pretrain/kdd2022", + "gifteval_pretrain/largest_2017", + "gifteval_pretrain/largest_2018", + "gifteval_pretrain/largest_2019", + "gifteval_pretrain/largest_2020", + "gifteval_pretrain/largest_2021", + "gifteval_pretrain/lcl", + "gifteval_pretrain/london_smart_meters_with_missing", + "gifteval_pretrain/m1_monthly", + "gifteval_pretrain/m1_quarterly", + "gifteval_pretrain/m1_yearly", + "gifteval_pretrain/m5", + "gifteval_pretrain/monash_m3_monthly", + "gifteval_pretrain/monash_m3_other", + "gifteval_pretrain/monash_m3_quarterly", + "gifteval_pretrain/nn5_daily_with_missing", + "gifteval_pretrain/nn5_weekly", + "gifteval_pretrain/oikolab_weather", + "gifteval_pretrain/pdb", + "gifteval_pretrain/project_tycho", + "gifteval_pretrain/residential_load_power", + "gifteval_pretrain/residential_pv_power", + "gifteval_pretrain/rideshare_with_missing", + "gifteval_pretrain/sceaux", + "gifteval_pretrain/smart", + "gifteval_pretrain/solar_power", + "gifteval_pretrain/spain", + "gifteval_pretrain/subseasonal", + "gifteval_pretrain/subseasonal_precip", + "gifteval_pretrain/sunspot_with_missing", + "gifteval_pretrain/taxi_30min", + "gifteval_pretrain/tourism_quarterly", + "gifteval_pretrain/tourism_yearly", + "gifteval_pretrain/traffic_hourly", + "gifteval_pretrain/traffic_weekly", + "gifteval_pretrain/uber_tlc_daily", + "gifteval_pretrain/uber_tlc_hourly", + "gifteval_pretrain/vehicle_trips_with_missing", + "gifteval_pretrain/wiki-rolling_nips", + "gifteval_pretrain/wind_farms_with_missing", + "gifteval_pretrain/wind_power", + "synthetic:both original and sign-reflected orientations of each sampled allowed or locally generated window; paired quantile loss, seed 307", + "synthetic:own Fourier/trend/intermittent generator with AR time constant log-uniform from 1 to 10000 steps and zero initial state; seed 307", + "synthetic:own direct_v1 Fourier seasons, damped trends, AR noise, changepoints and intermittent demand; seeds 307", + "synthetic:own random requested-horizon prefixes, half of rows retain the full horizon and half use a patch-rounded prefix between one-quarter and the full horizon; independent seed 300310" + ], + "weights_sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "training_lineage": [ + { + "checkpoint": "runs/random_capacity_1024/ema048000.pt", + "sha256": "227ea80abf17fc81ae191f94e91f6dd7adbc0d837235750b5f5e9cef3dd5472c", + "step": 48000, + "seed": 307, + "ema": true, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": { + "batch": 48, + "lr": 0.0002, + "steps": 96000, + "start_step": 0, + "trainable_scope": "all", + "loss_mode": "paired", + "context": null, + "sample_context": 4096, + "compile_loss": true, + "synthetic_ar_time_constants": [ + 1, + 10000 + ], + "requested_horizon_seed": 300310, + "normalization_overflow_fallback": true + }, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "parents": [ + "random_capacity_1024_initial.pt" + ] + }, + { + "checkpoint": "random_capacity_1024_initial.pt", + "sha256": "c9693619ca6277c26fef3b2bde37ff6796bec97b3af9f94588bbc5ddd329ec90", + "step": 0, + "seed": 307, + "ema": false, + "averaged_steps": null, + "packed_corpus": "packed_sample", + "sample_series": 357789, + "source_probability_reference": "packed_sample", + "packed_receipt_sha256": "63520f21e2441047a0eacbc35be0d80ac691bda90ac654094261ecc6da9d11b8", + "training_settings": {}, + "model_config": { + "d": 1024, + "heads": 16, + "enc_layers": 6, + "dec_layers": 4, + "patch": 16, + "max_context": 4096, + "max_horizon": 1024, + "recency_features": true, + "confidence_features": true, + "partial_target_lengths": true + }, + "initialization": "random initialization in this workspace" + } + ], + "symmetric_averaging": true, + "seasonal_gate": { + "variance_ratio_threshold": 0.25, + "maximum_weight": 0.98, + "cycles_averaged": 4, + "template_mode": "aligned", + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "latest_cycle_minimum_coverage": 0.75, + "variance_noise_correction": "mean squared seasonal differences / 2" + }, + "continuity": { + "decay_steps": 24, + "variance_ratio_threshold": 0.5, + "maximum_weight": 0.95, + "lookback": 512, + "slope_median_differences": 8 + }, + "notes": "All training lineage originates from random initialization here, using only the declared corpus and locally generated series. Validation was used only for selection and diagnostics. Context transformations are fixed formulas; there is no inference-time fitting or parameter adaptation.", + "runtime_code_sha256": { + "predict.py": "5583ff7e00623f91b7ef4cfbefa8ba8e08c7a0666efb3be58915c1296892f19c", + "infer.sh": "5fe66b4fe9a4787285d830cfd96975701e97286a75ba7c3687bd8891475edf68", + "seasonal.py": "b946e63048196ab5ea8b249137d48c80d8510943caccd0f180e4fb86d9b24b37", + "continuity.py": "dbb08d2229ad80ad00f638b0b9f2f6ca13c663e0fd6730058e5fee8ff54545d5", + "model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "ts_io.py": "1064d1a95a59e7edd6ed33e9a6d58c83c17fa3886acb1fb54e3652d9326ee436", + "zero_mass.py": "f079d509009bcda409b80eb64467c869b838cfbab11b2bd4c660c2875b6642fe" + }, + "normalization_overflow_fallback": { + "trigger": "nonfinite float32 context mean or scale", + "arithmetic": "float64 context statistics on affected rows; original arithmetic on ordinary rows", + "inference_fitting": false + }, + "final_training_stage": { + "trainable_scope": "all parameters", + "sign_loss": "paired", + "learning_rate_multipliers": {} + }, + "trend_summary": { + "fixed_averaging_width": 128, + "matches_all_pretraining_context_widths": true, + "independent_of_batch_padding": true + }, + "zero_mass_projection": { + "threshold_in_context_standard_deviations": 0.4, + "nonnegative_context_required": true, + "minimum_exact_zeros": 4, + "minimum_zero_fraction": 0.1, + "context_cap": 4096 + }, + "recency_features": { + "query_projection_parameters": 65536, + "latest_vs_four_cycle_level": true, + "amplitude_ratio_clip": [ + 0.5, + 2.0 + ], + "minimum_observed_cycles": 3 + }, + "confidence_features": { + "query_projection_parameters": 6144, + "backbone_frozen_during_projection_training": false, + "training_objective": "weighted quantile and median loss after averaging both sign orientations", + "statistics": [ + "mean absolute difference", + "root mean square difference" + ], + "lags": "one and the two frequency-derived periods", + "lookback": "512 for lag one; eight cycles for seasonal lags", + "minimum_valid_pairs": 8, + "insufficient_pair_defaults": [ + 1, + 1.4142135623730951 + ], + "statistic_clip": 10, + "transform": "log1p", + "stage_scope": "Projection trained jointly from random initialization; all training stages are recorded in training_lineage.training_settings." + }, + "partial_target_training": { + "available_horizon": "last finite training-label position rounded up to the patch boundary", + "decoder_future_key_mask": true, + "per_row_horizon_metadata": true, + "inference_uses_requested_horizon_only": true + }, + "training_provenance_code_sha256": { + "random_capacity/check.py": "c5090883cc4e983a41041a319a5260f4d1d5c88bb3133b0651ea5e077845fb8d", + "random_capacity/check_anneal_schedule.py": "e7a431afbd93b3a542786781a4065d5802743965dadc42759cb1d3d50c3adbd5", + "random_capacity/data.py": "d84032a33937a465acfc9e1b97004ca8d9db221509bb2710e74500703ade4344", + "random_capacity/initialize.py": "2a3326d8f2340e9f3fb9ccdea4a69c94c25f9cb969b883ec5e89bb7a53e1e317", + "random_capacity/launch_anneal.py": "3e3b8784781519f77fffac9f683eea847d14df92bf829c2022e520a6074fbb25", + "random_capacity/launch_legacy.py": "d9bd7980146ccb62c292907aa50713e37d0be2dfeac829cf075c140747e9041a", + "random_capacity/launch_lower_rate.py": "44ce2d26ce1adc76023893e82734c2634c840541e7f88f9cef5b51e503a1ef97", + "random_capacity/model.py": "44eeb23c037e91b8f67e432615ce46540a7ac4242919785f9c4218de23121499", + "random_capacity/queue_recovery3.py": "72b59dff33a62ccb584cece127fb3e0d1631a893ab3d5ffb791a3398f9d902f2", + "random_capacity/restart_corrected.py": "1f020aa304f1ce92d452ed884d0dbe5a0607f2d2c2fb6537f9e0bcf42412fde9", + "recovery/brief.py": "1d5f3d530d46c437fc5d747cac9f702835b783e0f87fea2f638d00d93acad90c", + "recovery/capacity_curves.py": "2bdc6635705b70a868e115cd13eb529563acacf6f47c71f250a50dce8e943be4", + "recovery/exposure_audit.py": "54c194a626b8876ece84686b39b22360155c9fada7248a393ca9b7d6ee38002b", + "recovery/launch_matched_cutoffs.py": "7d5b9b569df284c143bb4fe50033ed6be21ff1b54cb4405723b2ebcdefe6e562", + "recovery/matched_report.py": "82696104e2e7da9cee48611e42aebc0f5c4916f2273fdeb9a3158c4dd3700b04", + "recovery/pack_composition.py": "66c198e44b55fc4dce50dec505a0127eb9d97390e04d0f97c271ace11ad0f49f", + "recovery/quantile_coverage.py": "7a4057d1aa38c5e7de0ca601db0003a8fd3a9a2e6123b2fdb81fa8aedbc34787", + "recovery/reclaim_completed_cache.py": "d0a23e5a73b362f03a3be0d9fcc8dd5292d17da0489484a9c52af84bd05d9638", + "recovery/refresh_journal.py": "6ccbbbf7494f3b310f2e4d47e572487b62494ae52ef6598de93ce8ae28c8a7a5", + "recovery/relaunch_20261022b.py": "f90ddd77928a793c8e151ba74cfa9cc84c8aefad0c0d943a833c74bc07b79313", + "recovery/relaunch_20261023.py": "a4c40c5674b0d05cfe9bb1fffe907f02dec16c53cbddb8b86efbba1b96649097", + "recovery/schedules.py": "7748fd6b2bbbe64037472faf7e6583d03cf339138d2f3c07b1bac9e65bf2d4f5", + "recovery/seasonal_history_support.py": "fe2da1a695715c3add9472f0bfebc946783b179b1a8415f85565a937885f7076", + "recovery/snapshot.py": "a6d03761df590b9cb5aedefdebd4f9e6ae6a4aa05b27ef5e3dac16388491a2da", + "recovery/synthetic_window_audit.py": "912e38fd094f35fb528a77388d8076600207b369bb3b2c2133a24c3c485019a1", + "recovery/train.py": "39170d026adb9c43071d2618fd10955acbc52bff92c5fcba4b4ba3e3f07be861", + "recovery/watch_matched_cutoffs.py": "177dbe6d8b5186dd3ce1c4b261a55cd5cfb44f6ed2922ef64b489deb2117fa6b" + } +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/check.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/check.py new file mode 100644 index 0000000000000000000000000000000000000000..3b6d1440f762d7e57f47bb267df05b5dd786c223 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/check.py @@ -0,0 +1,49 @@ +"""Measure maximum training memory and verify compiled paired-loss gradients.""" +import argparse +import fcntl +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster,loss_fn +from data import Sampler + +ap=argparse.ArgumentParser();ap.add_argument('--width',type=int,required=True);a=ap.parse_args() +R=Path('/workspace/research');lock=open(R/'.evaluation.lock','a');fcntl.flock(lock,fcntl.LOCK_EX) +torch.set_num_threads(1);torch.manual_seed(313);torch.backends.cuda.matmul.allow_tf32=True +started=time.monotonic();ck=torch.load(R/f'random_capacity_{a.width}_initial.pt',map_location='cpu',weights_only=False) +m=DirectForecaster(**ck['config']).cuda();m.load_state_dict(ck['model']) +sampler=Sampler(R/'packed_sample',seed=313,source_weights_from=R/'packed_sample') +arrays=sampler.sample(48,4096,1024);x,y,p=[torch.from_numpy(v).cuda() for v in arrays] +# Placeholders account for the EMA and two Adam moments without taking any update. +state_placeholders=[torch.empty_like(v) for v in m.parameters() for _ in range(3)] +with torch.autocast('cuda',dtype=torch.bfloat16):loss=loss_fn(m,x,y,p,paired=True) +loss.backward();torch.cuda.synchronize() +assert torch.isfinite(loss) and all(v.grad is not None and torch.isfinite(v.grad).all() for v in m.parameters()) +memory={'batch':48,'signed_rows':96,'context':4096,'horizon':1024,'loss':float(loss.detach()), + 'peak_allocated_mib':torch.cuda.max_memory_allocated()/2**20, + 'peak_reserved_mib':torch.cuda.max_memory_reserved()/2**20} +del state_placeholders,loss,x,y,p,arrays +m.zero_grad(set_to_none=True);torch.cuda.empty_cache() +x,y,p=[torch.from_numpy(v).cuda() for v in sampler.sample(8,512,128)] +def step(fn): + m.zero_grad(set_to_none=True) + with torch.autocast('cuda',dtype=torch.bfloat16):loss=fn(m,x,y,p,paired=True) + loss.backward() + return float(loss.detach()) +reference=step(loss_fn);grads={n:v.grad.detach().clone() for n,v in m.named_parameters()} +compile_started=time.monotonic();actual=step(torch.compile(loss_fn,fullgraph=True,dynamic=False));torch.cuda.synchronize() +dot=norma=normb=0.;maximum=0. +for name,v in m.named_parameters(): + left,right=grads[name],v.grad + assert torch.isfinite(right).all() + dot+=float((left*right).sum());norma+=float(left.square().sum());normb+=float(right.square().sum()) + maximum=max(maximum,float((left-right).abs().max())) +cosine=dot/(norma*normb)**.5 +assert abs(reference-actual)<.003*max(reference,.1) and cosine>.995 +result={'normalization_overflow_fallback':True,'width':a.width,'initialization_seed':307,'fixture_seed':313,'optimizer_updates':0, + 'maximum_shape_memory':memory,'eager_loss':reference,'compiled_loss':actual, + 'gradient_cosine':cosine,'max_gradient_difference':maximum, + 'compile_comparison_seconds':time.monotonic()-compile_started, + 'total_seconds':time.monotonic()-started,'source':'allowed packed_sample and own synthetic generator only'} +(R/f'random_capacity_{a.width}_checks.json').write_text(json.dumps(result,indent=2));print(json.dumps(result),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/initialize.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/initialize.py new file mode 100644 index 0000000000000000000000000000000000000000..ff8f0f3e2d3f9dfa2e8378e90c31bab5ecf4d22e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/initialize.py @@ -0,0 +1,26 @@ +"""Create fresh local random initializations for the matched capacity comparison.""" +import hashlib +import json +from pathlib import Path +import time +import torch +from model import DirectForecaster + +R=Path('/workspace/research');torch.set_num_threads(2) +receipts=[] +for d,heads in [(512,8),(1024,16)]: + start=time.monotonic();torch.manual_seed(307) + model=DirectForecaster(d=d,heads=heads,enc_layers=6,dec_layers=4,patch=16, + recency_features=True,confidence_features=True,partial_target_lengths=True) + path=R/f'random_capacity_{d}_initial.pt' + assert not path.exists(),path + ck={'model':model.state_dict(),'config':model.config,'step':0, + 'args':{'packed':str(R/'packed_sample'),'seed':307}, + 'initialization':{'method':'torch modules initialized locally, zero output weights with fixed seasonal-mixture and interval biases', + 'seed':307,'parent_weights':[]}, + 'parent_checkpoints':[],'lr_multipliers':{}} + torch.save(ck,path) + receipts.append({'path':str(path),'sha256':hashlib.sha256(path.read_bytes()).hexdigest(), + 'parameters':sum(p.numel() for p in model.parameters()),'seed':307, + 'cpu_seconds':time.monotonic()-start,'optimizer_updates':0}) +(R/'random_capacity_initialization.json').write_text(json.dumps(receipts,indent=2));print(json.dumps(receipts)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/launch_anneal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/launch_anneal.py new file mode 100644 index 0000000000000000000000000000000000000000..b192187a1714510e172dd17378cc6b85bff26744 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/launch_anneal.py @@ -0,0 +1,38 @@ +"""Branch one fresh37M run for a matched training-only cooldown comparison.""" +def main(): + import json + import os + import subprocess + from pathlib import Path + R=Path('/workspace/research') + snapshot=json.loads((R/'random_capacity_512_recovery024000.json').read_text());assert snapshot['step']==24000 + check=json.loads((R/'random_capacity_anneal_checks.json').read_text());assert check['default_steps_bitwise_equal']==140000 + env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1',TORCHINDUCTOR_COMPILE_THREADS='2',MAX_JOBS='2', + PYTHONPATH=str(R/'compiler_support'),TRITON_CACHE_MANAGER='sibling_cache:SiblingFileCacheManager', + TRITON_CACHE_DIR='/tmp/timeseries-triton-cache',TORCHINDUCTOR_CACHE_DIR='/tmp/timeseries-inductor-cache') + command=['python3',str(R/'recovery/train.py'),'--code-dir',str(R/'random_capacity'), + '--packed',str(R/'packed_sample'),'--source-weights-from',str(R/'packed_sample'), + '--out',str(R/'runs/random_capacity_512_anneal'),'--initialize-from',str(R/'random_capacity_512_initial.pt'), + '--resume',str(R/'random_capacity_512_recovery024000.pt'),'--steps','36000','--batch','48', + '--lr','.0002','--seed','307','--loss-mode','paired','--compile-loss', + '--anneal-from-step','24000','--anneal-from-lr',str(check['join_lr']),'--anneal-final-lr','.00001', + '--stop-file',str(R/'random_capacity_512_anneal.stop')] + with (R/'random_capacity_512_anneal_queue.log').open('w') as qlog: + queued=subprocess.Popen(['python3',str(R/'queued_train.py'),'--label','E99 fresh37M early cooldown', + '--log',str(R/'random_capacity_512_anneal_train.log'), + '--receipt',str(R/'random_capacity_512_anneal_queue.json'), + '--wait-pid','5689','--require-checkpoint',str(R/'runs/patch4_candidate/recovery.pt'), + '--',*command],stdout=qlog,stderr=subprocess.STDOUT,env=env) + watchers=[] + for name in ['random_capacity_512_anneal','random_capacity_512']: + with (R/(name+'_cooldown_watch.log')).open('w') as log: + watchers.append(subprocess.Popen(['python3',str(R/'watch_evaluate.py'),'--run',str(R/'runs'/name), + '--evaluator',str(R/'random_capacity_inference/evaluate.py'),'--name',name, + '--steps','30000,36000'],stdout=log,stderr=subprocess.STDOUT,env=env)) + print({'queue_pid':queued.pid,'watch_pids':[p.pid for p in watchers]},flush=True) + result=queued.wait() + if result: + for p in watchers:p.terminate() + for p in watchers:p.wait() + raise SystemExit(result) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/restart_corrected.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/restart_corrected.py new file mode 100644 index 0000000000000000000000000000000000000000..0fa492437cc10d940ab177575b4583064dedfcb5 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/random_capacity/restart_corrected.py @@ -0,0 +1,13 @@ +"""Validate the shared numerical correction, then start exactly one matched fresh pair.""" +def main(): + import json,os,subprocess,time + from pathlib import Path + R=Path('/workspace/research');env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1',TORCHINDUCTOR_COMPILE_THREADS='2',MAX_JOBS='2',PYTHONPATH=str(R/'compiler_support'),TRITON_CACHE_MANAGER='sibling_cache:SiblingFileCacheManager',TRITON_CACHE_DIR='/tmp/timeseries-triton-cache',TORCHINDUCTOR_CACHE_DIR='/tmp/timeseries-inductor-cache') + for width in (512,1024): + assert not list((R/'runs'/f'random_capacity_{width}').glob('*.pt')) + log=R/f'random_capacity_{width}_corrected_check.log' + with log.open('w') as f:subprocess.run(['python3',str(R/'random_capacity/check.py'),'--width',str(width)],stdout=f,stderr=subprocess.STDOUT,env=env,check=True) + result=json.loads((R/f'random_capacity_{width}_checks.json').read_text());print(json.dumps(result),flush=True) + with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\nE79 corrected-normalization fixture: '+json.dumps(result)+'\n') + subprocess.run(['python3',str(R/'random_capacity/queue_recovery3.py')],env=env,check=True) +if __name__=='__main__':main() diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/capacity_curves.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/capacity_curves.py new file mode 100644 index 0000000000000000000000000000000000000000..c89a28a84243dc16ae52a1215c182a00f15dbc4e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/capacity_curves.py @@ -0,0 +1,50 @@ +"""Summarize completed validation checkpoints and measured shared-GPU training time.""" +import csv +import json +import time +from pathlib import Path + +R = Path('/workspace/research') +started = time.monotonic() +names = ['random_capacity_512', 'random_capacity_1024', 'random_capacity_1024_halflr', + 'random_capacity_full', 'distill_ensemble', 'random_capacity_512_anneal'] +rows = [] +for name in names: + log = R/(name+'_train.log') + records = {} + if log.exists(): + for line in log.read_text().splitlines(): + try: + item = json.loads(line) + except json.JSONDecodeError: + continue + if isinstance(item,dict) and 'step' in item and 'seconds' in item: + records[item['step']] = item + config_path = R/'runs'/name/'config.json' + config = json.loads(config_path.read_text()) if config_path.exists() else {} + for report in sorted((R/'evals').glob(name+'_ema*/report.json')): + result = json.loads(report.read_text()) + step = int(report.parent.name.rsplit('ema',1)[1]) + if result['n_failed']: + continue + record = records.get(step,{}) + rows.append(dict(run=name,step=step,parameters=config.get('parameters'), + seed=config.get('seed'),batch=config.get('batch'),learning_rate=config.get('lr'), + packed=config.get('packed'),skill=result['skill_score'], + rel_mase=result['rel_mase_gmean'],rel_wql=result['rel_wql_gmean'], + checkpoint_sha256=result['checkpoint_sha256'], + training_phase_loop_seconds=record.get('seconds'), + evaluation_seconds=result.get('eval_seconds'),report=str(report))) +rows.sort(key=lambda item:(names.index(item['run']),item['step'])) +output = dict(generated_utc=time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()), + note='Validation selection only. Time is logged process wall on the shared single H100, not isolated GPU time. The cooldown arm starts from the same saved24000state; its phase clock resets. No missing log time is inferred.', + rows=rows,analysis_seconds=time.monotonic()-started,no_training_or_new_inference=True) +(R/'capacity_learning_curves.json').write_text(json.dumps(output,indent=2)) +with (R/'capacity_learning_curves.csv').open('w',newline='') as handle: + writer = csv.DictWriter(handle,fieldnames=list(rows[0]) if rows else ['run']) + writer.writeheader() + writer.writerows(rows) +for name in names: + selected = [r for r in rows if r['run']==name] + if selected: + print(json.dumps(selected[-1])) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/exposure_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/exposure_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..fb67738bc9ed77f87173feda2430365e66c75966 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/exposure_audit.py @@ -0,0 +1,46 @@ +"""Describe sampled observation exposure and training invested in selected ancestry.""" +import json +import sys +import time +from pathlib import Path +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'random_capacity')) +from data import Sampler + +started=time.monotonic() +seed=521 +sampler=Sampler(R/'packed_sample',seed=seed,source_weights_from=R/'packed_sample') +rng=np.random.default_rng(seed) +rows=context_points=target_points=0 +for _ in range(320): + c=int(rng.choice([512,1024,2048,4096],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(64,c,h) + rows+=len(x) + context_points+=int(np.isfinite(x).sum()) + target_points+=int(np.isfinite(y).sum()) +manifest=json.loads(Path('/workspace/submission/model_manifest.json').read_text()) +runs={} +for item in manifest['training_lineage']: + path=Path(item['checkpoint']) + batch=item.get('training_settings',{}).get('batch') + if path.parts[0]!='runs' or not batch: + continue + run=path.parts[1] + step=item.get('step',0) + if step>runs.get(run,{}).get('step',0): + runs[run]=dict(step=step,batch=batch,rows=step*batch,checkpoint=item['checkpoint']) +ancestral_rows=sum(v['rows'] for v in runs.values()) +mean_points=(context_points+target_points)/rows +result=dict(seed=seed,seconds=time.monotonic()-started,optimizer_updates=0,validation_data_read=False, + sampled_rows=rows,mean_finite_context_points=context_points/rows, + mean_finite_target_points=target_points/rows,mean_finite_points=mean_points, + selected_descriptor=manifest['checkpoint_sha256'],ancestral_runs=runs, + selected_ancestral_rows_before_sign_pairing=ancestral_rows, + fresh96000_batch48_rows=96000*48, + fresh96000_batch48_gross_observation_presentations_estimate=96000*48*mean_points, + note='Gross sampled presentations include overlapping/resampled windows and synthetic values, not unique observations. Ancestral run maxima count compute invested in different branches, including subtracted controls; they are not an equivalent single-model training trajectory. Sign pairing duplicates compute but not distinct sampled rows. No future training recipe is inferred from this audit alone.') +(R/'training_exposure_audit.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='ancestral_runs'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/launch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/launch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..6d33e64b8212b250fc38a2990604c80228b94c80 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/launch_matched_cutoffs.py @@ -0,0 +1,14 @@ +"""Keep evaluation controllers alive for the declared queued comparisons.""" +from pathlib import Path +import datetime,json,os,subprocess +R=Path('/workspace/research');jobs={};processes={};env=dict(os.environ,OPENBLAS_NUM_THREADS='1',OMP_NUM_THREADS='1') +for name,control,runtime,label in [('lowfreq_windows','overflow_control','postloss_inference','E113'),('seasonal_history','long_seasonal','seasonal_history_inference','E121'),('seasonal_width','seasonal_dispersion','seasonal_width_inference','E129'),('long_seasonal_replication','weekly_replication_control','long_seasonal_inference','E118'),('log_horizon','overflow_control','postloss_inference','E123')]: + path=R/(name+'_matched_cutoffs.log') + with path.open('a') as log: + command=['python3',str(R/'recovery/watch_matched_cutoffs.py'),'--run',name,'--control',control,'--evaluator',str(R/runtime/'evaluate.py'),'--label',label] + p=subprocess.Popen(command,stdout=log,stderr=subprocess.STDOUT,env=env) + processes[label]=p;jobs[label]=dict(pid=p.pid,parent_pid=os.getpid(),command=command,log=str(path),receipt=str(R/(name+'_matched_cutoffs_receipt.json'))) +q=R/'CURRENT_RESEARCH_STATE.json';state=json.loads(q.read_text());state['diagnostics']['matched_cutoff_controllers']=jobs;t=q.with_suffix('.tmp');t.write_text(json.dumps(state,indent=2));os.replace(t,q) +print(json.dumps(jobs),flush=True) +for label,p in processes.items(): + result=p.wait();print(json.dumps(dict(label=label,returncode=result)),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/matched_report.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/matched_report.py new file mode 100644 index 0000000000000000000000000000000000000000..f7755cfc0300a5a18f3e2db1d6d5aa89cda9f0fa --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/matched_report.py @@ -0,0 +1,16 @@ +"""Record matched validation reports, including all configuration-group metrics.""" +import argparse,datetime,json,math +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['candidate','control','label','out']:ap.add_argument('--'+key,required=True) +ap.add_argument('--cutoffs',default='0');ap.add_argument('--outcome',required=True);a=ap.parse_args() +folders=['evals','backcast_evals','backcast2_evals','backcast3_evals'];rows=[] +for index in map(int,a.cutoffs.split(',')): + folder=folders[index];x=json.loads((R/folder/a.candidate/'report.json').read_text());y=json.loads((R/folder/a.control/'report.json').read_text()) + assert x['n_failed']==y['n_failed']==0 and x['n_configs']==y['n_configs'] + delta={g:{k:math.sqrt(y['groups'][g][k]['rel_mase_gmean']*y['groups'][g][k]['rel_wql_gmean'])-math.sqrt(v['rel_mase_gmean']*v['rel_wql_gmean']) for k,v in entries.items()} for g,entries in x['groups'].items()} + rows.append(dict(cutoff=folder,candidate_skill=x['skill_score'],control_skill=y['skill_score'],delta=x['skill_score']-y['skill_score'],candidate_checkpoint=x['checkpoint_sha256'],control_checkpoint=y['checkpoint_sha256'],candidate_eval_seconds=x.get('eval_seconds'),candidate_groups=x['groups'],control_groups=y['groups'],group_skill_delta=delta)) +result=dict(label=a.label,utc=datetime.datetime.now(datetime.timezone.utc).isoformat(),candidate=a.candidate,control=a.control,rows=rows,mean_delta=sum(v['delta'] for v in rows)/len(rows),positive_cutoffs=sum(v['delta']>0 for v in rows),outcome=a.outcome) +p=Path(a.out);assert not p.exists(),'Refuse duplicate comparison record';p.write_text(json.dumps(result,indent=2)) +with (R/'direct_v1/EXPERIMENTS.md').open('a') as f:f.write('\n'+a.label+': '+json.dumps(result)+'\n') +print(json.dumps({k:v for k,v in result.items() if k!='rows'})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/pack_composition.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/pack_composition.py new file mode 100644 index 0000000000000000000000000000000000000000..0a023de983f7c0860043b58def56406e3fd27eb9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/pack_composition.py @@ -0,0 +1,32 @@ +"""Read-only comparison of source/length composition in the two allowed packs.""" +import json,time +from pathlib import Path +import numpy as np +R=Path('/workspace/research');started=time.monotonic();old=R/'packed_sample';new=R/'packed_stratified_full' +a=json.loads((old/'meta.json').read_text());b=json.loads((new/'meta.json').read_text());assert a['dirs']==b['dirs'];names=a['dirs'] +weights=[] +for n in names: + w=min((old/(n+'.bin')).stat().st_size//4,20000000)**.25 + if n.startswith(('era5_','cmip6_')):w*=.35 + if n.startswith(('m1_','monash_m3_','tourism_')):w*=3 + weights.append(w) +weights=np.array(weights)/sum(weights);bins=np.array([16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131073]) +rows=[];aggregate={k:np.zeros(len(bins)-1) for k in ['old','full']} +for n,w in zip(names,weights): + row={'source':n,'conditional_real_source_probability':float(w)} + for k,root in [('old',old),('full',new)]: + lengths=np.diff(np.load(root/(n+'.offsets.npy'),mmap_mode='r')) + hist=np.histogram(lengths,bins=bins)[0]/len(lengths);aggregate[k]+=w*hist + row[k]={'series':len(lengths),'points':int(lengths.sum()),'mean_length':float(lengths.mean()),'median_length':float(np.median(lengths)), + 'fraction_below64':float(np.mean(lengths<64)),'fraction_below256':float(np.mean(lengths<256)), + 'fraction_at_least20480':float(np.mean(lengths>=20480)),'length_bin_probabilities':hist.tolist()} + row['weighted_length_distribution_l1']=float(w*np.abs(np.array(row['old']['length_bin_probabilities'])-row['full']['length_bin_probabilities']).sum()) + row['mixed_frequency_rows_in_full']=b['receipts'][n]['mixed_frequency_rows_in_candidates'];row['full_frequencies']=b['receipts'][n]['kept_frequencies'];rows.append(row) +result=dict(kind='per-source uniform-series sampling composition; no series values or validation labels read', + length_bins=bins.tolist(),conditional_real_length_bin_probabilities={k:v.tolist() for k,v in aggregate.items()}, + source_probabilities_unchanged=True,min_length_both=16,max_crop_length_both=131072, + mixed_frequency_sources=[r['source'] for r in rows if r['mixed_frequency_rows_in_full']],sources=rows, + seconds=time.monotonic()-started,optimizer_updates=0) +(R/'pack_composition_comparison.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='sources'})) +for row in sorted(rows,key=lambda r:-r['weighted_length_distribution_l1'])[:12]:print(json.dumps({k:v for k,v in row.items() if k not in ['old','full']},separators=(',',':')), 'mean_length',row['old']['mean_length'],row['full']['mean_length']) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/reclaim_completed_cache.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/reclaim_completed_cache.py new file mode 100644 index 0000000000000000000000000000000000000000..3961c2a56a78474daf33305e890eec17d2ece2da --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/reclaim_completed_cache.py @@ -0,0 +1,16 @@ +"""Release dispensable raw-checkpoint page cache without changing any files.""" +import datetime,json,os,time +from pathlib import Path +R=Path('/workspace/research');start=time.monotonic();mem=Path('/sys/fs/cgroup/memory.current') +before=int(mem.read_text());files=[] +for name in ['random_capacity_512','long_seasonal','seasonal_dispersion','phase_joint','weekly_replication_control','weekly_replication_candidate']: + run=R/'runs'/name + # All are completed runs; EMA and full recovery checkpoints are untouched. + q=R/(name+'_queue.json');assert json.loads(q.read_text())['status']=='complete' + for p in sorted(run.glob('step*.pt')): + fd=os.open(p,os.O_RDONLY) + try:os.posix_fadvise(fd,0,0,os.POSIX_FADV_DONTNEED) + finally:os.close(fd) + files.append(dict(path=str(p),bytes=p.stat().st_size)) +result=dict(utc=datetime.datetime.now(datetime.timezone.utc).isoformat(),files=len(files),advised_bytes=sum(x['bytes'] for x in files),before_bytes=before,after_bytes=int(mem.read_text()),seconds=time.monotonic()-start,files_changed_or_deleted=0,notes='Read-only cache hints on completed raw checkpoints only; no EMA, recovery, corpus or active training state modified.') +(R/'completed_checkpoint_cache_receipt.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/refresh_journal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/refresh_journal.py new file mode 100644 index 0000000000000000000000000000000000000000..ec7a5fa5510a4a1ba56091a72b5134cc94980467 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/refresh_journal.py @@ -0,0 +1,22 @@ +"""Atomically refresh EXPERIMENTS.md while proving every other package file unchanged.""" +import ctypes,datetime,hashlib,json,os,shutil,time +from pathlib import Path +R=Path('/workspace/research');package=Path('/workspace/submission');started=time.monotonic() +now=datetime.datetime.now(datetime.timezone.utc);tag=now.strftime('%Y%m%d_%H%M%S') +stage=package.parent/('.submission-journal-'+tag+'-'+str(os.getpid())) +def digest(path): + with path.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest() +before={str(p.relative_to(package)):digest(p) for p in package.rglob('*') if p.is_file() and p.relative_to(package).as_posix()!='EXPERIMENTS.md'} +shutil.copytree(package,stage) +shutil.copy2(R/'direct_v1/EXPERIMENTS.md',stage/'EXPERIMENTS.md') +after={str(p.relative_to(stage)):digest(p) for p in stage.rglob('*') if p.is_file() and p.relative_to(stage).as_posix()!='EXPERIMENTS.md'} +assert before==after +assert before=={str(p.relative_to(package)):digest(p) for p in package.rglob('*') if p.is_file() and p.relative_to(package).as_posix()!='EXPERIMENTS.md'},'Published package changed concurrently; refuse swap' +libc=ctypes.CDLL(None,use_errno=True) +if libc.renameat2(-100,os.fsencode(stage),-100,os.fsencode(package),2):raise OSError(ctypes.get_errno(),os.strerror(ctypes.get_errno())) +shutil.rmtree(stage) +manifest=json.loads((package/'model_manifest.json').read_text()) +result=dict(utc=now.isoformat(),checkpoint_sha256=manifest['checkpoint_sha256'],nonjournal_files_identical=len(before),journal_sha256=digest(package/'EXPERIMENTS.md'),seconds=time.monotonic()-started,new_forecasts_or_model_selection=False) +receipt=R/('journal_refresh_'+tag+'.json');receipt.write_text(json.dumps(result,indent=2)) +p=R/'CURRENT_RESEARCH_STATE.json';state=json.loads(p.read_text());state['published']['journal_refreshed_utc']=now.isoformat();state['published']['journal_refresh_receipt']=str(receipt);tmp=p.with_suffix('.tmp');tmp.write_text(json.dumps(state,indent=2));os.replace(tmp,p) +print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/schedules.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/schedules.py new file mode 100644 index 0000000000000000000000000000000000000000..4c8378f374144b802d2cd5a98afd71efc1ba0a4c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/schedules.py @@ -0,0 +1,13 @@ +"""Explicit training-only learning-rate schedules; default arithmetic unchanged.""" +import math + + +def learning_rate(step, steps, peak, reset_at=-1, anneal_from_step=None, + anneal_from_lr=None, anneal_final_lr=None): + if anneal_from_step is not None: + assert steps > anneal_from_step + assert 0 < anneal_final_lr <= anneal_from_lr + progress=max(0.,min(1.,(step-anneal_from_step)/(steps-anneal_from_step))) + return anneal_final_lr+.5*(anneal_from_lr-anneal_final_lr)*(1+math.cos(math.pi*progress)) + warm_step=step-reset_at if reset_at>=0 and step>reset_at else step + return peak*min(1,warm_step/400)*(.2+.4*(1+math.cos(math.pi*step/steps))) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/seasonal_history_support.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/seasonal_history_support.py new file mode 100644 index 0000000000000000000000000000000000000000..84314b30b22a4a761447fc5ee1cffb9301e725b9 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/seasonal_history_support.py @@ -0,0 +1,23 @@ +"""Context-metadata diagnostic of potential 8-cycle support, with no targets read.""" +import importlib.util,json,time +from pathlib import Path +import h5py,numpy as np +R=Path('/workspace/research');started=time.monotonic() +spec=importlib.util.spec_from_file_location('support_model',R/'long_seasonal/model.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m) +root=Path('/workspace/data/valid/input');index=json.loads((root/'index.json').read_text());rows=[] +for cfg in index['configs']: + with h5py.File(root/'cases'/(cfg['config_id']+'.h5'),'r') as f:lengths=np.asarray(f['context_length']) + h=cfg['prediction_length'];periods=m.periods_for_freq(cfg['freq']);row={k:cfg[k] for k in ['config_id','freq','term','domain']};row['periods']=periods;row['n_instances']=len(lengths) + for cap in [4096,16384]: + support=[];cycles=[] + for p in periods: + count=np.clip(1+(np.minimum(lengths,cap)[:,None]-p+np.arange(h)[None,:]%p)//p,0,16) + support.append(float(np.mean((count>=8)&(p>=2))));cycles.append(float(np.mean(np.where(p>=2,count,0)))) + row[str(cap)]={'phase_support_fraction':support,'mean_available_cycles':cycles} + row['support_gain_sum']=sum(row['16384']['phase_support_fraction'])-sum(row['4096']['phase_support_fraction']);rows.append(row) +changed=[r for r in rows if r['support_gain_sum']>0] +result=dict(kind='optimistic potential support before missing-value masks; not measured forecast improvement',input_metadata_only=True,validation_targets_read=False,optimizer_updates=0,configs=rows, + changed_configurations=len(changed),changed_domains=sorted(set(r['domain'] for r in changed)),seconds=time.monotonic()-started) +(R/'seasonal_history_support.json').write_text(json.dumps(result,indent=2)) +print(json.dumps({k:v for k,v in result.items() if k!='configs'})) +for r in sorted(changed,key=lambda x:x['support_gain_sum'],reverse=True)[:20]:print(json.dumps(r)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/synthetic_window_audit.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/synthetic_window_audit.py new file mode 100644 index 0000000000000000000000000000000000000000..5a6455bbd9926f9d342ee1a24ca825328a9e7e1f --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/synthetic_window_audit.py @@ -0,0 +1,63 @@ +"""Compare actual allowed/synthetic training-window dynamics without validation data.""" +import datetime +import json +from pathlib import Path +import sys +import time +import types +import numpy as np + +R=Path('/workspace/research') +sys.path.insert(0,str(R/'overflow_control')) +source=(R/'overflow_control/data.py').read_text() +needle='r=self.rng;ctx=np.full((batch,context),np.nan,np.float32);tgt=np.full((batch,horizon),np.nan,np.float32);periods=np.ones((batch,2),np.int64)' +assert source.count(needle)==1 +instrumented=source.replace(needle,needle+';self.audit_synthetic=np.zeros(batch,bool)') +needle='if r.random()=16 and len(target)>=4: + k=min(16,n//4,len(target)) + # Descriptive finite-observation means, not a proposed inference feature. + scale=max(float(np.std(values)),float(np.mean(np.abs(values)))*1e-4,1e-4) + past=(float(np.mean(values[-k:]))-float(np.mean(values[-2*k:-k])))/scale + future=(float(np.mean(target[:k].astype(np.float64)))-float(np.mean(values[-k:])))/scale + item.update(past_change=float(np.clip(past,-20,20)),future_change=float(np.clip(future,-20,20))) + groups.setdefault(frequency+'_'+kind,[]).append(item);counts+=1 +summary={} +for name,rows in groups.items(): + c=np.array([x['context'] for x in rows]);h=np.array([x['target'] for x in rows]) + valid=[x for x in rows if x['past_change'] is not None] + past=np.array([x['past_change'] for x in valid]);future=np.array([x['future_change'] for x in valid]) + summary[name]=dict(rows=len(rows),median_finite_context=float(np.median(c)), + context_at_most128=float(np.mean(c<=128)),context_above512=float(np.mean(c>512)), + median_finite_target=float(np.median(h)),dynamic_rows=len(valid), + median_abs_recent_change=float(np.median(np.abs(past))), + median_abs_future_change=float(np.median(np.abs(future))), + recent_future_change_correlation=float(np.corrcoef(past,future)[0,1])) +result=dict(seed=seed,rows=counts,batches=160,groups=summary,seconds=time.monotonic()-started, + generated_utc=datetime.datetime.now(datetime.timezone.utc).isoformat(), + instrumentation_first640_rows_and_rng_bitwise=True,optimizer_updates=0, + validation_data_read=False,decision='Descriptive audit only. E113 remains unchanged; no new generator selected.') +(R/'synthetic_window_audit.json').write_text(json.dumps(result,indent=2));print(json.dumps(result)) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/train.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/train.py new file mode 100644 index 0000000000000000000000000000000000000000..4cdae7818edfd782494fe444a1504b539d5baccf --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/train.py @@ -0,0 +1,217 @@ +"""Resumable continuation of our existing permitted-corpus experiments.""" +import argparse,copy,fcntl,inspect,json,math,os,sys,time +from concurrent.futures import ThreadPoolExecutor +from pathlib import Path +import numpy as np +import torch + +ap=argparse.ArgumentParser() +ap.add_argument('--code-dir',required=True);ap.add_argument('--packed',required=True) +ap.add_argument('--source-weights-from');ap.add_argument('--out',required=True) +ap.add_argument('--initialize-from',required=True);ap.add_argument('--initialize-ema') +ap.add_argument('--start-step',type=int,default=0);ap.add_argument('--resume') +ap.add_argument('--steps',type=int,required=True);ap.add_argument('--batch',type=int,required=True) +ap.add_argument('--lr',type=float,required=True);ap.add_argument('--seed',type=int,required=True) +ap.add_argument('--context',type=int);ap.add_argument('--sample-context',type=int,default=4096) +ap.add_argument('--save-every',type=int,default=1000);ap.add_argument('--stop-file') +ap.add_argument('--recovery-every',type=int,default=250) +ap.add_argument('--halt-after',type=int) +ap.add_argument('--loss-mode',choices=['individual','paired']) +ap.add_argument('--compile-loss',action='store_true') +ap.add_argument('--reset-at',type=int,default=-1);ap.add_argument('--reset-seed',type=int,default=179) +ap.add_argument('--anneal-from-step',type=int);ap.add_argument('--anneal-from-lr',type=float) +ap.add_argument('--anneal-final-lr',type=float) +ap.add_argument('--teacher-package');ap.add_argument('--teacher-coefficient',type=float) +ap.add_argument('--compile-teacher',action='store_true') +a=ap.parse_args() +# Hold a process-lifetime lock before loading a model or touching GPU state. +_run_out=Path(a.out);_run_out.mkdir(parents=True,exist_ok=True) +_run_lock=open(_run_out/'.training.lock','a') +try:fcntl.flock(_run_lock,fcntl.LOCK_EX|fcntl.LOCK_NB) +except BlockingIOError:raise SystemExit('Another trainer already owns this output directory: '+str(_run_out)) +if not a.resume: + _saved=list(_run_out.glob('ema*.pt'))+list(_run_out.glob('step*.pt')) + if (_run_out/'recovery.pt').exists():_saved.append(_run_out/'recovery.pt') + if _saved: + raise SystemExit('Refusing fresh training into an output with saved checkpoints; use a new directory or explicit --resume: '+str(_run_out)) +sys.path.insert(0,a.code_dir) +from model import DirectForecaster,loss_fn +from data import Sampler +from schedules import learning_rate +torch.set_num_threads(2);torch.manual_seed(a.seed);torch.backends.cuda.matmul.allow_tf32=True +out=Path(a.out);out.mkdir(parents=True,exist_ok=True);a.trainable_scope='all' +if Path(a.code_dir).name in ('long_memory_synth','paired_long_memory','multiscale_ar','random_capacity','patch8_long_memory','distill_ensemble','random_capacity_long_seasonal'):a.synthetic_ar_time_constants=[1,10000] +if Path(a.code_dir).name in ('full_paired','patch8','temporal_mixup','postloss','paired_long_memory','multiscale_ar','random_capacity','overflow_control','coarse_aggregate','patch8_long_memory','patch4','metric_scale','robust_normalization','split_patch','weekly_synth','distill_ensemble'):a.requested_horizon_seed=a.seed+300003 +if Path(a.code_dir).name=='multiscale_ar': + a.synthetic_ar_components=4;a.multiscale_ar_seed=a.seed+700003 +if Path(a.code_dir).name=='volatility_synth':a.stochastic_volatility_seed=a.seed+500003 +if Path(a.code_dir).name=='coarse_aggregate': + a.coarse_aggregation_seed=a.seed+900003;a.coarse_aggregation_probability=.2;a.coarse_aggregation_frequencies=['D','W'] +if Path(a.code_dir).name=='temporal_mixup':a.temporal_mixup_seed=a.seed+600003 +if Path(a.code_dir).name=='postloss': + a.fixed_postprocessing_loss=True;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('overflow_control','metric_scale','random_capacity','weekly_synth','distill_ensemble'):a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='weekly_synth': + a.weekly_synthetic_seed=a.seed+1000003;a.weekly_replacement_probability=1/11 +if Path(a.code_dir).name=='spectral_synth': + a.spectral_synthetic_seed=a.seed+1100003;a.spectral_replacement_probability=.5 + a.spectral_length_scale=[1,10000];a.spectral_families=['Matern0.5','Matern1.5','Matern2.5','RBF'] + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name in ('long_seasonal','phase_joint','seasonal_dispersion','seasonal_history','seasonal_width','random_capacity_long_seasonal'): + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True +if Path(a.code_dir).name=='random_capacity_original_ar': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.synthetic_ar_coefficient_law='uniform(0.2,0.995), original generator; unchanged AR branch probability and asymptotic variance scaling' +if Path(a.code_dir).name=='log_horizon': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.requested_horizon_law='half full; half geometric quantile remap of the original uniform integer endpoint draw from min(16,max(1,H//4)) to H, then patch16 rounding; identical RNG consumption' +if Path(a.code_dir).name=='seasonal_history': + a.learned_seasonal_history_context=16384;a.recent_encoder_and_rule_context=4096 + a.history_extension_rule='extend originally full4096 real contexts before the same cutoff, preserving original recent contexts, targets, aggregation, sampler RNG and horizon RNG; synthetic extra prefix missing' +if Path(a.code_dir).name=='lowfreq_windows': + a.requested_horizon_seed=a.seed+300003;a.normalization_overflow_fallback=True + a.lowfreq_window_seed=a.seed+1200003;a.lowfreq_window_probability=.5 + a.lowfreq_window_rule='period2=1,period1<=52;finite-target endpoint;log-uniform horizon4..min(H,max(8,2p),span-8) with available-length fallback;context cap min(C,max(64,32p));at least4finite history' +if Path(a.code_dir).name=='metric_scale':a.loss_seasonality='lag1 for exact daily[7,365] and weekly[52,1] period pairs; unchanged otherwise' +if Path(a.code_dir).name=='robust_normalization':a.normalization_kind='finite median plus/minus6 mean absolute deviations winsorized mean/RMS, float64; original normalized history clipped30' +if Path(a.code_dir).name=='wide_graft_frozen':a.trainable_scope='new feature stream and cross-stream blocks; inherited parameter blocks frozen' +ck=torch.load(a.resume or a.initialize_from,map_location='cpu',weights_only=False) +# Keep immutable branch ancestry across a later restart from this run's own recovery. +lineage_parents=list(ck.get('parent_checkpoints',[])) +if a.initialize_ema:lineage_parents.append(a.initialize_ema) +if a.resume and Path(a.resume).parent.resolve()!=out.resolve():lineage_parents.append(a.resume) +previous_args=ck.get('args',{}) +previous_resume=previous_args.get('resume') +if previous_resume and Path(previous_resume).parent.resolve()!=Path(previous_args.get('out',a.out)).resolve(): + lineage_parents.append(previous_resume) +lineage_parents=list(dict.fromkeys(lineage_parents)) +config=dict(ck['config']) +if a.context:config['max_context']=a.context +model=DirectForecaster(**config).cuda();model.load_state_dict(ck['model']) +teacher=None;teacher_predict=None +if Path(a.code_dir).name=='distill_ensemble': + assert a.teacher_package and a.teacher_coefficient is not None +if a.teacher_package: + assert Path(a.code_dir).name=='distill_ensemble' + from teacher import OwnEnsembleTeacher + with torch.random.fork_rng(devices=[torch.cuda.current_device()]): + teacher=OwnEnsembleTeacher(a.teacher_package) + if ck.get('args',{}).get('teacher_descriptor_sha256'): + assert ck['args']['teacher_descriptor_sha256']==teacher.descriptor_sha256 + assert ck['args']['teacher_coefficient']==a.teacher_coefficient + a.teacher_descriptor_sha256=teacher.descriptor_sha256 + a.teacher_checkpoint_sha256=teacher.member_hashes + a.teacher_target_kind='equal average of own frozen E96 raw normalized sign-paired neural quantiles, before postprocessing' + teacher_predict=teacher + if a.compile_teacher: + torch._dynamo.config.recompile_limit=64 + teacher_predict=torch.compile(teacher.__call__,fullgraph=True,dynamic=False) +else: + assert not a.compile_teacher, '--compile-teacher requires a declared own-model teacher' + +protector=None +if Path(a.code_dir).name=='wide_graft_frozen': + from frozen import FreezeInherited + protector=FreezeInherited(model) + a.protected_parameters=protector.inherited_numel +if a.compile_loss: + torch._dynamo.config.recompile_limit=64 + objective=torch.compile(loss_fn,fullgraph=True,dynamic=False) +else:objective=loss_fn +multipliers=ck.get('lr_multipliers',{}) +def optimizer(): + groups=[] + for mult in sorted(set(multipliers.values())|{1.}): + params=[p for n,p in model.named_parameters() if multipliers.get(n,1.)==mult] + if params:groups.append({'params':params,'lr':a.lr*mult,'lr_multiplier':mult,'weight_decay':.05/mult}) + return torch.optim.AdamW(groups,betas=(.9,.95),fused=True) +opt=optimizer() +if a.resume: + start_step=ck['step'];opt.load_state_dict(ck['optimizer']) + ema={k:v.cuda() for k,v in ck['ema_state'].items()} +else: + start_step=a.start_step + ema_ck=torch.load(a.initialize_ema,map_location='cpu',weights_only=False) if a.initialize_ema else ck + ema={k:v.cuda().clone() for k,v in ema_ck['model'].items()} +del ck +def make_sampler(seed): + kwargs={'seed':seed} + if 'source_weights_from' in inspect.signature(Sampler).parameters:kwargs['source_weights_from']=a.source_weights_from + return Sampler(a.packed,**kwargs),np.random.default_rng(seed) +stream_seed=a.reset_seed if a.reset_at>=0 and start_step>=a.reset_at else a.seed +sampler,rng=make_sampler(stream_seed) +def next_batch(): + c=int(rng.choice([512,1024,2048,a.sample_context],p=[.1,.15,.35,.4])) + h=int(rng.choice([32,128,512,1024],p=[.1,.2,.2,.5])) + x,y,p=sampler.sample(a.batch,c,h) + return x[:,-model.max_context:].copy(),y,p +pool=ThreadPoolExecutor(1) +if a.resume: + recovery=torch.load(a.resume,map_location='cpu',weights_only=False) + rng.bit_generator.state=recovery['batch_rng_state'];sampler.rng.bit_generator.state=recovery['sampler_rng_state'] + for name,state in recovery.get('sampler_rng_states',{}).items():getattr(sampler,name).bit_generator.state=state + torch.set_rng_state(recovery['torch_rng_state']);torch.cuda.set_rng_state_all(recovery['cuda_rng_state']) + pending=recovery['prefetched_batch'];del recovery + future=pool.submit(lambda:pending) +else:future=pool.submit(next_batch) +parameters=sum(p.numel() for p in model.parameters()) +(out/'config.json').write_text(json.dumps({**vars(a),'model':model.config,'parameters':parameters},indent=2)) +print(json.dumps({'parameters':parameters,'starting_step':start_step,'stream_seed':stream_seed,'restored_complete_training_state':bool(a.resume)}),flush=True) +started=time.monotonic();losses=[] +def atomic_save(obj,path): + torch.save(obj,str(path)+'.tmp');os.replace(str(path)+'.tmp',path) +def save(step,include_selection_weights=True): + global future + pending_batch=future.result() + common={'config':model.config,'step':step,'args':vars(a),'lr_multipliers':multipliers, + 'parent_checkpoints':list(dict.fromkeys(lineage_parents+(teacher.checkpoints if teacher else [])))} + if include_selection_weights: + for prefix,state in [('step',model.state_dict()),('ema',ema)]: + atomic_save({**common,'model':state,'ema':prefix=='ema'},out/f'{prefix}{step:06d}.pt') + atomic_save({**common,'model':model.state_dict(),'optimizer':opt.state_dict(),'ema_state':ema, + 'prefetched_batch':pending_batch,'batch_rng_state':copy.deepcopy(rng.bit_generator.state), + 'sampler_rng_state':copy.deepcopy(sampler.rng.bit_generator.state), + 'sampler_rng_states':{name:copy.deepcopy(value.bit_generator.state) for name,value in vars(sampler).items() if isinstance(value,np.random.Generator)}, + 'torch_rng_state':torch.get_rng_state(),'cuda_rng_state':torch.cuda.get_rng_state_all()},out/'recovery.pt') + future=pool.submit(lambda:pending_batch) +for step in range(start_step+1,a.steps+1): + if a.reset_at>=0 and step==a.reset_at+1 and start_step=a.halt_after) + selection_checkpoint=step%a.save_every==0 or step==a.steps or stop + # Persist a complete state before a fresh/resumed job warms its remaining compiled shapes. + if selection_checkpoint or step%a.recovery_every==0 or step==start_step+1: + save(step,include_selection_weights=selection_checkpoint) + if stop:break +pool.shutdown() +print(json.dumps({'completed_step':step,'training_process_loop_seconds':time.monotonic()-started}),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/watch_matched_cutoffs.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/watch_matched_cutoffs.py new file mode 100644 index 0000000000000000000000000000000000000000..3bd2f95022f87dbe1c349575c0ec77662a2d4d6e --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/member3/training/recovery/watch_matched_cutoffs.py @@ -0,0 +1,34 @@ +"""Complete declared primary/durability comparisons; never select a model automatically.""" +import argparse,datetime,json,os,subprocess,time +from pathlib import Path +R=Path('/workspace/research');ap=argparse.ArgumentParser() +for key in ['run','control','evaluator','label']:ap.add_argument('--'+key,required=True) +ap.add_argument('--control-evaluator');ap.add_argument('--steps',default='6000,12000');a=ap.parse_args();start=time.monotonic() +receipt=R/(a.run+'_matched_cutoffs_receipt.json') +state=dict(pid=os.getpid(),status='running',run=a.run,control=a.control,steps=[],started_utc=datetime.datetime.now(datetime.timezone.utc).isoformat()) +def save(): + state['seconds']=time.monotonic()-start;tmp=receipt.with_suffix('.tmp');tmp.write_text(json.dumps(state,indent=2));os.replace(tmp,receipt) +def call(label,command): + state['status']=label;save();t=time.monotonic();result=subprocess.run(command);state['steps'].append(dict(label=label,returncode=result.returncode,seconds=time.monotonic()-t));save() + if result.returncode:state['status']='failed';save();raise SystemExit(result.returncode) +for step in map(int,a.steps.split(',')): + name=a.run+'_ema'+str(step);report=R/'evals'/name/'report.json';state['status']='waiting for main'+str(step);save() + while not report.exists(): + queue=R/(a.run+'_queue.json') + if queue.exists() and json.loads(queue.read_text()).get('status')=='failed':state['status']='training failed';save();raise SystemExit(1) + time.sleep(3) + time.sleep(1) + call('earlier cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',name,'--weights',str(R/'runs'/a.run/f'ema{step:06d}.pt'),'--evaluator',a.evaluator,'--cutoffs','1,2,3']) + control_name=a.control+'_ema'+str(step) + if any(not (R/folder/control_name/'report.json').exists() for folder in ['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert a.control_evaluator,'Missing matched control reports; pass --control-evaluator for their declared evaluation' + call('control cutoffs'+str(step),['python3',str(R/'evaluate_cutoffs.py'),'--name',control_name,'--weights',str(R/'runs'/a.control/f'ema{step:06d}.pt'),'--evaluator',a.control_evaluator]) + out=R/(a.run+str(step//1000)+'k_four_cutoff_comparison.json') + if out.exists(): + cached=json.loads(out.read_text());assert cached['candidate']==name and cached['control']==a.control+'_ema'+str(step) and len(cached['rows'])==4 + for row,folder in zip(cached['rows'],['evals','backcast_evals','backcast2_evals','backcast3_evals']): + assert row['candidate_checkpoint']==json.loads((R/folder/name/'report.json').read_text())['checkpoint_sha256'] + assert row['control_checkpoint']==json.loads((R/folder/(a.control+'_ema'+str(step))/'report.json').read_text())['checkpoint_sha256'] + state['steps'].append(dict(label='reused verified matched comparison'+str(step),returncode=0,seconds=0));save();continue + call('matched comparison'+str(step),['python3',str(R/'recovery/matched_report.py'),'--candidate',name,'--control',a.control+'_ema'+str(step),'--label',a.label+' '+str(step)+' four-cutoff comparison','--cutoffs','0,1,2,3','--out',str(out),'--outcome',f'Declared comparison checkpoints {a.steps}. No transfer formula or automatic publication is selected by this controller.']) +state['status']='complete; research review required';save();print(json.dumps(state),flush=True) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/publish.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/publish.py new file mode 100644 index 0000000000000000000000000000000000000000..40313237b17a9a47accb31b4fa27835776886c9c --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/provenance/publish.py @@ -0,0 +1,104 @@ +"""Assemble and atomically publish a complete four-member, fixed-weight package.""" +import argparse +import ctypes +import hashlib +import json +import os +import shutil +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ap = argparse.ArgumentParser() +ap.add_argument('--member', action='append', required=True) +ap.add_argument('--out', required=True) +ap.add_argument('--report') +ap.add_argument('--experiments', default='/workspace/research/direct_v1/EXPERIMENTS.md') +a = ap.parse_args() +assert len(a.member) == 4 +final = Path(a.out) +stage = final.parent / f'.{final.name}-staging-{os.getpid()}' +shutil.rmtree(stage, ignore_errors=True) +stage.mkdir(parents=True) + +def digest(path): + h = hashlib.sha256() + with Path(path).open('rb') as f: + for block in iter(lambda: f.read(8 * 1024 * 1024), b''): + h.update(block) + return h.hexdigest() + +for name in ('infer.sh', 'predict.py', 'model.py', 'seasonal.py', 'continuity.py', + 'zero_mass.py', 'ts_io.py'): + shutil.copy2(HERE / 'runtime' / name, stage / name) +shutil.copy2('/opt/runtime/requirements.txt', stage / 'requirements.txt') +shutil.copy2(a.experiments, stage / 'EXPERIMENTS.md') +members, sources, lineage = [], set(), {} +for i, source in enumerate(map(Path, a.member)): + manifest = json.loads((source / 'model_manifest.json').read_text()) + assert manifest['pretrained_assets'] == [] + for shared in ['seasonal.py','continuity.py','zero_mass.py']: + assert digest(source/shared)==digest(stage/shared),'Members must retain identical fixed postprocessing rules' + name = f'member{i}.pt' + model_code = f'model{i}.py' + shutil.copy2(source / 'model.py', stage / model_code) + assert digest(stage / model_code) == manifest['runtime_code_sha256']['model.py'] + shutil.copy2(source / 'weights.pt', stage / name) + assert digest(stage / name) == manifest['weights_sha256'] + members.append({'weights': name, 'weights_sha256': manifest['weights_sha256'], + 'parameters': manifest['parameters'], 'config': manifest['config'], 'model_code': model_code}) + sources.update(manifest['sources_used']) + for item in manifest['training_lineage']: + lineage.setdefault(item['sha256'], item) + dst = stage / 'provenance' / f'member{i}' + dst.mkdir(parents=True) + shutil.copy2(source / 'model_manifest.json', dst / 'model_manifest.json') + shutil.copytree(source / 'provenance', dst / 'training') +shutil.copy2(__file__, stage / 'provenance' / 'publish.py') +descriptor = {'members': members, 'weights': [1/4]*4, + 'composition': 'mean after each member applies its fixed inference rules'} +(stage / 'config.json').write_text(json.dumps(descriptor, indent=2) + '\n') +identifier = digest(stage / 'config.json') +manifest = { + 'name': 'direct-seasonal-four-member-foundation', 'contract': 'timeseries-forecast/v1', + 'parameters': sum(m['parameters'] for m in members), 'pretrained_assets': [], + 'sources_used': sorted(sources), 'members': members, + 'checkpoint_sha256': identifier, + 'checkpoint_digest_method': 'SHA-256 of config.json, including ordered member weight hashes', + 'training_lineage': list(lineage.values()), 'ensemble_weights': [1/4]*4, + 'every_member_forecasts_every_instance': True, + 'member_history_caps': [{'input_and_summary': m['config']['max_context'], 'encoder_and_normalization': m['config'].get('encoder_context',m['config']['max_context']), 'fixed_rules': m['config'].get('encoder_context',m['config']['max_context'])} for m in members], + 'postprocessing_order': 'each member: sign averaging, positivity, aligned seasonal rule, continuity, zero0.4, finite-value replacement; then equal quantile average', + 'runtime_code_sha256': {p.name: digest(p) for p in stage.iterdir() if p.suffix in ('.py', '.sh')}, + 'notes': 'All members originate from random initialization in this workspace. Only declared pretraining sources and local generators were used. Validation is selection/diagnostics only. No inference-time fitting or parameter adaptation.', +} +(stage / 'model_manifest.json').write_text(json.dumps(manifest, indent=2) + '\n') +if a.report: + report = json.loads(Path(a.report).read_text()) + assert report['checkpoint_sha256'] == identifier + shutil.copy2(a.report, stage / 'validation_report.json') +else: + report = {'status': 'candidate validation pending'} + (stage / 'validation_report.json').write_text(json.dumps(report) + '\n') +if final.resolve() == Path('/workspace/submission').resolve(): + assert a.report and report['n_configs'] == 97 and report['n_instances'] == 151170 + assert report['n_failed'] == 0 +patch_sizes = ', '.join(str(m['config'].get('input_patch', m['config']['patch'])) + '/' + str(m['config']['patch']) for m in members) +(stage / 'README.md').write_text(f'''# Four-member seasonal foundation forecaster + +Run `bash infer.sh INPUT_DIR OUTPUT_DIR`. All runtime assets are included, with versions pinned in requirements.txt. The package contains four locally trained models totaling {manifest['parameters']:,} parameters. Every member forecasts every instance; their nine ordered quantiles are averaged with fixed equal weights of 1/4 each. + +Each member retains its declared context limits, listed in model_manifest.json under member_history_caps. A model with a separate encoder_context uses longer history only for learned seasonal summaries; its encoder, normalization and fixed forecast rules use the shorter declared limit. Their history/forecast patch sizes are {patch_sizes}, in member order. Each member retains its own original model implementation and normalization; overflow handling follows each member's own implementation. Each member uses finite-history normalization and the same fixed sign averaging, positivity, seasonal, continuity and zero-mass rules. The seasonal template aligns four cycles to the latest cycle's mean and amplitude. The trend summary uses a fixed width of 128 observations. The zero projection threshold is 0.4 context standard deviations. No additional zero projection is applied after averaging. There is no inference-time training, fitting or parameter adaptation. + +model_manifest.json declares every source, member hash and training lineage. config.json contains relative member paths and their hashes. The original member manifests and all trainer/generator code are archived in provenance/. No pretrained assets were used. Normalization uses the supplied context and needs no external statistics. + +EXPERIMENTS.md records hypotheses, negative results, compute, group metrics and hashes. validation_report.json records the package evaluation. Validation and earlier-cutoff scores are not the held-out reward scale. +''') +if final.exists(): + libc = ctypes.CDLL(None, use_errno=True) + if libc.renameat2(-100, os.fsencode(stage), -100, os.fsencode(final), 2): + raise OSError(ctypes.get_errno(), os.strerror(ctypes.get_errno())) + shutil.rmtree(stage) +else: + os.replace(stage, final) +print(json.dumps({'out': str(final), 'checkpoint_sha256': identifier, + 'parameters': manifest['parameters']})) diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/requirements.txt b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca733199990e5dc8e6a90509cc691f00ab8e9f5d --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/requirements.txt @@ -0,0 +1,12 @@ +# Runtime pins recorded from the contributor's working environment on 2026-09-17 (Python 3.11). +# torch comes from the pytorch/pytorch:2.14.0-cuda12.6-cudnn9-runtime base image (cu130 needs driver >= 580). +torch==2.14.0 +numpy==2.4.6 +h5py==3.16.0 +pandas==2.3.3 +scipy==1.17.1 +pyarrow==25.0.1 +huggingface-hub==0.36.2 +einops==0.8.2 +safetensors==0.8.0 +pytest==9.1.1 diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/seasonal.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/seasonal.py new file mode 100644 index 0000000000000000000000000000000000000000..cd8d8ebbf65c59c69f3d1c537e8cd5cb024d0330 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/seasonal.py @@ -0,0 +1,51 @@ +"""A fixed confidence gate for highly repeatable history; no fitted parameters.""" +import numpy as np + +def apply_gate(ctx,periods,quant,threshold=.25,strength=1.,cycles=4,mode='aligned'): + # Each row uses only its own context. Quantile blending preserves ordering. + b,_,h=quant.shape + out=quant.copy() + for i in range(b): + x=ctx[i];valid=np.isfinite(x) + if not valid.any():continue + x=x[np.flatnonzero(valid)[0]:] + best=None + for p in periods[i]: + p=int(p) + if p<2 or len(x)<3*p:continue + k=min(len(x)//p,8);history=x[-k*p:] + pairs=np.isfinite(history[p:])&np.isfinite(history[:-p]) + if pairs.sum()0) + if mode in ('centered','aligned'): + mu=mu+np.nanmean(seasons[-1])-np.nanmean(mu) + if mode=='aligned' and np.isfinite(seasons[-1]).sum()>=max(2,.75*p): + noise=float(np.mean(err.astype(np.float64)**2)/2) + target_var=max(0.,float(np.nanvar(seasons[-1]))-noise) + template_var=max(0.,float(np.nanvar(mu))-noise/min(k,cycles)) + ratio=float(np.clip(np.sqrt(target_var/max(template_var,1e-12)),.5,2.)) + center=float(np.nanmean(mu));mu=center+(mu-center)*ratio + if mode=='exponential': + w=.5**np.arange(len(recent)-1,-1,-1,dtype=np.float32) + den=(w[:,None]*np.isfinite(recent)).sum(0) + mu=np.divide((w[:,None]*np.nan_to_num(recent)).sum(0),den,out=np.full(p,np.nan,np.float32),where=den>0) + # Error of a season relative to the previous one, corrected for averaging. + sigma=float(np.sqrt(np.mean(err.astype(np.float64)**2)/2*(1+1/min(k,cycles)))) + idx=np.arange(h)%p;median=mu[idx] + z=np.array([-1.2815515655,-.8416212336,-.5244005127,-.2533471031,0,.2533471031,.5244005127,.8416212336,1.2815515655]) + sq=median[None]+z[:,None]*sigma + sq=np.where(np.isfinite(sq),sq,quant[i]) + if np.nanmin(x)>=0:sq=np.maximum(0,sq) + best=(weight,sq) + if best is not None:out[i]=(1-best[0])*quant[i]+best[0]*best[1] + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/ts_io.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/ts_io.py new file mode 100644 index 0000000000000000000000000000000000000000..21312ff6b9a3eada8e4042ebf33ce8147f78db6a --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/ts_io.py @@ -0,0 +1,433 @@ +"""Shared I/O for the timeseries-forecasting task (contract timeseries-forecast/v1). + +Three things live here because the case builder, the grader, the starter and +the reference packages must agree on them exactly: + +1. GIFT-Eval protocol constants and the frequency -> horizon / seasonality + tables, transcribed from gift-eval `src/gift_eval/data.py` at commit + db743860 and gluonts 0.15.1 `time_feature.seasonality`. They are tables, + not runtime derivations, so a pandas alias rename cannot silently change a + horizon or a seasonality. +2. Readers for the Arrow `save_to_disk` layout of Salesforce/GiftEval + (`/[/]data-00000-of-00001.arrow`), implemented with pyarrow + only, and the rolling-window instance generator that reproduces + `Dataset.test_data` / `Dataset.validation_dataset` of gift-eval. +3. The case-file format: one HDF5 file per (dataset, frequency, term) config + holding every forecast instance's context, and one HDF5 prediction file per + config holding the mean and the nine decile forecasts. +""" +from __future__ import annotations + +import functools +import hashlib +import json +import math +import os +import re +import stat +from pathlib import Path + +import numpy as np + +CONTRACT = "timeseries-forecast/v1" +QUANTILE_LEVELS = (0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9) +CONTEXT_CAP = 16384 # observations of history given per instance; the only deviation from GIFT-Eval (see contract.md) +TEST_SPLIT = 0.1 +MAX_WINDOW = 20 +TERM_MULTIPLIER = {"short": 1, "medium": 10, "long": 15} +PRED_LENGTH_MAP = {"M": 12, "W": 8, "D": 30, "H": 48, "T": 48, "S": 60} +M4_PRED_LENGTH_MAP = {"A": 6, "Q": 8, "M": 18, "W": 13, "D": 14, "H": 48} +# gluonts DEFAULT_SEASONALITIES for the base unit; a multiple n gives base // n when it divides, else 1 +BASE_SEASONALITY = {"S": 3600, "T": 1440, "H": 24, "D": 1, "W": 1, "M": 12, "B": 5, "Q": 4, "A": 1} +_UNIT_ALIASES = {"min": "T", "h": "H", "s": "S", "Y": "A", "YE": "A", "QE": "Q", "ME": "M", "MS": "M", "AS": "A", "YS": "A", "QS": "Q"} +_FREQ_RE = re.compile(r"^(\d*)([A-Za-z]+)(?:-([A-Za-z]+))?$") + + +def parse_freq(freq: str) -> tuple[int, str]: + """'15T' -> (15, 'T'); 'W-SUN' -> (1, 'W'); 'A-DEC' -> (1, 'A'); 'h' -> (1, 'H').""" + m = _FREQ_RE.match(freq.strip()) + if not m: + raise ValueError(f"unrecognised frequency {freq!r}") + n = int(m.group(1) or 1) + unit = _UNIT_ALIASES.get(m.group(2), m.group(2)) + if unit not in BASE_SEASONALITY: + raise ValueError(f"unrecognised frequency unit in {freq!r}") + return n, unit + + +def prediction_length(dataset: str, freq: str, term: str) -> int: + _, unit = parse_freq(freq) + table = M4_PRED_LENGTH_MAP if "m4" in dataset else PRED_LENGTH_MAP + return TERM_MULTIPLIER[term] * table[unit] + + +def seasonality(freq: str) -> int: + n, unit = parse_freq(freq) + base = BASE_SEASONALITY[unit] + q, r = divmod(base, n) + return q if r == 0 else 1 + + +def n_windows(dataset: str, min_series_length: int, pred_len: int) -> int: + if "m4" in dataset: + return 1 + w = math.ceil(TEST_SPLIT * min_series_length / pred_len) + return min(max(1, w), MAX_WINDOW) + + +def config_id(dataset: str, freq_unit: str, term: str) -> str: + """Leaderboard key 'electricity/H/short' -> file stem 'electricity__H__short' (the freq subfolder is dropped: keys are unique).""" + return f"{dataset.split('/')[0]}__{freq_unit}__{term}" + + +# gift-eval notebooks: results keys use the frequency sub-folder (or dataset_properties.json for flat datasets) and pretty names +LEADERBOARD_FREQ = {"m4_yearly": "A", "m4_quarterly": "Q", "m4_monthly": "M", "m4_weekly": "W", "m4_daily": "D", "m4_hourly": "H", + "hospital": "M", "covid_deaths": "D", "temperature_rain_with_missing": "D", "car_parts_with_missing": "M", + "restaurant": "D", "bizitobs_application": "10S", "bizitobs_service": "10S"} +LEADERBOARD_NAME = {"saugeenday": "saugeen", "temperature_rain_with_missing": "temperature_rain", + "kdd_cup_2018_with_missing": "kdd_cup_2018", "car_parts_with_missing": "car_parts"} + + +def leaderboard_key(dataset: str, term: str) -> str: + """Key used in the GIFT-Eval results CSVs, e.g. 'electricity/15T/short', 'kdd_cup_2018/H/short', 'loop_seattle/5T/short' (lower-cased).""" + base, _, sub = dataset.partition("/") + freq = sub if sub else LEADERBOARD_FREQ[base] + base = base.lower() + return f"{LEADERBOARD_NAME.get(base, base)}/{freq}/{term}" + + +VALID_MIN_CONTEXT = 8 # a validation window is staged only if at least this many observations precede it + + +# ----------------------------------------------------------------------------- Arrow readers + + +def arrow_path(root: Path, dataset: str) -> Path: + return Path(root) / dataset / "data-00000-of-00001.arrow" + + +def read_arrow_dataset(root: Path, dataset: str): + """Return (item_ids, starts (datetime64[s]), freq, series) for one GIFT-Eval dataset. + + `series` is a list of float32 arrays of shape (D, T); univariate datasets + give D = 1. Missing values are NaN as stored. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + series = [] + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + # multivariate: fixed_size_list> (or list>) -> (D, T) per item + if pa.types.is_fixed_size_list(target.type): + k = target.type.list_size + outer_off = (np.arange(len(target) + 1, dtype=np.int64) + target.offset) * k + else: + outer_off = target.offsets.to_numpy() + inner = target.values + inner_off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + d0, d1 = outer_off[i], outer_off[i + 1] + rows = [flat[inner_off[j]:inner_off[j + 1]] for j in range(d0, d1)] + if len({len(r) for r in rows}) != 1: + raise ValueError(f"{dataset} item {item_ids[i]}: variates of unequal length") + series.append(np.stack(rows)) + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False).astype(np.float32) + for i in range(len(target)): + series.append(flat[off[i]:off[i + 1]][None, :]) + return item_ids, starts, freq, series + + +def read_arrow_index(root: Path, dataset: str): + """Series metadata without building one array per series: (item_ids, starts, freq, lengths, fingerprints). + + The planning passes (cutoff cohorts, validation boundaries) need only lengths and identities, and a dataset can + hold 48,000 series, so they avoid the per-series slicing that `read_arrow_dataset` does. + """ + import pyarrow as pa + + with open(arrow_path(root, dataset), "rb") as f: + table = pa.ipc.open_stream(f).read_all() + item_ids = table.column("item_id").to_pylist() + starts = table.column("start").to_pandas().to_numpy().astype("datetime64[s]") + freq = table.column("freq")[0].as_py() + target = table.column("target").combine_chunks() + if pa.types.is_list(target.type.value_type) or pa.types.is_fixed_size_list(target.type.value_type): + inner = target.values + off = inner.offsets.to_numpy() + flat = inner.values.to_numpy(zero_copy_only=False) + width = target.type.list_size if pa.types.is_fixed_size_list(target.type) else None + if width is None: + outer = target.offsets.to_numpy() + first = outer[:-1] + else: + first = (np.arange(len(target)) + target.offset) * width + else: + off = target.offsets.to_numpy() + flat = target.values.to_numpy(zero_copy_only=False) + first = np.arange(len(target)) + lengths = (off[first + 1] - off[first]).astype(np.int64) + fingerprints = [] + for i, start in enumerate(first): + a, b = off[start], off[start + 1] + head, tail = flat[a:min(a + 32, b)], flat[max(a, b - 32):b] + fingerprints.append((int(lengths[i]), hashlib.sha256(head.tobytes() + tail.tobytes()).hexdigest()[:16])) + return item_ids, starts, freq, lengths, fingerprints + + +def config_table(root: Path, dataset: str, term: str) -> dict: + """Protocol quantities of one (dataset, term) config, read from the Arrow file.""" + item_ids, starts, freq, series = read_arrow_dataset(root, dataset) + n, unit = parse_freq(freq) + lengths = np.array([s.shape[1] for s in series]) + pred_len = prediction_length(dataset, freq, term) + windows = n_windows(dataset, int(lengths.min()), pred_len) + return { + "dataset": dataset, "freq": freq, "freq_unit": unit, "freq_multiple": n, "term": term, + "config_id": config_id(dataset, unit, term), "leaderboard_key": leaderboard_key(dataset, term), + "prediction_length": pred_len, "seasonality": seasonality(freq), "windows": windows, + "n_series": len(series), "n_variates": int(series[0].shape[0]), + "min_length": int(lengths.min()), "max_length": int(lengths.max()), + "n_test_instances": len(series) * windows, "n_valid_instances": len(series), + } + + +def test_cutoffs(length: int, pred_len: int, windows: int) -> list[int]: + """gluonts split(offset=-L*W).generate_instances(L, windows=W, distance=L): cutoff k = T - L*W + k*L.""" + return [length - pred_len * windows + k * pred_len for k in range(windows)] + + +def valid_cutoff(length: int, pred_len: int, windows: int) -> int: + """This config's own validation window: the last horizon of gift-eval's `validation_dataset` prefix, which + `training_dataset` (offset -L*(W+1)) excludes. + + A series usually appears in several configs (terms, and aggregated frequencies of the same meter), whose test + regions start at different times; the earliest of them is the only safe boundary for the agent-visible validation + data. `make_cases.py` therefore stages validation against that boundary and uses this function only as the + per-config upper bound. + """ + return length - pred_len * (windows + 1) + + +def steps_between(start: np.datetime64, freq: str, timestamp: str) -> int: + """How many steps of `freq` separate `start` from `timestamp` (the index of that timestamp in the series grid).""" + import pandas as pd + + multiple, _ = parse_freq(freq) + f = _pandas_freq(freq) + # a Period difference is in base units ('15T' counts minutes), so divide by the multiple to get steps + delta = (pd.Period(pd.Timestamp(timestamp), freq=f) - pd.Period(pd.Timestamp(start), freq=f)).n + return int(delta) // multiple + + +@functools.lru_cache(maxsize=4096) +def _base_period(start: str, freq: str): + import pandas as pd + + return pd.Period(pd.Timestamp(start), freq=_pandas_freq(freq)) + + +def timestamp_after(start: np.datetime64, freq: str, steps: int) -> str: + """ISO timestamp of the observation `steps` after `start` under pandas frequency `freq`.""" + return (_base_period(str(start), freq) + int(steps)).to_timestamp().isoformat() + + +def _pandas_freq(freq: str) -> str: + n, unit = parse_freq(freq) + anchor = freq.split("-")[1] if "-" in freq else "" + new = {"T": "min", "H": "h", "S": "s", "A": "Y", "M": "M", "Q": "Q", "W": "W", "D": "D", "B": "B"}[unit] + return f"{n if n != 1 else ''}{new}{'-' + anchor if anchor else ''}" + + +# ----------------------------------------------------------------------------- case files + + +def write_case_file(path: Path, meta: dict, contexts: list[np.ndarray], item_ids, windows, forecast_starts, history_lengths, cohorts=None): + """contexts: list of (D, T_i) float32 arrays (already capped); history_lengths: uncapped history length per instance; + cohorts: verifier invocation group per instance (see make_cases.py), optional.""" + import h5py + + d = int(meta["n_variates"]) + lengths = np.array([c.shape[1] for c in contexts], dtype=np.int64) + offsets = np.zeros(len(contexts) + 1, dtype=np.int64) + offsets[1:] = np.cumsum(lengths * d) + values = np.concatenate([c.reshape(-1) for c in contexts]).astype(np.float32) if contexts else np.zeros(0, np.float32) + path.parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("values", data=values) + f.create_dataset("offsets", data=offsets) + f.create_dataset("context_length", data=lengths) + f.create_dataset("history_length", data=np.asarray(history_lengths, dtype=np.int64)) + f.create_dataset("item_id", data=np.array(item_ids, dtype=h5py.string_dtype())) + f.create_dataset("window", data=np.asarray(windows, dtype=np.int64)) + f.create_dataset("forecast_start", data=np.array(forecast_starts, dtype=h5py.string_dtype())) + if cohorts is not None: + f.create_dataset("cohort", data=np.asarray(cohorts, dtype=np.int64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + f.attrs["contract"] = CONTRACT + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + + +def write_case_subset(src: "CaseFile", indices, dst: Path): + """Write the instances `indices` of an open CaseFile to a new case file (same attrs, contexts copied).""" + import h5py + + indices = np.asarray(indices, dtype=np.int64) + contexts = [src.context(int(i)) for i in indices] + meta = {k: v for k, v in src.meta.items() if k not in ("contract", "quantile_levels")} + write_case_file(dst, meta, contexts, [src.item_id[i] for i in indices], src.window[indices], + [src.forecast_start[i] for i in indices], src.history_length[indices]) + with h5py.File(dst, "r+") as f: + f.create_dataset("cohort", data=src.cohort[indices]) + f.create_dataset("source_index", data=indices) + + +class CaseFile: + """Read-only view of one staged config: `meta` attrs and `context(i)` -> (D, T_i) float32.""" + + def __init__(self, path: Path): + import h5py + + self.path = Path(path) + self._f = h5py.File(self.path, "r") + self.meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in self._f.attrs.items()} + self.n_variates = int(self.meta["n_variates"]) + self.prediction_length = int(self.meta["prediction_length"]) + self.offsets = self._f["offsets"][()] + self.n = len(self.offsets) - 1 + self.item_id = [s.decode() if isinstance(s, bytes) else s for s in self._f["item_id"][()]] + self.window = self._f["window"][()] + self.context_length = self._f["context_length"][()] + self.forecast_start = [s.decode() if isinstance(s, bytes) else s for s in self._f["forecast_start"][()]] + self.history_length = self._f["history_length"][()] + self.cohort = self._f["cohort"][()] if "cohort" in self._f else np.zeros(self.n, dtype=np.int64) + self.source_index = self._f["source_index"][()] if "source_index" in self._f else np.arange(self.n) + + def context(self, i: int) -> np.ndarray: + v = self._f["values"][self.offsets[i]:self.offsets[i + 1]] + return v.reshape(self.n_variates, -1) + + def contexts(self): + values = self._f["values"][()] + for i in range(self.n): + yield values[self.offsets[i]:self.offsets[i + 1]].reshape(self.n_variates, -1) + + def close(self): + self._f.close() + + +def write_prediction_file(path: Path, mean: np.ndarray, quantiles: np.ndarray, meta: dict | None = None): + """mean (N, D, H) float32; quantiles (N, D, 9, H) float32 ordered by QUANTILE_LEVELS.""" + import h5py + + mean = np.asarray(mean, dtype=np.float32) + quantiles = np.asarray(quantiles, dtype=np.float32) + if mean.ndim != 3 or quantiles.ndim != 4 or quantiles.shape[:2] != mean.shape[:2] or quantiles.shape[3] != mean.shape[2] or quantiles.shape[2] != len(QUANTILE_LEVELS): + raise ValueError(f"bad prediction shapes mean={mean.shape} quantiles={quantiles.shape}") + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("mean", data=mean) + f.create_dataset("quantiles", data=quantiles) + f.attrs["quantile_levels"] = np.array(QUANTILE_LEVELS) + f.attrs["contract"] = CONTRACT + for k, v in (meta or {}).items(): + f.attrs[k] = v + + +PREDICTION_DATASETS = ("mean", "quantiles") + + +def open_package_h5(path, names=PREDICTION_DATASETS): + """Open an HDF5 file a package wrote, refusing anything but a regular file whose `names` are plain datasets. + + The verifier reads package output with its own privileges, outside every isolation mode, so it must not follow + anything the package put in the file: an external or soft link, a virtual dataset or external raw storage can + point at the held-out labels and would be resolved here. A FIFO or device in place of the file would block.""" + import h5py + + st = os.lstat(path) + if not stat.S_ISREG(st.st_mode): + raise ValueError("not a regular file (symlinks, FIFOs and devices are refused)") + f = h5py.File(path, "r") + try: + for name in names: + link = f.get(name, getlink=True) + if link is None: + raise KeyError(f"no {name!r} dataset") + if not isinstance(link, h5py.HardLink): + raise ValueError(f"{name!r} is a {type(link).__name__}; only plain datasets are read") + d = f[name] + if not isinstance(d, h5py.Dataset) or d.is_virtual or d.external: + raise ValueError(f"{name!r} is not a plain dataset (virtual or external storage is refused)") + except Exception: + f.close() + raise + return f + + +def prediction_shapes(path: Path): + """(mean shape, quantiles shape, attrs) without reading the arrays, so a mis-declared file cannot exhaust memory.""" + with open_package_h5(path) as f: + attrs = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return tuple(f["mean"].shape), tuple(f["quantiles"].shape), attrs + + +def read_prediction_file(path: Path, expect: tuple | None = None): + """Read mean and quantiles. `expect` is the required mean shape (N, D, H); the file is rejected before it is read.""" + with open_package_h5(path) as f: + got_m, got_q = tuple(f["mean"].shape), tuple(f["quantiles"].shape) + want_q = None if expect is None else (expect[0], expect[1], len(QUANTILE_LEVELS), expect[2]) + if expect is not None and (got_m != tuple(expect) or got_q != want_q): + raise ValueError(f"bad shapes mean={got_m} quantiles={got_q} expected {tuple(expect)} / {want_q}") + return f["mean"][()], f["quantiles"][()] + + +def write_truth_file(path: Path, labels: np.ndarray, seasonal_error: np.ndarray, meta: dict): + """labels (N, D, H) float32 with NaN where the benchmark has missing targets; seasonal_error (N, D) float64.""" + import h5py + + Path(path).parent.mkdir(parents=True, exist_ok=True) + with h5py.File(path, "w") as f: + f.create_dataset("labels", data=np.asarray(labels, dtype=np.float32)) + f.create_dataset("seasonal_error", data=np.asarray(seasonal_error, dtype=np.float64)) + for k, v in meta.items(): + f.attrs[k] = json.dumps(v) if isinstance(v, (dict, list)) else v + + +def read_truth_file(path: Path): + import h5py + + with h5py.File(path, "r") as f: + meta = {k: (v.item() if hasattr(v, "item") and np.ndim(v) == 0 else v) for k, v in f.attrs.items()} + return f["labels"][()], f["seasonal_error"][()], meta + + +def seasonal_error(history: np.ndarray, m: int) -> np.ndarray: + """gluonts 0.15.1 seasonal error on the full (uncapped) history, per variate. + + Reproduces `gluonts.model.evaluation._get_data_batch` with + `mask_invalid_label=True`: the history is a masked array, so the mean of + |x[t] - x[t-m]| runs over the pairs where both observations are finite. + If m > T the lag is 1 (gluonts.ev.ts_stats.seasonal_error). A variate with + no valid pair gets NaN. + """ + t = history.shape[-1] + lag = m if m <= t else 1 + if t <= lag: + return np.full(history.shape[0], np.nan) + x = history.astype(np.float64) + diff = np.abs(x[:, lag:] - x[:, :-lag]) + valid = np.isfinite(diff) + count = valid.sum(axis=-1) + with np.errstate(invalid="ignore", divide="ignore"): + out = np.where(valid, diff, 0.0).sum(axis=-1) / count + out[count == 0] = np.nan + return out diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/validation_report.json b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/validation_report.json new file mode 100644 index 0000000000000000000000000000000000000000..7f79fba104c33b3975b5f1173ac09d6e22f2bc03 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/validation_report.json @@ -0,0 +1,4889 @@ +{ + "contract": "timeseries-forecast/v1", + "split": "valid", + "reward": 0.3843356309048914, + "skill_score": 0.3843356309048914, + "rel_mase_gmean": 0.7359642442141643, + "rel_wql_gmean": 0.5150285742183113, + "n_configs": 97, + "n_failed": 0, + "n_instances": 151170, + "n_instances_scored": 151170, + "n_partial": 0, + "failures": [], + "groups": { + "term": { + "long": { + "n_configs": 21, + "rel_mase_gmean": 0.737118960218793, + "rel_wql_gmean": 0.48667183514735635 + }, + "medium": { + "n_configs": 21, + "rel_mase_gmean": 0.7035172396977293, + "rel_wql_gmean": 0.4964403554946446 + }, + "short": { + "n_configs": 55, + "rel_mase_gmean": 0.7482961321370007, + "rel_wql_gmean": 0.5337250973880802 + } + }, + "domain": { + "Econ/Fin": { + "n_configs": 6, + "rel_mase_gmean": 0.893578930735471, + "rel_wql_gmean": 0.8473388865636031 + }, + "Energy": { + "n_configs": 32, + "rel_mase_gmean": 0.8934383819228326, + "rel_wql_gmean": 0.6441670685939594 + }, + "Healthcare": { + "n_configs": 5, + "rel_mase_gmean": 0.5483401243523415, + "rel_wql_gmean": 0.4812368345835373 + }, + "Nature": { + "n_configs": 15, + "rel_mase_gmean": 0.7952712794599404, + "rel_wql_gmean": 0.3894018030522033 + }, + "Sales": { + "n_configs": 4, + "rel_mase_gmean": 0.8218554935452521, + "rel_wql_gmean": 0.5047300757718958 + }, + "Transport": { + "n_configs": 15, + "rel_mase_gmean": 0.637795110308104, + "rel_wql_gmean": 0.43490202133038397 + }, + "Web/CloudOps": { + "n_configs": 20, + "rel_mase_gmean": 0.5631095098301198, + "rel_wql_gmean": 0.443377410953268 + } + }, + "frequency": { + "A": { + "n_configs": 1, + "rel_mase_gmean": 0.6753196159664212, + "rel_wql_gmean": 0.7204585967467494 + }, + "D": { + "n_configs": 15, + "rel_mase_gmean": 0.7564062231320686, + "rel_wql_gmean": 0.5135018526992328 + }, + "H": { + "n_configs": 31, + "rel_mase_gmean": 0.7311529321708659, + "rel_wql_gmean": 0.4964506341553277 + }, + "M": { + "n_configs": 5, + "rel_mase_gmean": 0.9343468429014872, + "rel_wql_gmean": 0.776257411102681 + }, + "Q": { + "n_configs": 1, + "rel_mase_gmean": 0.7919765320929799, + "rel_wql_gmean": 0.8300240379038908 + }, + "S": { + "n_configs": 6, + "rel_mase_gmean": 0.6586269271207137, + "rel_wql_gmean": 0.5044889652359165 + }, + "T": { + "n_configs": 30, + "rel_mase_gmean": 0.6849694605495583, + "rel_wql_gmean": 0.4585273852593319 + }, + "W": { + "n_configs": 8, + "rel_mase_gmean": 0.8802338504255324, + "rel_wql_gmean": 0.6554946529894189 + } + }, + "variates": { + "multivariate": { + "n_configs": 43, + "rel_mase_gmean": 0.7098655437346444, + "rel_wql_gmean": 0.5131512616033498 + }, + "univariate": { + "n_configs": 54, + "rel_mase_gmean": 0.7574311013501122, + "rel_wql_gmean": 0.5165283819925589 + } + } + }, + "quantile_crossing_fraction_mean": 0.0, + "configs": [ + { + "config_id": "m4_yearly__A__short", + "leaderboard_key": "m4_yearly/A/short", + "dataset": "m4_yearly", + "term": "short", + "freq": "A-DEC", + "prediction_length": 6, + "seasonality": 1, + "n_variates": 1, + "n_instances": 22728, + "domain": "Econ/Fin", + "n_cohorts": 3, + "skipped_series": 235, + "dropped_containers": 11, + "status": "ok", + "baseline": { + "mase": 4.730803330645802, + "wql": 0.15602350647819704 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 22728, + "instances": 22728, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.1948042884643897, + "wql": 0.1124084765367892, + "wsql_by_level": [ + 0.06296747351073721, + 0.09705563758206011, + 0.11893946343008378, + 0.13191424104015254, + 0.1378204885356627, + 0.13771564654954432, + 0.13003577346456974, + 0.11299911062839252, + 0.08222845408989979 + ], + "n_valid_labels": 136368, + "n_masked_labels": 0, + "mae_median": 715.413497108727, + "n_mase_elements": 136356, + "n_seasonal_error_zero": 2, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6753196159664212, + "wql": 0.7204585967467494 + } + }, + { + "config_id": "m4_quarterly__Q__short", + "leaderboard_key": "m4_quarterly/Q/short", + "dataset": "m4_quarterly", + "term": "short", + "freq": "Q-DEC", + "prediction_length": 8, + "seasonality": 4, + "n_variates": 1, + "n_instances": 23905, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 95, + "status": "ok", + "baseline": { + "mase": 1.5909093331240343, + "wql": 0.0995990835037221 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 23905, + "instances": 23905, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.259962856521928, + "wql": 0.08266963346128621, + "wsql_by_level": [ + 0.04848852161038842, + 0.07358676366452106, + 0.08900123959578611, + 0.09807547862763887, + 0.10178683065345603, + 0.10040268435809113, + 0.093977286933296, + 0.08082681133866045, + 0.05788108436973783 + ], + "n_valid_labels": 191240, + "n_masked_labels": 0, + "mae_median": 579.6037566447901, + "n_mase_elements": 191232, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7919765320929799, + "wql": 0.8300240379038908 + } + }, + { + "config_id": "m4_monthly__M__short", + "leaderboard_key": "m4_monthly/M/short", + "dataset": "m4_monthly", + "term": "short", + "freq": "M", + "prediction_length": 18, + "seasonality": 12, + "n_variates": 1, + "n_instances": 47501, + "domain": "Econ/Fin", + "n_cohorts": 3, + "dropped_containers": 499, + "status": "ok", + "baseline": { + "mase": 1.2366691185612824, + "wql": 0.11781121192744513 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 47501, + "instances": 47501, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.988564261982904, + "wql": 0.09223802710020251, + "wsql_by_level": [ + 0.05364962935874241, + 0.0818573272252259, + 0.0994997480990505, + 0.11000818379123849, + 0.11453215034534737, + 0.11298871513084648, + 0.1049538183919038, + 0.08940546453973397, + 0.0632472070197337 + ], + "n_valid_labels": 855018, + "n_masked_labels": 0, + "mae_median": 543.0756111173652, + "n_mase_elements": 855018, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7993765245249927, + "wql": 0.7829308059152125 + } + }, + { + "config_id": "m4_weekly__W__short", + "leaderboard_key": "m4_weekly/W/short", + "dataset": "m4_weekly", + "term": "short", + "freq": "W-SUN", + "prediction_length": 13, + "seasonality": 1, + "n_variates": 1, + "n_instances": 355, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 4, + "status": "ok", + "baseline": { + "mase": 2.895128591740639, + "wql": 0.06508715280630521 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 355, + "instances": 355, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.230306870405303, + "wql": 0.0498652289949664, + "wsql_by_level": [ + 0.02554952781724058, + 0.0402804140768341, + 0.05133611326215863, + 0.058372837637074404, + 0.062477608668266495, + 0.06375907584312981, + 0.06047395394999364, + 0.05125911049654252, + 0.035278419203457416 + ], + "n_valid_labels": 4615, + "n_masked_labels": 0, + "mae_median": 325.18698083747375, + "n_mase_elements": 4615, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.115773192120335, + "wql": 0.7661301323682388 + } + }, + { + "config_id": "m4_daily__D__short", + "leaderboard_key": "m4_daily/D/short", + "dataset": "m4_daily", + "term": "short", + "freq": "D", + "prediction_length": 14, + "seasonality": 1, + "n_variates": 1, + "n_instances": 4204, + "domain": "Econ/Fin", + "n_cohorts": 2, + "dropped_containers": 23, + "status": "ok", + "baseline": { + "mase": 3.2161164077095057, + "wql": 0.02310161661155265 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 4204, + "instances": 4204, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.2829450608042885, + "wql": 0.021965826873171352, + "wsql_by_level": [ + 0.013872956689683295, + 0.020074834919048722, + 0.02378088172321693, + 0.025823118861531748, + 0.026681734465554996, + 0.02646162214581857, + 0.024821776416652577, + 0.021161825739822514, + 0.01501369089721284 + ], + "n_valid_labels": 58856, + "n_masked_labels": 0, + "mae_median": 170.95649596726716, + "n_mase_elements": 58842, + "n_seasonal_error_zero": 1, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0207793016865263, + "wql": 0.9508350537765693 + } + }, + { + "config_id": "m4_hourly__H__short", + "leaderboard_key": "m4_hourly/H/short", + "dataset": "m4_hourly", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 414, + "domain": "Econ/Fin", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.22836124915778, + "wql": 0.034474947608819397 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 414, + "instances": 414, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.2842299173378704, + "wql": 0.03741240560692395, + "wsql_by_level": [ + 0.018895528891515214, + 0.03156120884009426, + 0.04023149362787627, + 0.04515607342202668, + 0.04751184966593015, + 0.04736786474828016, + 0.04403272556898336, + 0.0367958481136938, + 0.025159057583915647 + ], + "n_valid_labels": 19872, + "n_masked_labels": 0, + "mae_median": 357.90679174598796, + "n_mase_elements": 19872, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0454822782942692, + "wql": 1.0852055826577411 + } + }, + { + "config_id": "electricity__T__short", + "leaderboard_key": "electricity/15T/short", + "dataset": "electricity/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0916823579221513, + "wql": 0.06198863606457304 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9740671670413092, + "wql": 0.0480153092047249, + "wsql_by_level": [ + 0.03043318416955859, + 0.04634438833851187, + 0.056225240381056335, + 0.06124977060764387, + 0.062279146573383015, + 0.05888411418510382, + 0.05092921291043495, + 0.03951861918627234, + 0.026274106490559352 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 63.260204493273015, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8922624424336174, + "wql": 0.7745824437031936 + } + }, + { + "config_id": "electricity__T__medium", + "leaderboard_key": "electricity/15T/medium", + "dataset": "electricity/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5099936923797364, + "wql": 0.12054261982000446 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9567750281638162, + "wql": 0.08968614059591033, + "wsql_by_level": [ + 0.04174029900371922, + 0.06669443226862115, + 0.08487989678163489, + 0.0990397825662582, + 0.10945781624911267, + 0.11426623166135888, + 0.11232660599807393, + 0.10162631508658099, + 0.07714388574783307 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 78.7243871905626, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.633628493279298, + "wql": 0.744020170872598 + } + }, + { + "config_id": "electricity__T__long", + "leaderboard_key": "electricity/15T/long", + "dataset": "electricity/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0941077605435365, + "wql": 0.107564338522276 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8795474001499775, + "wql": 0.08607768135654768, + "wsql_by_level": [ + 0.04017425180329674, + 0.06445826678041845, + 0.08154564970175295, + 0.09384222886790874, + 0.1033128450870355, + 0.10801441675325536, + 0.10738158773465557, + 0.09862202571048524, + 0.07734785977012056 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 74.49336197613526, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8038946727816201, + "wql": 0.8002436731270509 + } + }, + { + "config_id": "electricity__H__short", + "leaderboard_key": "electricity/H/short", + "dataset": "electricity/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9861593153062442, + "wql": 0.06763119078713985 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0355827880800808, + "wql": 0.07525985281775573, + "wsql_by_level": [ + 0.04743525815605429, + 0.06846221219777972, + 0.08282219191761397, + 0.09077728213743134, + 0.09383351884543883, + 0.09232236393551821, + 0.0854428277333006, + 0.07103379739159325, + 0.045209223045071266 + ], + "n_valid_labels": 17712, + "n_masked_labels": 48, + "mae_median": 284.9752612346135, + "n_mase_elements": 17712, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0501171281422095, + "wql": 1.1127979848029894 + } + }, + { + "config_id": "electricity__H__medium", + "leaderboard_key": "electricity/H/medium", + "dataset": "electricity/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2478422873379948, + "wql": 0.12311153060577013 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.969107247962361, + "wql": 0.07846544645475942, + "wsql_by_level": [ + 0.04245773428697155, + 0.06416913170143425, + 0.07780389469129374, + 0.08701535432318927, + 0.09452848102417917, + 0.0975354924993394, + 0.09480408798134542, + 0.08476787130933841, + 0.06310697027574355 + ], + "n_valid_labels": 177120, + "n_masked_labels": 480, + "mae_median": 254.39183212454455, + "n_mase_elements": 177120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.776626387642099, + "wql": 0.637352537724698 + } + }, + { + "config_id": "electricity__H__long", + "leaderboard_key": "electricity/H/long", + "dataset": "electricity/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.356699671272273, + "wql": 0.14674885232557194 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1900645113758865, + "wql": 0.09190610059225464, + "wsql_by_level": [ + 0.04322225461152905, + 0.06898944237391355, + 0.08733189830947721, + 0.10034571850331248, + 0.10882435326648626, + 0.11278890635792796, + 0.11218331203470229, + 0.10581805034221656, + 0.08765096953072639 + ], + "n_valid_labels": 265680, + "n_masked_labels": 720, + "mae_median": 298.2654596747439, + "n_mase_elements": 265680, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8771760888390864, + "wql": 0.6262815629273538 + } + }, + { + "config_id": "electricity__D__short", + "leaderboard_key": "electricity/D/short", + "dataset": "electricity/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6456666278884469, + "wql": 0.09261378216375024 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4756723681893873, + "wql": 0.06690785549769457, + "wsql_by_level": [ + 0.028881768568078055, + 0.048640149892749986, + 0.06446476527270426, + 0.07558131800693724, + 0.08326745546109192, + 0.08593913999153883, + 0.0835098845534602, + 0.07499474240033627, + 0.05689147533235442 + ], + "n_valid_labels": 11070, + "n_masked_labels": 30, + "mae_median": 5477.260588082604, + "n_mase_elements": 11070, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 0.8967018855348735, + "wql": 0.7224395109941081 + } + }, + { + "config_id": "electricity__W__short", + "leaderboard_key": "electricity/W/short", + "dataset": "electricity/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 370, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.316880865245498, + "wql": 0.06523927951573125 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 370, + "instances": 370, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4376949683132059, + "wql": 0.06595998547907803, + "wsql_by_level": [ + 0.026727913520746965, + 0.047400912528145295, + 0.06694928983133605, + 0.07733054160406459, + 0.08440806917210256, + 0.08565995365068016, + 0.08078199401150679, + 0.07114628769619037, + 0.05323490729692939 + ], + "n_valid_labels": 2952, + "n_masked_labels": 8, + "mae_median": 36349.323766837595, + "n_mase_elements": 2952, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 1 + }, + "relative": { + "mase": 1.0917426217178616, + "wql": 1.0110471171462432 + } + }, + { + "config_id": "solar__T__short", + "leaderboard_key": "solar/10T/short", + "dataset": "solar/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.016018364778558773, + "wql": 12.118563297136966 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.018199829778994283, + "wql": 0.42891773281702794, + "wsql_by_level": [ + 0.18489396799094973, + 0.34931103024493143, + 0.4493207551865027, + 0.500474050313378, + 0.5256192011179047, + 0.5195454685272037, + 0.5090275174721609, + 0.4739478135118323, + 0.3481197909883883 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 0.05079546859521881, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.1361852492805937, + "wql": 0.03539344741619335 + } + }, + { + "config_id": "solar__T__medium", + "leaderboard_key": "solar/10T/medium", + "dataset": "solar/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8331425981399365, + "wql": 0.5650432034501303 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6711441872006577, + "wql": 0.27383892342927735, + "wsql_by_level": [ + 0.21881890928853337, + 0.3164411545629472, + 0.35079035207431253, + 0.3485810508323807, + 0.324757893453615, + 0.29325518611067386, + 0.25595554843299445, + 0.21027225585908843, + 0.1456779602489508 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 1.5517577612412858, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8055574024171199, + "wql": 0.48463360280634876 + } + }, + { + "config_id": "solar__T__long", + "leaderboard_key": "solar/10T/long", + "dataset": "solar/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.1421153816960863, + "wql": 0.9032285592107642 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7044384119574697, + "wql": 0.22334037419737107, + "wsql_by_level": [ + 0.1683165184681457, + 0.25824916454672964, + 0.2947499493642864, + 0.299144011543009, + 0.28132324134649167, + 0.24622584165063305, + 0.19768207696383236, + 0.1502116410015934, + 0.1141609228916184 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 1.6529775341609394, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.32885175932946653, + "wql": 0.2472689464032499 + } + }, + { + "config_id": "solar__H__short", + "leaderboard_key": "solar/H/short", + "dataset": "solar/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0569321595099215, + "wql": 0.602297355940449 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8696878898168143, + "wql": 0.33237113298133303, + "wsql_by_level": [ + 0.24626922131335702, + 0.3807587960860813, + 0.4346540586296976, + 0.43845361133387095, + 0.41177184350510226, + 0.3691529598824275, + 0.31047256074292673, + 0.2416852015700221, + 0.15812194376851202 + ], + "n_valid_labels": 6576, + "n_masked_labels": 0, + "mae_median": 11.357385665738565, + "n_mase_elements": 6576, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8228417330210402, + "wql": 0.5518389375333662 + } + }, + { + "config_id": "solar__H__medium", + "leaderboard_key": "solar/H/medium", + "dataset": "solar/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3782698364748944, + "wql": 0.9679824737641872 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1994386657842757, + "wql": 0.4489464884912274, + "wsql_by_level": [ + 0.47993796463016575, + 0.5789815480058882, + 0.5945334748401463, + 0.569834882088997, + 0.5225037959565622, + 0.45871575052715097, + 0.37923286594259276, + 0.2828737065188741, + 0.1739044079106697 + ], + "n_valid_labels": 65760, + "n_masked_labels": 0, + "mae_median": 15.657886591703583, + "n_mase_elements": 65760, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8702495215682853, + "wql": 0.46379609203605937 + } + }, + { + "config_id": "solar__H__long", + "leaderboard_key": "solar/H/long", + "dataset": "solar/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0723400769109404, + "wql": 0.9027882643891623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0400490206626296, + "wql": 0.3571653221427422, + "wsql_by_level": [ + 0.43122898290396733, + 0.4674079386536643, + 0.46472780344234715, + 0.44167797780435963, + 0.4054445310187596, + 0.35752957579291833, + 0.2967231540648518, + 0.22080436946550125, + 0.12894356613831065 + ], + "n_valid_labels": 98640, + "n_masked_labels": 0, + "mae_median": 13.667924185776902, + "n_mase_elements": 98640, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.969887298867603, + "wql": 0.39562468435985343 + } + }, + { + "config_id": "solar__D__short", + "leaderboard_key": "solar/D/short", + "dataset": "solar/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1670584568457976, + "wql": 0.4714212933677157 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1423757096618505, + "wql": 0.28748478880965783, + "wsql_by_level": [ + 0.2433118054913274, + 0.3467582240187444, + 0.38166603718620584, + 0.38215093041698067, + 0.3571615046091433, + 0.315201218144837, + 0.2585908018469241, + 0.1907472119643454, + 0.11177536560841213 + ], + "n_valid_labels": 4110, + "n_masked_labels": 0, + "mae_median": 288.9661689855757, + "n_mase_elements": 4110, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9788504619977161, + "wql": 0.6098256333648794 + } + }, + { + "config_id": "solar__W__short", + "leaderboard_key": "solar/W/short", + "dataset": "solar/W", + "term": "short", + "freq": "W-FRI", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 137, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0078578333938706, + "wql": 0.13890951079671932 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 137, + "instances": 137, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0230690508286733, + "wql": 0.1212170978466349, + "wsql_by_level": [ + 0.05865500803121881, + 0.11413092230559128, + 0.14500771101534485, + 0.1542089842973762, + 0.15301058333821754, + 0.14491192432895914, + 0.1312171096732136, + 0.1110820550780701, + 0.07872958255172276 + ], + "n_valid_labels": 1096, + "n_masked_labels": 0, + "mae_median": 939.5978346775918, + "n_mase_elements": 1096, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0150926221246703, + "wql": 0.8726335378433838 + } + }, + { + "config_id": "hospital__M__short", + "leaderboard_key": "hospital/M/short", + "dataset": "hospital", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 767, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9326829101839614, + "wql": 0.0633931064425068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 767, + "instances": 767, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7940631195865495, + "wql": 0.05582677481106199, + "wsql_by_level": [ + 0.03087298754392222, + 0.04695620597456365, + 0.05752130968927458, + 0.06550521489688386, + 0.06970950665094526, + 0.06980556823482545, + 0.06552672162862581, + 0.056334269580708723, + 0.04020918909980844 + ], + "n_valid_labels": 9204, + "n_masked_labels": 0, + "mae_median": 19.35423407115298, + "n_mase_elements": 9204, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8513752218639122, + "wql": 0.8806442520953449 + } + }, + { + "config_id": "covid_deaths__D__short", + "leaderboard_key": "covid_deaths/D/short", + "dataset": "covid_deaths", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 266, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 50.55549046119792, + "wql": 0.12549070850235644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 266, + "instances": 266, + "fraction": 1.0 + }, + "metrics": { + "mase": 43.619616184352246, + "wql": 0.07364468041410649, + "wsql_by_level": [ + 0.06298540070505483, + 0.09163684118879453, + 0.10715379223539133, + 0.10359241725314157, + 0.08997559427851616, + 0.05823655187519927, + 0.03985982027947779, + 0.05110411401584741, + 0.05825759189553551 + ], + "n_valid_labels": 7980, + "n_masked_labels": 0, + "mae_median": 182.79058378961003, + "n_mase_elements": 6810, + "n_seasonal_error_zero": 39, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8628067057885818, + "wql": 0.5868536507045349 + } + }, + { + "config_id": "us_births__D__short", + "leaderboard_key": "us_births/D/short", + "dataset": "us_births/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.328105874599355, + "wql": 0.13056664093780335 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.45622264028997533, + "wql": 0.024482242452389065, + "wsql_by_level": [ + 0.010328608945230227, + 0.015723699389836455, + 0.020652966000026203, + 0.02361631355290268, + 0.0296075297844733, + 0.03388701784099879, + 0.03520691377601241, + 0.030845007116254534, + 0.020472125665766967 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 301.2931315104167, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.19596301236449865, + "wql": 0.1875076380654643 + } + }, + { + "config_id": "us_births__M__short", + "leaderboard_key": "us_births/M/short", + "dataset": "us_births/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.3023112362005141, + "wql": 0.011101802850788281 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.27044780914458144, + "wql": 0.0075860913243754585, + "wsql_by_level": [ + 0.005389060763757084, + 0.005850367151087013, + 0.0058451974110685255, + 0.007635563325134309, + 0.008080846172958928, + 0.00817411219835662, + 0.009665782944184862, + 0.009899517906811418, + 0.007734374046020373 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 2536.7890625, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8946005862818854, + "wql": 0.6833206665921662 + } + }, + { + "config_id": "us_births__W__short", + "leaderboard_key": "us_births/W/short", + "dataset": "us_births/W", + "term": "short", + "freq": "W-TUE", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Healthcare", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.858436986096576, + "wql": 0.04221704717157443 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4853326901754125, + "wql": 0.016455395565286503, + "wsql_by_level": [ + 0.006451515590054493, + 0.01551332665684237, + 0.020181177357453835, + 0.021673192978594342, + 0.02172843891094782, + 0.020615691000011763, + 0.018443881558938238, + 0.014980952466969009, + 0.008510383567766662 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 1616.38671875, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3849570941621268, + "wql": 0.3897808271244097 + } + }, + { + "config_id": "saugeenday__D__short", + "leaderboard_key": "saugeen/D/short", + "dataset": "saugeenday/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.898466092444523, + "wql": 0.5418638069109889 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.1241553951598195, + "wql": 0.314461857758526, + "wsql_by_level": [ + 0.1464271899200915, + 0.2547131323681452, + 0.3410136683436466, + 0.4079116722489819, + 0.44213513949915473, + 0.42589423730009135, + 0.3544751716976757, + 0.22749028636413376, + 0.23009622208481328 + ], + "n_valid_labels": 30, + "n_masked_labels": 0, + "mae_median": 13.735665098826091, + "n_mase_elements": 30, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8013806766755347, + "wql": 0.5803337549912835 + } + }, + { + "config_id": "saugeenday__M__short", + "leaderboard_key": "saugeen/M/short", + "dataset": "saugeenday/M", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.33228103391864, + "wql": 0.2615013833629034 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4265226589769706, + "wql": 0.22454826783099366, + "wsql_by_level": [ + 0.12297502644337333, + 0.20446393042771416, + 0.2469467780094047, + 0.257985843545447, + 0.2542377147597786, + 0.23937239987591719, + 0.2490333993918837, + 0.25510408418405606, + 0.1908152338413682 + ], + "n_valid_labels": 12, + "n_masked_labels": 0, + "mae_median": 7.393807093302409, + "n_mase_elements": 12, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2836202353981057, + "wql": 0.8586886422676113 + } + }, + { + "config_id": "saugeenday__W__short", + "leaderboard_key": "saugeen/W/short", + "dataset": "saugeenday/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.5685710422753978, + "wql": 0.5994091721735982 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6924476423174394, + "wql": 0.22751689096409183, + "wsql_by_level": [ + 0.10622398402608459, + 0.16559155054464766, + 0.2389762956989773, + 0.3035157787600391, + 0.33937532330188147, + 0.33754460329561503, + 0.2621097041773069, + 0.13269052201719478, + 0.16162425685507964 + ], + "n_valid_labels": 8, + "n_masked_labels": 0, + "mae_median": 8.298938632011414, + "n_mase_elements": 8, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2178735651859662, + "wql": 0.3795685844096483 + } + }, + { + "config_id": "temperature_rain_with_missing__D__short", + "leaderboard_key": "temperature_rain/D/short", + "dataset": "temperature_rain_with_missing", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 32072, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.2912255413171745, + "wql": 1.099183165150044 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 32072, + "instances": 32072, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.1079464560556977, + "wql": 0.5238587037661242, + "wsql_by_level": [ + 0.1770107091656451, + 0.3331105156093134, + 0.46814517239813613, + 0.5779582280297731, + 0.6574660910989982, + 0.7029590050927433, + 0.7024252954224887, + 0.6345496065972202, + 0.4611037104807999 + ], + "n_valid_labels": 961756, + "n_masked_labels": 404, + "mae_median": 6.6055370950018215, + "n_mase_elements": 960736, + "n_seasonal_error_zero": 34, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6404746285519165, + "wql": 0.4765890894031431 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__short", + "leaderboard_key": "kdd_cup_2018/H/short", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.6811227593500775, + "wql": 0.6266148384878599 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5385210417286712, + "wql": 0.38318627908473535, + "wsql_by_level": [ + 0.14859754076948958, + 0.2571480599390896, + 0.3511661200143019, + 0.428257165652696, + 0.48184252838876723, + 0.5029950888764306, + 0.49490513564870203, + 0.4512328576983499, + 0.33253201477479066 + ], + "n_valid_labels": 11685, + "n_masked_labels": 1275, + "mae_median": 12.384548824472105, + "n_mase_elements": 11685, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.790637274024618, + "wql": 0.6115180419433353 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__medium", + "leaderboard_key": "kdd_cup_2018/H/medium", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2781450805103305, + "wql": 1.049898934007083 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9243796119719839, + "wql": 0.4586571954988542, + "wsql_by_level": [ + 0.17813870654273375, + 0.32775906564227025, + 0.4485463365173416, + 0.5391301901381726, + 0.5960277665038458, + 0.6108163518257288, + 0.5797475325694479, + 0.49743915496305713, + 0.3503096547870901 + ], + "n_valid_labels": 116458, + "n_masked_labels": 13142, + "mae_median": 19.97666710344774, + "n_mase_elements": 116458, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7232196298114318, + "wql": 0.43685842574230094 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__H__long", + "leaderboard_key": "kdd_cup_2018/H/long", + "dataset": "kdd_cup_2018_with_missing/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 0.981050679806651, + "wql": 1.2362237298155803 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8716494751402017, + "wql": 0.4751284458174234, + "wsql_by_level": [ + 0.1848934239503441, + 0.3337696836429818, + 0.45566511585971137, + 0.5485447229226587, + 0.6093798024700382, + 0.6330944229168565, + 0.6146227493165287, + 0.536233708458402, + 0.3599523828192895 + ], + "n_valid_labels": 175906, + "n_masked_labels": 18494, + "mae_median": 18.584961563494304, + "n_mase_elements": 175906, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8884856746768572, + "wql": 0.38433855810897843 + } + }, + { + "config_id": "kdd_cup_2018_with_missing__D__short", + "leaderboard_key": "kdd_cup_2018/D/short", + "dataset": "kdd_cup_2018_with_missing/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 270, + "domain": "Nature", + "n_cohorts": 2, + "status": "ok", + "baseline": { + "mase": 1.2132840958596942, + "wql": 0.8994855622016019 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 270, + "instances": 270, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0150473354705567, + "wql": 0.39124051004615346, + "wsql_by_level": [ + 0.1654410233536927, + 0.29041231883530344, + 0.38169621689870054, + 0.4468904003603233, + 0.48756718251341086, + 0.5042851322007338, + 0.4941103498588946, + 0.44169760006835873, + 0.30906436632596335 + ], + "n_valid_labels": 7581, + "n_masked_labels": 519, + "mae_median": 15.132368607247288, + "n_mase_elements": 7581, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8366114242611304, + "wql": 0.4349603000725704 + } + }, + { + "config_id": "car_parts_with_missing__M__short", + "leaderboard_key": "car_parts/M/short", + "dataset": "car_parts_with_missing", + "term": "short", + "freq": "M", + "prediction_length": 12, + "seasonality": 12, + "n_variates": 1, + "n_instances": 2674, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.556811831303017, + "wql": 1.6139130745452677 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 2674, + "instances": 2674, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4185302646596178, + "wql": 1.1244101999088318, + "wsql_by_level": [ + 0.27971761424682506, + 0.5467973917218049, + 0.8170341323288485, + 1.0839988701924081, + 1.3191033427887835, + 1.511081136458883, + 1.6284917774810117, + 1.6018162034076795, + 1.3316513305532431 + ], + "n_valid_labels": 30108, + "n_masked_labels": 1980, + "mae_median": 0.6241950752196027, + "n_mase_elements": 28068, + "n_seasonal_error_zero": 215, + "n_seasonal_error_nan": 7 + }, + "relative": { + "mase": 0.9111764415821143, + "wql": 0.6966981169203571 + } + }, + { + "config_id": "restaurant__D__short", + "leaderboard_key": "restaurant/D/short", + "dataset": "restaurant", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 806, + "domain": "Sales", + "n_cohorts": 13, + "skipped_series": 1, + "status": "ok", + "baseline": { + "mase": 1.0028179898604987, + "wql": 0.6760963195065456 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 806, + "instances": 806, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6945802010011527, + "wql": 0.26213632327995307, + "wsql_by_level": [ + 0.13169721477745955, + 0.2150148867904739, + 0.2741549634658024, + 0.3132306545137657, + 0.33342217116278955, + 0.3338177215062785, + 0.311877730305093, + 0.2646661617566459, + 0.1813454052412689 + ], + "n_valid_labels": 21222, + "n_masked_labels": 2958, + "mae_median": 7.131356949367394, + "n_mase_elements": 21222, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6926283812457086, + "wql": 0.387720382017869 + } + }, + { + "config_id": "hierarchical_sales__D__short", + "leaderboard_key": "hierarchical_sales/D/short", + "dataset": "hierarchical_sales/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0956340453936162, + "wql": 1.4587792906606432 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9568859546034584, + "wql": 0.6322085912378053, + "wsql_by_level": [ + 0.19791027228709143, + 0.37118498396338007, + 0.5229645311719724, + 0.654722669602655, + 0.7610711671663276, + 0.8369523879151254, + 0.8715817573612059, + 0.8311050327653878, + 0.6423845189071009 + ], + "n_valid_labels": 3304, + "n_masked_labels": 236, + "mae_median": 2.984624428866255, + "n_mase_elements": 3304, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8733627424471724, + "wql": 0.43338193466641173 + } + }, + { + "config_id": "hierarchical_sales__W__short", + "leaderboard_key": "hierarchical_sales/W/short", + "dataset": "hierarchical_sales/W", + "term": "short", + "freq": "W-WED", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 1, + "n_instances": 118, + "domain": "Sales", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9952062817493519, + "wql": 0.7382990422957836 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 118, + "instances": 118, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.823753990777682, + "wql": 0.4092936144468439, + "wsql_by_level": [ + 0.15224158039294716, + 0.2716194304856199, + 0.36272474009871736, + 0.433088215983095, + 0.4875400933888367, + 0.5249362021216601, + 0.5382756071690624, + 0.512123735820911, + 0.40109292456074547 + ], + "n_valid_labels": 944, + "n_masked_labels": 0, + "mae_median": 11.90444825488632, + "n_mase_elements": 944, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8277218561459492, + "wql": 0.5543737577853572 + } + }, + { + "config_id": "LOOP_SEATTLE__T__short", + "leaderboard_key": "loop_seattle/5T/short", + "dataset": "LOOP_SEATTLE/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6088421384511257, + "wql": 0.05736115508602545 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3952898701705953, + "wql": 0.028723544957939932, + "wsql_by_level": [ + 0.019529757893431116, + 0.027394631509447553, + 0.03222599665680956, + 0.034907422781096514, + 0.035933749572980525, + 0.035028247648647155, + 0.031832535757142684, + 0.025797937269634946, + 0.015861625532269333 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 2.3306111099796274, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.649248541134488, + "wql": 0.5007490681605482 + } + }, + { + "config_id": "LOOP_SEATTLE__T__medium", + "leaderboard_key": "loop_seattle/5T/medium", + "dataset": "LOOP_SEATTLE/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5924843577520822, + "wql": 0.14109820582939464 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6124257865650427, + "wql": 0.05101569882924481, + "wsql_by_level": [ + 0.0406767929468326, + 0.054101328307947574, + 0.060915983712435375, + 0.06350186776257577, + 0.06279834962901416, + 0.05886086640471062, + 0.05171483763827766, + 0.0409793238540245, + 0.02559193920738509 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.815243762205629, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38457256021624614, + "wql": 0.36156164091079346 + } + }, + { + "config_id": "LOOP_SEATTLE__T__long", + "leaderboard_key": "loop_seattle/5T/long", + "dataset": "LOOP_SEATTLE/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5910237866124803, + "wql": 0.14753926773607257 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6783221336209623, + "wql": 0.05770762029448021, + "wsql_by_level": [ + 0.045417027010268084, + 0.06174742327618872, + 0.06965667374659534, + 0.07245789410995851, + 0.07113144577520258, + 0.0663038499317708, + 0.05802238841427871, + 0.04587649131981347, + 0.0287553890662458 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 4.184454003547449, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.42634317558834756, + "wql": 0.3911339752459067 + } + }, + { + "config_id": "LOOP_SEATTLE__H__short", + "leaderboard_key": "loop_seattle/H/short", + "dataset": "LOOP_SEATTLE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.0101473993616685, + "wql": 0.13665681786039896 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.676196082660409, + "wql": 0.043389725980982695, + "wsql_by_level": [ + 0.03469753365332969, + 0.04632418713564002, + 0.051537053076255085, + 0.0534702436432689, + 0.052794278551931854, + 0.05011241748101232, + 0.044560162479593254, + 0.035258871504410136, + 0.02175278630340301 + ], + "n_valid_labels": 15504, + "n_masked_labels": 0, + "mae_median": 3.1978558414799263, + "n_mase_elements": 15504, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.33639129293460673, + "wql": 0.31750868094489976 + } + }, + { + "config_id": "LOOP_SEATTLE__H__medium", + "leaderboard_key": "loop_seattle/H/medium", + "dataset": "LOOP_SEATTLE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1535310881157237, + "wql": 0.14911283164622935 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7162311876942064, + "wql": 0.050712998995196434, + "wsql_by_level": [ + 0.042468919361204366, + 0.05598703221267306, + 0.06154678119063926, + 0.06262528509824712, + 0.060752557384215915, + 0.05636502232098626, + 0.04972277569917441, + 0.040384506431945445, + 0.026564111257682106 + ], + "n_valid_labels": 155040, + "n_masked_labels": 0, + "mae_median": 3.3894341651646283, + "n_mase_elements": 155040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6209032379562128, + "wql": 0.3400981554391857 + } + }, + { + "config_id": "LOOP_SEATTLE__H__long", + "leaderboard_key": "loop_seattle/H/long", + "dataset": "LOOP_SEATTLE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2448539713840052, + "wql": 0.17526380961630228 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7196723597121933, + "wql": 0.050662986866567644, + "wsql_by_level": [ + 0.04237977114843666, + 0.055233652265532764, + 0.060557531869901204, + 0.06175871482462763, + 0.060216853791031276, + 0.056347851267805726, + 0.05024036921587203, + 0.04135398801034828, + 0.027878149405553148 + ], + "n_valid_labels": 232560, + "n_masked_labels": 0, + "mae_median": 3.379780891737066, + "n_mase_elements": 232560, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.578117896761879, + "wql": 0.28906701832786813 + } + }, + { + "config_id": "LOOP_SEATTLE__D__short", + "leaderboard_key": "loop_seattle/D/short", + "dataset": "LOOP_SEATTLE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 323, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1854124643746355, + "wql": 0.09281728785965133 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 323, + "instances": 323, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6022298750138277, + "wql": 0.027895112416676235, + "wsql_by_level": [ + 0.020400823176962783, + 0.028969744739730817, + 0.0333117890314601, + 0.03500304048142266, + 0.034596384136024935, + 0.032329024749899495, + 0.02846003345124984, + 0.02294820167754015, + 0.015036970305795325 + ], + "n_valid_labels": 9690, + "n_masked_labels": 0, + "mae_median": 1.9417852419448711, + "n_mase_elements": 9690, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5080340329739439, + "wql": 0.3005378961175458 + } + }, + { + "config_id": "SZ_TAXI__T__short", + "leaderboard_key": "sz_taxi/15T/short", + "dataset": "SZ_TAXI/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7251090475210906, + "wql": 0.3023498132057821 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5173985992033879, + "wql": 0.19552652170393103, + "wsql_by_level": [ + 0.10182332529202912, + 0.16577689229146184, + 0.2088461897265203, + 0.2359904652780309, + 0.24842091455431606, + 0.24602437890749868, + 0.22872112336750514, + 0.1927028409049342, + 0.13143256501308298 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 2.7804363867732937, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7135459155725661, + "wql": 0.6466897387194808 + } + }, + { + "config_id": "SZ_TAXI__T__medium", + "leaderboard_key": "sz_taxi/15T/medium", + "dataset": "SZ_TAXI/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6350051480164337, + "wql": 0.3916041859838231 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46653893337494046, + "wql": 0.1947473304840706, + "wsql_by_level": [ + 0.1011772963444461, + 0.16037443518572939, + 0.2008324413424897, + 0.22722179159132963, + 0.24102345291590552, + 0.24201108498086898, + 0.229858988109962, + 0.20209515061364944, + 0.1481313332722546 + ], + "n_valid_labels": 74880, + "n_masked_labels": 0, + "mae_median": 2.667472180733375, + "n_mase_elements": 74880, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7347010253889573, + "wql": 0.4973065596702163 + } + }, + { + "config_id": "SZ_TAXI__T__long", + "leaderboard_key": "sz_taxi/15T/long", + "dataset": "SZ_TAXI/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6084219160390921, + "wql": 0.45522272202116565 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4864794451423971, + "wql": 0.21814599731739187, + "wsql_by_level": [ + 0.11580177745142659, + 0.17973628026006186, + 0.2202136372041763, + 0.245281518473127, + 0.25832097381044444, + 0.26287349770119894, + 0.2585335699382811, + 0.2389484531463499, + 0.1836042678714607 + ], + "n_valid_labels": 112320, + "n_masked_labels": 0, + "mae_median": 2.868840496000874, + "n_mase_elements": 112320, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7995758080337461, + "wql": 0.479207180935158 + } + }, + { + "config_id": "SZ_TAXI__H__short", + "leaderboard_key": "sz_taxi/H/short", + "dataset": "SZ_TAXI/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 156, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.6087142479652129, + "wql": 0.20653078520030457 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 156, + "instances": 156, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.4788383595311784, + "wql": 0.12990847696156274, + "wsql_by_level": [ + 0.0693350450046388, + 0.10820191744069667, + 0.13443580960182744, + 0.15102113653944568, + 0.1588888577606774, + 0.1585727686246662, + 0.15024442340060146, + 0.1346211136941753, + 0.10385522058733583 + ], + "n_valid_labels": 7488, + "n_masked_labels": 0, + "mae_median": 1.7565392549614856, + "n_mase_elements": 7488, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7866389872289359, + "wql": 0.6290029684222165 + } + }, + { + "config_id": "M_DENSE__H__short", + "leaderboard_key": "m_dense/H/short", + "dataset": "M_DENSE/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8744657675879529, + "wql": 0.18983266370122717 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7029923603350416, + "wql": 0.12686954816991064, + "wsql_by_level": [ + 0.09292660404223954, + 0.12584309398659704, + 0.14370436434612496, + 0.15344383095983477, + 0.1554863001757256, + 0.1488317128976077, + 0.13516505502795334, + 0.11193113569615228, + 0.07449383639696072 + ], + "n_valid_labels": 1440, + "n_masked_labels": 0, + "mae_median": 97.9342344601949, + "n_mase_elements": 1440, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8039106691095662, + "wql": 0.6683230677813562 + } + }, + { + "config_id": "M_DENSE__H__medium", + "leaderboard_key": "m_dense/H/medium", + "dataset": "M_DENSE/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.171624112893389, + "wql": 0.3497462745339787 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.789740940074338, + "wql": 0.13991455396953037, + "wsql_by_level": [ + 0.08338143611101692, + 0.12181510636299231, + 0.1444581599756719, + 0.15897588165644108, + 0.16831739307790594, + 0.17060589092265416, + 0.16333518609729264, + 0.1435459690838079, + 0.10479596243799062 + ], + "n_valid_labels": 14400, + "n_masked_labels": 0, + "mae_median": 98.7956645568212, + "n_mase_elements": 14400, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6740565778592846, + "wql": 0.4000458737007571 + } + }, + { + "config_id": "M_DENSE__H__long", + "leaderboard_key": "m_dense/H/long", + "dataset": "M_DENSE/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0805183298420056, + "wql": 0.3841191250034235 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0883728093899687, + "wql": 0.18118844091441824, + "wsql_by_level": [ + 0.08920475378318142, + 0.14225397582474333, + 0.18049939119607997, + 0.2081514118858792, + 0.22730762825599993, + 0.23388445675952413, + 0.22501130735349492, + 0.19296790496158012, + 0.13141513820928097 + ], + "n_valid_labels": 21600, + "n_masked_labels": 0, + "mae_median": 133.21716985172696, + "n_mase_elements": 21600, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0072691775151206, + "wql": 0.47169856724213716 + } + }, + { + "config_id": "M_DENSE__D__short", + "leaderboard_key": "m_dense/D/short", + "dataset": "M_DENSE/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 1, + "n_instances": 30, + "domain": "Transport", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.007688577826318, + "wql": 0.1992117768924222 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 30, + "instances": 30, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0078601228388522, + "wql": 0.09237271803385658, + "wsql_by_level": [ + 0.062014753871224154, + 0.0920953027396964, + 0.11106855752482792, + 0.12069023417153978, + 0.12221528821479481, + 0.11288287543086636, + 0.0963571059800797, + 0.07028748986316993, + 0.04374285450851014 + ], + "n_valid_labels": 900, + "n_masked_labels": 0, + "mae_median": 71.62616996341282, + "n_mase_elements": 900, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0001702361387326, + "wql": 0.46369105017189544 + } + }, + { + "config_id": "ett1__T__short", + "leaderboard_key": "ett1/15T/short", + "dataset": "ett1/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2054822899524387, + "wql": 0.48104386522982623 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7792670725012937, + "wql": 0.2771256401263645, + "wsql_by_level": [ + 0.1622870132655, + 0.2594302912958132, + 0.31297369780926576, + 0.34422889751595664, + 0.3555063768554017, + 0.35369384845368756, + 0.32193425652282875, + 0.24869586718111647, + 0.13538051223771058 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.2992996251365792, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.646435936053477, + "wql": 0.576092244714447 + } + }, + { + "config_id": "ett1__T__medium", + "leaderboard_key": "ett1/15T/medium", + "dataset": "ett1/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7745679584044315, + "wql": 0.4386794376669185 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9690611278203007, + "wql": 0.37382782066137804, + "wsql_by_level": [ + 0.1780821562462553, + 0.3212749220780595, + 0.4369606659849464, + 0.4965946181623379, + 0.5077102368975966, + 0.48140372349240124, + 0.41913287994419535, + 0.32477039328322854, + 0.1985207898633813 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.6555977510532276, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.2510989091473843, + "wql": 0.8521662712288303 + } + }, + { + "config_id": "ett1__T__long", + "leaderboard_key": "ett1/15T/long", + "dataset": "ett1/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.327073089604087, + "wql": 0.5796800252115644 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.318040612432724, + "wql": 0.48423844913140535, + "wsql_by_level": [ + 0.30903680240358644, + 0.4719940191754897, + 0.5896014079219133, + 0.643093174016933, + 0.6398947643934825, + 0.5897234021384264, + 0.5024628318624462, + 0.38344447059383785, + 0.22889516967653184 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.1937819459712102, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9931936852294566, + "wql": 0.8353547268679373 + } + }, + { + "config_id": "ett1__H__short", + "leaderboard_key": "ett1/H/short", + "dataset": "ett1/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0441605493380515, + "wql": 0.5044116168241106 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7667972303814656, + "wql": 0.3416215190296967, + "wsql_by_level": [ + 0.20445952541076456, + 0.3041701331233287, + 0.3639243279657139, + 0.41814264578344223, + 0.4413933515473588, + 0.4390226141205447, + 0.40210137385921807, + 0.3207950432881793, + 0.18058465616871955 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.334196607449225, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7343671726226191, + "wql": 0.6772673499881364 + } + }, + { + "config_id": "ett1__H__medium", + "leaderboard_key": "ett1/H/medium", + "dataset": "ett1/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2235872159229322, + "wql": 0.5499353323396741 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4100528982992926, + "wql": 0.4315848684200791, + "wsql_by_level": [ + 0.29557499310090113, + 0.4615250209419889, + 0.533735556941607, + 0.555588417417536, + 0.5433363289710713, + 0.5017789649941564, + 0.43452515720415064, + 0.3431009395790043, + 0.21509843663029632 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 8.314164360854331, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.152392636952906, + "wql": 0.7847920346996464 + } + }, + { + "config_id": "ett1__H__long", + "leaderboard_key": "ett1/H/long", + "dataset": "ett1/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4320631719624162, + "wql": 0.5783242328839591 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4513775334578436, + "wql": 0.4170863303923378, + "wsql_by_level": [ + 0.3006866448381515, + 0.4590885347847776, + 0.5388458974306606, + 0.5586332411190716, + 0.5364769029506072, + 0.481463751169066, + 0.3999567405231289, + 0.2986764832645038, + 0.17994877745107302 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 9.03301777251449, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0134870876324262, + "wql": 0.7211980869493088 + } + }, + { + "config_id": "ett1__D__short", + "leaderboard_key": "ett1/D/short", + "dataset": "ett1/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8181967261759215, + "wql": 0.48528320354978605 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.746562283477312, + "wql": 0.33806480885952167, + "wsql_by_level": [ + 0.17049164881847834, + 0.3000446187975746, + 0.3947578375141409, + 0.4489323873667105, + 0.4545266136834692, + 0.4252420132456831, + 0.363330909270671, + 0.290245433789625, + 0.19501181724934263 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 144.27778090068273, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9606013795606854, + "wql": 0.6966340610732451 + } + }, + { + "config_id": "ett1__W__short", + "leaderboard_key": "ett1/W/short", + "dataset": "ett1/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.2444126904903803, + "wql": 0.25814356436755426 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0099837453413099, + "wql": 0.19347235636366605, + "wsql_by_level": [ + 0.1326600774260313, + 0.1827589616523599, + 0.21861932616335902, + 0.22611918465900263, + 0.21669437834724123, + 0.21339247371962075, + 0.21590241249673928, + 0.19229527736447077, + 0.14280911544416963 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 540.8124885559082, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8116147907036451, + "wql": 0.7494758075324048 + } + }, + { + "config_id": "ett2__T__short", + "leaderboard_key": "ett2/15T/short", + "dataset": "ett2/15T", + "term": "short", + "freq": "15T", + "prediction_length": 48, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7618250880337474, + "wql": 0.093929612604377 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0755823285978838, + "wql": 0.13027784672641138, + "wsql_by_level": [ + 0.06639711920983479, + 0.10682391696591424, + 0.13586049246501852, + 0.1553619853474353, + 0.16660105979278905, + 0.16758370501703235, + 0.15707269556771356, + 0.13210247161035116, + 0.0846971745616134 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 2.6584317850924672, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.4118494461424689, + "wql": 1.3869731079923626 + } + }, + { + "config_id": "ett2__T__medium", + "leaderboard_key": "ett2/15T/medium", + "dataset": "ett2/15T", + "term": "medium", + "freq": "15T", + "prediction_length": 480, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9027189688220486, + "wql": 0.13649095157039726 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8115506713617351, + "wql": 0.09798651242969872, + "wsql_by_level": [ + 0.06544394485587729, + 0.09914577493360122, + 0.11790251405971768, + 0.12551895376080557, + 0.12431662942943597, + 0.11594925663577339, + 0.10107275154338213, + 0.07975170289571022, + 0.05277708375298499 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 1.8918874638110754, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8990069992887395, + "wql": 0.7178974965176406 + } + }, + { + "config_id": "ett2__T__long", + "leaderboard_key": "ett2/15T/long", + "dataset": "ett2/15T", + "term": "long", + "freq": "15T", + "prediction_length": 720, + "seasonality": 96, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0565955316162643, + "wql": 0.16755935574924186 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9990940788629532, + "wql": 0.12568556522566846, + "wsql_by_level": [ + 0.08685013817238525, + 0.12813896371699016, + 0.15290804691166054, + 0.16458397400327182, + 0.1626934861784697, + 0.14956730318541184, + 0.12600959677510307, + 0.0961670059301924, + 0.06425157215753108 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 2.4537414943573936, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9455785577047144, + "wql": 0.7500957774853293 + } + }, + { + "config_id": "ett2__H__short", + "leaderboard_key": "ett2/H/short", + "dataset": "ett2/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9915624508458626, + "wql": 0.11931409133707109 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6812847001044282, + "wql": 0.07440808360377531, + "wsql_by_level": [ + 0.05171239388782455, + 0.07700397802451021, + 0.09058877285625234, + 0.09545950651419811, + 0.09250538856135564, + 0.08351762495242594, + 0.07103380977003679, + 0.06140657395410014, + 0.046444703913273995 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 5.671704429955709, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6870819881523864, + "wql": 0.6236319848723232 + } + }, + { + "config_id": "ett2__H__medium", + "leaderboard_key": "ett2/H/medium", + "dataset": "ett2/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 2.649073318865916, + "wql": 0.345818716053239 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 2.6273647707242653, + "wql": 0.25440696854501194, + "wsql_by_level": [ + 0.10436673708903506, + 0.18133816976213887, + 0.25172583876939963, + 0.3101674678296093, + 0.34765938890312953, + 0.35581239034615436, + 0.32661089791310594, + 0.25964333169948267, + 0.15233849459305207 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 19.773542396679876, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9918052294034111, + "wql": 0.7356657021011143 + } + }, + { + "config_id": "ett2__H__long", + "leaderboard_key": "ett2/H/long", + "dataset": "ett2/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 3.171779953228176, + "wql": 0.3702966971424018 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 3.192794893134073, + "wql": 0.3524108095799723, + "wsql_by_level": [ + 0.27381221565663877, + 0.3809635741778294, + 0.4333194156938304, + 0.4532398670535666, + 0.44666962296023127, + 0.41314444565953645, + 0.3539340097095855, + 0.2675436817122181, + 0.1490704535963138 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 25.204126850010027, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0066255983125527, + "wql": 0.9516984955565204 + } + }, + { + "config_id": "ett2__D__short", + "leaderboard_key": "ett2/D/short", + "dataset": "ett2/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 4.704440132303346, + "wql": 0.31867490583739955 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 4.724247965370452, + "wql": 0.3279217205158214, + "wsql_by_level": [ + 0.29346433672373073, + 0.3946950663911099, + 0.4291619695699159, + 0.43063314073523823, + 0.4063888337403443, + 0.3598222512121351, + 0.2960744746210319, + 0.21874186213330016, + 0.12231354951558636 + ], + "n_valid_labels": 210, + "n_masked_labels": 0, + "mae_median": 549.538259111132, + "n_mase_elements": 210, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 1.0042104549128161, + "wql": 1.0290164506493649 + } + }, + { + "config_id": "ett2__W__short", + "leaderboard_key": "ett2/W/short", + "dataset": "ett2/W", + "term": "short", + "freq": "W-THU", + "prediction_length": 8, + "seasonality": 1, + "n_variates": 7, + "n_instances": 1, + "domain": "Energy", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.7680609986327813, + "wql": 0.21133928538207686 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.6361797159398732, + "wql": 0.173363077120703, + "wsql_by_level": [ + 0.09896348951784022, + 0.1734833633051303, + 0.20832083344517113, + 0.22471091973735283, + 0.22417987244018792, + 0.20962171751596662, + 0.17675304696424304, + 0.1426707831176564, + 0.10156366804277871 + ], + "n_valid_labels": 56, + "n_masked_labels": 0, + "mae_median": 2181.8339796066284, + "n_mase_elements": 56, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9254090878115121, + "wql": 0.820306914577111 + } + }, + { + "config_id": "jena_weather__T__short", + "leaderboard_key": "jena_weather/10T/short", + "dataset": "jena_weather/10T", + "term": "short", + "freq": "10T", + "prediction_length": 48, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7621672521709891, + "wql": 0.1366740261223883 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.41801859389044044, + "wql": 0.018495271902973745, + "wsql_by_level": [ + 0.007495112597820055, + 0.012639601576801685, + 0.016150710037686856, + 0.018958848514974813, + 0.021502437366320067, + 0.023086781697763608, + 0.024097855562295354, + 0.023444849919862395, + 0.019081249853238884 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 3.3884485804490625, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.5484604497237827, + "wql": 0.13532397067465968 + } + }, + { + "config_id": "jena_weather__T__medium", + "leaderboard_key": "jena_weather/10T/medium", + "dataset": "jena_weather/10T", + "term": "medium", + "freq": "10T", + "prediction_length": 480, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9778443284819783, + "wql": 0.22790411536869984 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8205652967133099, + "wql": 0.08354456853151657, + "wsql_by_level": [ + 0.0271360623600238, + 0.054994341318548176, + 0.07681042560793847, + 0.09182367804466392, + 0.10157360792888484, + 0.10673325850069341, + 0.10638940101941154, + 0.10041822512678793, + 0.08602211687669704 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 17.177617378764978, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8391573922478734, + "wql": 0.3665777092105574 + } + }, + { + "config_id": "jena_weather__T__long", + "leaderboard_key": "jena_weather/10T/long", + "dataset": "jena_weather/10T", + "term": "long", + "freq": "10T", + "prediction_length": 720, + "seasonality": 144, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9055523182794231, + "wql": 0.2428907683297211 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7027347559716686, + "wql": 0.07791974859560245, + "wsql_by_level": [ + 0.030916145335751353, + 0.05676175795925001, + 0.07523099231461919, + 0.0875676854717029, + 0.09483507767204118, + 0.09687784977207864, + 0.09476374649623781, + 0.08863004838616381, + 0.07569443395257729 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 16.21244884375926, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7760288851193998, + "wql": 0.32080160613526243 + } + }, + { + "config_id": "jena_weather__H__short", + "leaderboard_key": "jena_weather/H/short", + "dataset": "jena_weather/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7591774901189448, + "wql": 0.1835169108215369 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5015417402397853, + "wql": 0.05818833644858755, + "wsql_by_level": [ + 0.02411027921362717, + 0.050381756642118365, + 0.06369087695790264, + 0.06960458267368023, + 0.07020286471638436, + 0.06870997714125483, + 0.06693331457806571, + 0.061731508520739664, + 0.048329867593514965 + ], + "n_valid_labels": 1008, + "n_masked_labels": 0, + "mae_median": 11.73077568294765, + "n_mase_elements": 1008, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.66063831813718, + "wql": 0.317073430389058 + } + }, + { + "config_id": "jena_weather__H__medium", + "leaderboard_key": "jena_weather/H/medium", + "dataset": "jena_weather/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0707310989927863, + "wql": 0.3640989806826866 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.813012078825529, + "wql": 0.09338948318013397, + "wsql_by_level": [ + 0.04611690530358781, + 0.07875114381281337, + 0.09611611026104018, + 0.10496545754696694, + 0.10852047581170449, + 0.11025773188084591, + 0.10856095232665544, + 0.10205150727068767, + 0.08516506440690398 + ], + "n_valid_labels": 10080, + "n_masked_labels": 0, + "mae_median": 18.69212562664558, + "n_mase_elements": 10080, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7593055619569768, + "wql": 0.256494766903847 + } + }, + { + "config_id": "jena_weather__H__long", + "leaderboard_key": "jena_weather/H/long", + "dataset": "jena_weather/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4925574952113163, + "wql": 0.44387827099252614 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9989966491138594, + "wql": 0.12505554872696006, + "wsql_by_level": [ + 0.07222387139896622, + 0.1222705306057121, + 0.14609755510353717, + 0.15311808793605683, + 0.14971672049693413, + 0.142403231726703, + 0.13111372821106693, + 0.11565351482097905, + 0.09290269824268493 + ], + "n_valid_labels": 15120, + "n_masked_labels": 0, + "mae_median": 26.09638348896179, + "n_mase_elements": 15120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.6693187045182615, + "wql": 0.281733882686647 + } + }, + { + "config_id": "jena_weather__D__short", + "leaderboard_key": "jena_weather/D/short", + "dataset": "jena_weather/D", + "term": "short", + "freq": "D", + "prediction_length": 30, + "seasonality": 1, + "n_variates": 21, + "n_instances": 1, + "domain": "Nature", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.8578467510262653, + "wql": 0.23138296558762514 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.4623730320302106, + "wql": 0.11313175411296449, + "wsql_by_level": [ + 0.04915775725032128, + 0.09570348298364056, + 0.12492434364017857, + 0.14044820702719932, + 0.14604293284706374, + 0.14371937267932075, + 0.13209595772160823, + 0.11047668442334975, + 0.07561704844399812 + ], + "n_valid_labels": 630, + "n_masked_labels": 0, + "mae_median": 25.45602355709841, + "n_mase_elements": 630, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7871332935412477, + "wql": 0.48893726392369746 + } + }, + { + "config_id": "bitbrains_fast_storage__T__short", + "leaderboard_key": "bitbrains_fast_storage/5T/short", + "dataset": "bitbrains_fast_storage/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.9726733005020567, + "wql": 1.8982594024982165 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.0676721586534572, + "wql": 0.4707195208338831, + "wsql_by_level": [ + 0.1818068410897941, + 0.3208981857071005, + 0.4248170668736018, + 0.511955216323085, + 0.579862425475907, + 0.615486435767518, + 0.6129213028142877, + 0.5598837982202942, + 0.4288444152333593 + ], + "n_valid_labels": 107692, + "n_masked_labels": 12308, + "mae_median": 170.34685602662648, + "n_mase_elements": 104420, + "n_seasonal_error_zero": 56, + "n_seasonal_error_nan": 52 + }, + "relative": { + "mase": 0.5412311092676768, + "wql": 0.24797428645125616 + } + }, + { + "config_id": "bitbrains_fast_storage__T__medium", + "leaderboard_key": "bitbrains_fast_storage/5T/medium", + "dataset": "bitbrains_fast_storage/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.332305698225943, + "wql": 0.7965658755181099 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.1144568211620487, + "wql": 0.669901983594182, + "wsql_by_level": [ + 0.48768236775101775, + 0.8436048580942659, + 0.9224717021110068, + 0.8984046350368772, + 0.8238590880112334, + 0.7194991630853683, + 0.5975206927421431, + 0.4553313157826734, + 0.2807440297330531 + ], + "n_valid_labels": 1151890, + "n_masked_labels": 48110, + "mae_median": 512.0740723088344, + "n_mase_elements": 1112970, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8364873186732031, + "wql": 0.8409875494082119 + } + }, + { + "config_id": "bitbrains_fast_storage__T__long", + "leaderboard_key": "bitbrains_fast_storage/5T/long", + "dataset": "bitbrains_fast_storage/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5068539886984111, + "wql": 0.6979053733746295 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.255646914927661, + "wql": 0.49796040071929215, + "wsql_by_level": [ + 0.329721946226751, + 0.549722059917878, + 0.634363862944355, + 0.6560966582180611, + 0.6351358638230178, + 0.5758230154349707, + 0.49000474541883016, + 0.3770229349910998, + 0.23375251949866646 + ], + "n_valid_labels": 1732080, + "n_masked_labels": 67920, + "mae_median": 463.65943164960595, + "n_mase_elements": 1677544, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8332903681081022, + "wql": 0.7135070451047972 + } + }, + { + "config_id": "bitbrains_fast_storage__H__short", + "leaderboard_key": "bitbrains_fast_storage/H/short", + "dataset": "bitbrains_fast_storage/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 1250, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5571822067903167, + "wql": 0.6231221387021137 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1250, + "instances": 1250, + "fraction": 1.0 + }, + "metrics": { + "mase": 1.3553382400618266, + "wql": 0.48763246949916667, + "wsql_by_level": [ + 0.34916309791875266, + 0.5595324296766325, + 0.6386599620429473, + 0.6470817488226815, + 0.6071019845417432, + 0.5388797844681785, + 0.45832879903018614, + 0.3629279198219533, + 0.2270164991694247 + ], + "n_valid_labels": 116442, + "n_masked_labels": 3558, + "mae_median": 428.61705174374197, + "n_mase_elements": 112610, + "n_seasonal_error_zero": 58, + "n_seasonal_error_nan": 66 + }, + "relative": { + "mase": 0.8703787097949613, + "wql": 0.782563223503573 + } + }, + { + "config_id": "bitbrains_rnd__T__short", + "leaderboard_key": "bitbrains_rnd/5T/short", + "dataset": "bitbrains_rnd/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8369702659182979, + "wql": 0.895586111036325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5523889911100425, + "wql": 0.22571157400744696, + "wsql_by_level": [ + 0.1131057242513793, + 0.17445112177448088, + 0.21634748639048207, + 0.24570233641345907, + 0.26143642316401544, + 0.2659561975883508, + 0.26131705131545696, + 0.26402392207125813, + 0.22906390309813984 + ], + "n_valid_labels": 46368, + "n_masked_labels": 1632, + "mae_median": 140.09766312636629, + "n_mase_elements": 45888, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 34 + }, + "relative": { + "mase": 0.6599863980878441, + "wql": 0.25202665743248903 + } + }, + { + "config_id": "bitbrains_rnd__T__medium", + "leaderboard_key": "bitbrains_rnd/5T/medium", + "dataset": "bitbrains_rnd/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9740075110165132, + "wql": 1.1044931903333195 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.8198698741296788, + "wql": 0.8616536979722395, + "wsql_by_level": [ + 0.32010909922085695, + 0.6595498096096698, + 0.8546481055996562, + 0.9700148921911155, + 1.0315497957218205, + 1.0534593110289037, + 1.0339320519840067, + 0.9664003443180418, + 0.8652198720760836 + ], + "n_valid_labels": 455110, + "n_masked_labels": 24890, + "mae_median": 309.7934968741615, + "n_mase_elements": 441864, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8417490264259152, + "wql": 0.780134912114945 + } + }, + { + "config_id": "bitbrains_rnd__T__long", + "leaderboard_key": "bitbrains_rnd/5T/long", + "dataset": "bitbrains_rnd/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1660081104198932, + "wql": 0.9977535818816068 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9692527255681676, + "wql": 0.7326256861270896, + "wsql_by_level": [ + 0.26263660730001903, + 0.43035849058558157, + 0.5733525786245764, + 0.7039097082674953, + 0.8213701245812066, + 0.9253508584807146, + 1.003541121933375, + 1.029847152396359, + 0.8432645329744795 + ], + "n_valid_labels": 684238, + "n_masked_labels": 35762, + "mae_median": 268.68965337826086, + "n_mase_elements": 657984, + "n_seasonal_error_zero": 12, + "n_seasonal_error_nan": 64 + }, + "relative": { + "mase": 0.8312572759199147, + "wql": 0.7342751751845104 + } + }, + { + "config_id": "bitbrains_rnd__H__short", + "leaderboard_key": "bitbrains_rnd/H/short", + "dataset": "bitbrains_rnd/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 2, + "n_instances": 500, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.1175347302132743, + "wql": 0.9314629241561541 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 500, + "instances": 500, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.9084046625434794, + "wql": 0.622536539602229, + "wsql_by_level": [ + 0.189925747281607, + 0.35196329395360215, + 0.5228660710223745, + 0.6738508513518403, + 0.7921600166787235, + 0.8482021033842203, + 0.8382341418513866, + 0.7695852008392039, + 0.6160414300571025 + ], + "n_valid_labels": 46216, + "n_masked_labels": 1784, + "mae_median": 256.60982612202304, + "n_mase_elements": 44928, + "n_seasonal_error_zero": 10, + "n_seasonal_error_nan": 54 + }, + "relative": { + "mase": 0.8128648157271284, + "wql": 0.6683428008325799 + } + }, + { + "config_id": "bizitobs_application__S__short", + "leaderboard_key": "bizitobs_application/10S/short", + "dataset": "bizitobs_application", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.3935671590031806, + "wql": 0.01840457246049758 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5379122199959857, + "wql": 0.009676879239102616, + "wsql_by_level": [ + 0.005718467655354671, + 0.009206984695805857, + 0.011471343999923288, + 0.012675483251410383, + 0.012982018380355252, + 0.01235919817482769, + 0.010597702580521477, + 0.007799868107892501, + 0.0042808463058324015 + ], + "n_valid_labels": 120, + "n_masked_labels": 0, + "mae_median": 335.91491915384927, + "n_mase_elements": 120, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.38599662493535986, + "wql": 0.5257866902299666 + } + }, + { + "config_id": "bizitobs_application__S__medium", + "leaderboard_key": "bizitobs_application/10S/medium", + "dataset": "bizitobs_application", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9183336447716528, + "wql": 0.013742470259025481 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6728074099399378, + "wql": 0.009014031471967528, + "wsql_by_level": [ + 0.0053250351284929685, + 0.008041441151050504, + 0.009908143149045047, + 0.011061027538477717, + 0.01156326206471626, + 0.011305031155121423, + 0.010290640480738588, + 0.008378738143149095, + 0.005252964436916157 + ], + "n_valid_labels": 1200, + "n_masked_labels": 0, + "mae_median": 276.82573771476746, + "n_mase_elements": 1200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7326393993843424, + "wql": 0.6559251213258029 + } + }, + { + "config_id": "bizitobs_application__S__long", + "leaderboard_key": "bizitobs_application/10S/long", + "dataset": "bizitobs_application", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7487259254586917, + "wql": 0.012942679940654697 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7114945427683419, + "wql": 0.00940337973906831, + "wsql_by_level": [ + 0.005639516750790043, + 0.008817811456991695, + 0.01080228549296925, + 0.01181406681168754, + 0.011975589781002357, + 0.011501616966335516, + 0.010350575974267487, + 0.00840323022831662, + 0.0053257241892542715 + ], + "n_valid_labels": 1800, + "n_masked_labels": 0, + "mae_median": 291.7896762805515, + "n_mase_elements": 1800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.9502736830335604, + "wql": 0.7265403905671058 + } + }, + { + "config_id": "bizitobs_service__S__short", + "leaderboard_key": "bizitobs_service/10S/short", + "dataset": "bizitobs_service", + "term": "short", + "freq": "10S", + "prediction_length": 60, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.0559084960397855, + "wql": 0.025515037101462117 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.5102648424971503, + "wql": 0.00904185014062834, + "wsql_by_level": [ + 0.005545437074498282, + 0.008741895644593614, + 0.010797017043072362, + 0.011864628909435404, + 0.012058016719976115, + 0.011448188676307505, + 0.009927471707947886, + 0.007316889145958133, + 0.0036771063438657495 + ], + "n_valid_labels": 2520, + "n_masked_labels": 0, + "mae_median": 16.168332891686568, + "n_mase_elements": 2520, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.48324721735918685, + "wql": 0.3543733879230849 + } + }, + { + "config_id": "bizitobs_service__S__medium", + "leaderboard_key": "bizitobs_service/10S/medium", + "dataset": "bizitobs_service", + "term": "medium", + "freq": "10S", + "prediction_length": 600, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.9546641394188339, + "wql": 0.023513421962609537 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6766911315666555, + "wql": 0.009833083124587555, + "wsql_by_level": [ + 0.006065002034213274, + 0.009208565086854319, + 0.011176904774080563, + 0.01223673436303715, + 0.012505026776257849, + 0.012060348129904525, + 0.01087762421830998, + 0.008826761746961245, + 0.005540780991669091 + ], + "n_valid_labels": 25200, + "n_masked_labels": 0, + "mae_median": 15.772737826158602, + "n_mase_elements": 25200, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.7088263857680894, + "wql": 0.41819022089697877 + } + }, + { + "config_id": "bizitobs_service__S__long", + "leaderboard_key": "bizitobs_service/10S/long", + "dataset": "bizitobs_service", + "term": "long", + "freq": "10S", + "prediction_length": 900, + "seasonality": 360, + "n_variates": 2, + "n_instances": 21, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.8316933390369606, + "wql": 0.023678985220657325 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 21, + "instances": 21, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7375108265657856, + "wql": 0.010512706148302308, + "wsql_by_level": [ + 0.006327609946412664, + 0.009846294645371574, + 0.011993186891569965, + 0.013153113865717507, + 0.013463195946880219, + 0.013006712814559103, + 0.011656061502422215, + 0.009304181995745483, + 0.00586399772604204 + ], + "n_valid_labels": 37800, + "n_masked_labels": 0, + "mae_median": 17.203744626739727, + "n_mase_elements": 37800, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.8867581258012341, + "wql": 0.4439677651021599 + } + }, + { + "config_id": "bizitobs_l2c__T__short", + "leaderboard_key": "bizitobs_l2c/5T/short", + "dataset": "bizitobs_l2c/5T", + "term": "short", + "freq": "5T", + "prediction_length": 48, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 0.7721410982041648, + "wql": 0.22094461659341424 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.1784254793858558, + "wql": 0.05323072425789363, + "wsql_by_level": [ + 0.03970182457378459, + 0.05775852056963114, + 0.06703829855448888, + 0.06901463098362451, + 0.06659773554679885, + 0.06116060968073027, + 0.05082032905282235, + 0.03929716658487994, + 0.027687402774282183 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 1.7108462807678042, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.23107885307599263, + "wql": 0.24092338197064853 + } + }, + { + "config_id": "bizitobs_l2c__T__medium", + "leaderboard_key": "bizitobs_l2c/5T/medium", + "dataset": "bizitobs_l2c/5T", + "term": "medium", + "freq": "5T", + "prediction_length": 480, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.4416925389331963, + "wql": 0.47091183801289255 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.46805803394275275, + "wql": 0.15066586604671037, + "wsql_by_level": [ + 0.1208427399305252, + 0.16793213995804585, + 0.18917614577471148, + 0.18641543347087966, + 0.17931542261645622, + 0.1677535731947947, + 0.14704437936180462, + 0.11428143795344119, + 0.0832315221597343 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.990776801073835, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.3246587058632487, + "wql": 0.319944953353637 + } + }, + { + "config_id": "bizitobs_l2c__T__long", + "leaderboard_key": "bizitobs_l2c/5T/long", + "dataset": "bizitobs_l2c/5T", + "term": "long", + "freq": "5T", + "prediction_length": 720, + "seasonality": 288, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6820288964143004, + "wql": 0.6755692567838184 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.7196329677417436, + "wql": 0.27185704393516835, + "wsql_by_level": [ + 0.14155478957197806, + 0.22828112504036294, + 0.2902655383397438, + 0.3297569020541137, + 0.3637855372922853, + 0.36509794056814077, + 0.33677113158024635, + 0.2553209101210849, + 0.13587952084855892 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 6.654949705799421, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.427836269207881, + "wql": 0.40241180486719863 + } + }, + { + "config_id": "bizitobs_l2c__H__short", + "leaderboard_key": "bizitobs_l2c/H/short", + "dataset": "bizitobs_l2c/H", + "term": "short", + "freq": "H", + "prediction_length": 48, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.5845833438972332, + "wql": 0.5573763030242874 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.6952348623053873, + "wql": 0.20895363767782557, + "wsql_by_level": [ + 0.12418647773963183, + 0.21202435812786236, + 0.2764826410276723, + 0.301108516570164, + 0.30035380467378076, + 0.263396214548654, + 0.19578584889703815, + 0.12997040175604285, + 0.07727447575958389 + ], + "n_valid_labels": 336, + "n_masked_labels": 0, + "mae_median": 6.284077222148578, + "n_mase_elements": 336, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.43874931854040505, + "wql": 0.3748879106342641 + } + }, + { + "config_id": "bizitobs_l2c__H__medium", + "leaderboard_key": "bizitobs_l2c/H/medium", + "dataset": "bizitobs_l2c/H", + "term": "medium", + "freq": "H", + "prediction_length": 480, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.6159633796006725, + "wql": 1.1167911109559348 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.3495375366297277, + "wql": 0.21041907395256548, + "wsql_by_level": [ + 0.11046361583678962, + 0.1751552490600116, + 0.2136761194848542, + 0.23856316205990177, + 0.252148627532323, + 0.25206635937769073, + 0.2449662063774942, + 0.22894169797653735, + 0.17779062786748706 + ], + "n_valid_labels": 3360, + "n_masked_labels": 0, + "mae_median": 3.4510963549039193, + "n_mase_elements": 3360, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.21630288225721017, + "wql": 0.18841399424504193 + } + }, + { + "config_id": "bizitobs_l2c__H__long", + "leaderboard_key": "bizitobs_l2c/H/long", + "dataset": "bizitobs_l2c/H", + "term": "long", + "freq": "H", + "prediction_length": 720, + "seasonality": 24, + "n_variates": 7, + "n_instances": 1, + "domain": "Web/CloudOps", + "n_cohorts": 1, + "status": "ok", + "baseline": { + "mase": 1.280223980485366, + "wql": 1.0134048622912797 + }, + "quantile_crossing_fraction": 0.0, + "coverage": { + "instances_scored": 1, + "instances": 1, + "fraction": 1.0 + }, + "metrics": { + "mase": 0.42928385600442015, + "wql": 0.21523677136601738, + "wsql_by_level": [ + 0.11733496985287416, + 0.18677046685527376, + 0.23119674672292032, + 0.25482145806493955, + 0.26198003129010716, + 0.25564538874355563, + 0.24492265382843087, + 0.2187686365114728, + 0.16569059042458212 + ], + "n_valid_labels": 5040, + "n_masked_labels": 0, + "mae_median": 3.958209639982808, + "n_mase_elements": 5040, + "n_seasonal_error_zero": 0, + "n_seasonal_error_nan": 0 + }, + "relative": { + "mase": 0.33531933673173936, + "wql": 0.21238971646472382 + } + } + ], + "checkpoint_sha256": "dfc20235aeb4b9fc799001d69f5be390d9892448dbbf51fc2abb8ca0be453bf7", + "inference_seconds": 478.5668458370492 +} diff --git a/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/zero_mass.py b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/zero_mass.py new file mode 100644 index 0000000000000000000000000000000000000000..7e9c7067950c67da130e2c2538ffb42f34537402 --- /dev/null +++ b/tasks/timeseries-forecasting/timeseries-forecasting-astra-xhigh-1h100-48h-20261022a/submissions/S071/zero_mass.py @@ -0,0 +1,12 @@ +"""Fixed zero-mass projection from the supplied history only.""" +import numpy as np + +def project(ctx,q,threshold=.4): + finite=np.isfinite(ctx);n=finite.sum(-1).clip(min=1) + x=np.where(finite,ctx,0.) + mean=x.sum(-1)/n + scale=np.sqrt((np.where(finite,ctx-mean[...,None],0.)**2).sum(-1)/n) + zero=((ctx==0)&finite).sum(-1) + active=((ctx>=0)|~finite).all(-1)&(zero>=4)&(zero/n>=.1) + cutoff=np.where(active,threshold*scale,0.) + return np.where((q>=0)&(q