What does Kronos contribute to a trading strategy?Kronos 能为交易策略增加什么?

A model forecasts a higher price. Before that becomes a trade, a quantitative researcher needs to answer three questions: does the forecast add information, can an order capture the predicted move, and is the remaining return worth the risk? This is the financial research problem around Kronos. The model is a forecasting component; signal construction, portfolio allocation and execution remain separate research decisions.模型预测价格会上涨。在把它变成一笔交易之前,量化研究人员还要回答三个问题:预测是否带来增量信息,订单能否捕捉这段变化,剩下的收益是否值得承担风险?这才是围绕 Kronos 的金融研究问题。模型承担预测,信号构造、组合配置与交易执行还需要各自的研究。

THE RESEARCH CHAIN金融量化研究链条
  1. 01Information可用信息
    What was observable then?当时能够知道什么?
  2. 02Forecast预测与信号
    What does Kronos add?Kronos 增加了什么判断?
  3. 03Portfolio风险与仓位
    How much exposure?应该承担多少敞口?
  4. 04Execution成交与成本
    What survives trading?成交之后还剩多少收益?
Figure 1. A research workflow, not a model architecture. Out-of-sample testing must evaluate the whole chain, with a separate check at each stage.图 1。研究工作流,而非模型架构。样本外检验要覆盖整条链路,并分别检查每一环。
Quantitative finance主线 · 金融量化研究
Use data, statistical tests and explicit rules to study returns, risk and execution.用数据、统计检验与明确规则,研究收益、风险和交易执行。
Numerical quantization实现 · 数值量化
Encode continuous features as discrete states. Kronos uses BSQ here; this is also distinct from INT8/INT4 weight compression.把连续特征编码成离散状态。Kronos 的 BSQ 属于这一层,也不同于 INT8/INT4 权重压缩。

The central hypothesis is that Kronos extracts useful structure from historical prices and trading activity, beyond an agreed baseline. A plausible generated price path is insufficient evidence. We first define the financial task and how to test it, then inspect the representation and source code that make the forecast possible.核心假设是:相对于选定基线,Kronos 能从历史价量中提取有用的结构。生成一条看起来合理的价格曲线,还不足以验证这个假设。下文先定义金融任务与检验方式,再解释支撑预测的表示方法和源码。

The analysis uses the paper and repository revision 67b630e, checked on 26 October 2026. Source inspection and small random-weight mechanism checks support the implementation analysis. Paper metrics remain author-reported; this article does not reproduce a pretrained forecasting or trading backtest.本文对照论文与 2026 年 10 月 26 日核对的仓库版本 67b630e。实现判断来自源码核对与随机权重的小模型机制检查;论文指标保留作者报告口径,本文没有复现预训练预测或交易回测。

Define the target before evaluating the forecast先定义收益目标,再评价预测

Financial quantitative research starts with an observable hypothesis. For stock selection, the question may be whether a score ranks future returns across tradable stocks at the same decision time. For timing, it is whether a signal predicts one instrument’s return across successive decisions. For risk forecasting, the target may instead be realized variance or a loss event. These tasks use different labels and evaluation axes, even when they share the same price forecast.金融量化研究从一个可检验的假设开始。做选股,关心的是同一决策时刻,评分能否把可交易股票的未来收益排对;做择时,关心的是一个标的在不同时刻的收益能否被预测;做风险预测,目标可能是实现方差或亏损事件。三者即使共用一组价格预测,也需要不同的标签与评价轴。

Fix the instrument universe, bar frequency, information cutoff, execution convention and holding rule. For a daily-bar illustration, use only data available after day t closes, allow the signal to be computed and transmitted, and define entry at a later executable price. Record point-in-time index membership, corporate-action treatment, suspensions and trade restrictions; a current constituent list and today’s cleaned history are not automatically the historical investment opportunity set.先固定标的范围、K 线频率、信息截止点、成交口径与持有规则。以日线为例,只使用 t 日收盘后已经可得的数据,留出计算和传输时间,再定义之后能够执行的入场价。还要记录当时的指数成分、复权口径、停牌与交易限制;今天的成分列表和清洗后的历史数据,并不自动等于当年的可投资集合。

Information first. Execution next. Outcomes last.先确定可用信息,再定义成交,最后观察结果。
  1. ≤ t
    Completed bars已完成的 K 线

    Only observations recorded and available by the decision time.只使用决策时刻之前已经记录、能够取得的观测。

    Known inputs已知输入
  2. t + δ
    Process & infer处理与推理

    Data processing, model inference and order transmission take time.数据处理、模型推理与订单传输都需要时间。

    Latency执行延迟
  3. Pin
    Executable entry可执行入场

    Define a fill after the order can reach the market.订单能够到达市场之后,按成交规则确定入场价。

    Position begins建立头寸
  4. h
    Holding interval持有区间

    Fix the holding and exit rules before the test.在测试之前固定持有期与退出规则。

    Future exposure未来风险敞口
  5. Pout
    Executable exit可执行退出

    Observe the exit fill, then compute the realized label.观察退出成交价,再计算实现的收益标签。

    Outcome observed结果可观测
Gross return label毛收益标签 Available only after exit.退出之后才能确定。
Figure 2. A decision-time diagram, not a backtest. A known closing price is an input, not an automatically attainable fill. Entry and exit prices must follow explicit execution assumptions; charges not embedded in fill prices are deducted separately. Spacing shows order, not elapsed duration.图 2。决策时序示意,并非回测结果。已知收盘价属于输入,不能自动当作可成交价格;入场与退出必须遵循明确的执行假设,未计入成交价的费用另行扣除。间距只表示先后顺序,不代表时间长短。

Here h is the strategy’s holding interval; H elsewhere denotes the number of future bars produced by the model. They need not match. The label uses executable entry and exit prices. A score based on forecast price relative to the latest close can help rank assets, but that score is not yet a realized trading return.图中的 h 是策略持有区间,后文的 H 是模型生成的未来 K 线数量,两者不必相等。标签采用可执行的入场、退出价格。预测价格相对最新收盘价的变化可以作为排序评分,但这个评分还不是实际交易收益。

Read the axis behind RankIC先看 RankIC 沿哪个维度计算

A factor is a measurable score assigned to an asset at a decision time. Its value is established by a relationship with later outcomes, not by whether it came from a formula or a neural network. For stock selection, calculate the Spearman correlation across the stocks available at each time t, then examine the time series of those correlations.因子可以理解为在某个决策时刻赋给资产的可计算评分。它的价值来自与后续结果的关系,而不是来自手工公式还是神经网络。做选股时,应在每个 t 时刻,对当时可交易的股票计算评分与未来收益的 Spearman 秩相关,再研究这条相关系数时间序列。

Price-path RankIC价格路径 RankIC
Time within a forecast一段预测内的未来时刻Do predicted and observed prices rank future time points similarly? The paper computes this separately for OHLC, then averages.未来各时点的预测价格与真实价格,高低排序是否一致?论文对 OHLC 分别计算后汇总。
Paper return RankIC论文收益 RankIC
Samples within an asset class / frequency同资产类别、频率的所有样本Correlate forecast terminal returns with observed returns over that sample pool.在该样本池内,比较预测终点收益与实际收益的排序。
Stock-selection RankIC选股横截面 RankIC
Stocks at one decision time同一决策时刻的不同股票Does a higher score identify a better subsequent return among available stocks?在当时的可交易股票中,评分更高的是否有更好的后续收益?
Figure 3. The name RankIC does not fix the evaluation axis. The first two definitions follow the paper; the third is a stock-selection research definition. Their values are not directly interchangeable. Paper: metric definitions.图 3。同样叫 RankIC,评价轴也可能不同。前两项来自论文,第三项是选股研究的定义,数值不能直接互换。论文指标定义。

A positive average IC indicates positive association in the evaluated sample; its uncertainty and stability still need testing. It is not a net profit measure. Also inspect stability across dates and regimes, performance of score-sorted portfolios, and exposure to known risk factors. In an existing strategy, compare the baseline with and without the Kronos score under the same allocation and cost rules. A signal that duplicates an existing factor may add little even if it performs well in isolation.平均 IC 为正表示所评样本中的正关联,仍需检验不确定性与跨时期稳定性,也不能把它当作净利润。还应检查它在不同日期、市场状态下是否稳定,按评分分组后的组合表现如何,以及是否主要暴露于已知风险因子。若已有策略,应在相同仓位和成本规则下,比较加入 Kronos 评分前后的结果。与现有因子高度重复的信号,即使单独表现不错,增量价值也可能很小。

A point forecast cannot summarize risk点预测不能概括风险

The choice of loss already determines which forecast is preferred. Consider a last close of 100 and two equally likely terminal prices, 106 and 94. Squared-error risk is 36 when predicting 100 and 72 when predicting 106. The conditional mean is optimal for that loss, although it conceals the dispersion between the two possible outcomes. A point forecast and a risk forecast therefore need different summaries of the same distribution.损失函数已经决定了模型倾向于输出什么。设最后收盘价为 100,两个等概率终点为 106 和 94;预测 100 的平方误差期望为 36,预测 106 则为 72。条件均值在这个损失下最优,却没有表达两个结果之间的离散程度。因此,点预测与风险预测需要从同一分布提取不同统计量。

Figure 4. A constructed example, not model output. The dashed green mean stays at 100, although neither possible path is flat. A useful point estimate and a faithful description of possible futures answer different questions.图 4。自拟示例,并非模型输出。绿色虚线均值始终为 100,但两条可能路径都不平坦。合理的单点估计,与完整描述可能发生的未来,回答的是不同问题。

A conditional distribution preserves alternatives until a payoff or risk statistic is selected. Kronos represents that distribution through discrete states and next-token generation. If the only target is return or realized volatility, directly predicting that label is a valid baseline. Continuous probabilistic forecasters are also relevant controls. The research hypothesis is that Kronos’s learned representation improves forecast quality under a given computation budget. Multimodal futures alone do not establish that tokenization is necessary.条件分布允许在定义收益或风险统计量之前保留不同未来。Kronos 用离散状态和下一 token 生成来表示这一分布;如果只研究收益或实现波动率,直接预测相应标签也是合理基线;连续概率预测器同样可作为对照。待检验的假设是:在给定计算预算下,学到的表示是否改善预测质量。未来具有多种可能,本身不能证明 token 化必不可少。

The public Kronos predictor averages decoded paths when sample_count exceeds one. Its returned DataFrame is therefore a point forecast. To study variance, tail losses or coverage, preserve the individual paths before this averaging and calculate the chosen statistic on each path. Sample dispersion describes the model’s distribution; whether it matches observed uncertainty requires held-out calibration tests.公开 Kronos 预测接口在 sample_count 大于 1 时,会对解码路径求平均,返回的 DataFrame 因而是点预测。研究方差、尾部亏损或区间覆盖率,需要在这一步平均之前保留单条路径,再逐条计算统计量。采样离散程度描述的是模型自身的分布,是否符合实际不确定性,还需要留出数据上的校准检验。

Return signals, risk exposure and trading costs收益信号、风险敞口与交易成本

The trading layer converts a forecast distribution into an exposure decision. Define the payoff under the chosen entry and exit rules, compute it on each retained path, and estimate its mean, dispersion and adverse outcomes. Position construction then adds risk limits, liquidity and implementation costs. The portfolio optimization literature treats forecasts and allocation as separate components; Kronos supplies the former and does not by itself specify an executable strategy.交易层把预测分布转换为敞口决策。先按既定入场和退出规则定义收益,再对保留的每条路径计算收益,估计均值、离散程度和不利结果;仓位构造进一步加入风险上限、流动性与实施成本。组合优化研究将预测与配置作为不同组件;Kronos 提供前者,其本身没有完整规定可执行的策略。

Use the preceding terminal prices, but change the hypothetical probabilities: an order fills at 100; the exit price is 106 with probability 55% and 94 with probability 45%. These probabilities are invented for the calculation, not measured Kronos forecasts. The entry price must be achievable after the information used for the forecast becomes available. In particular, observing a completed bar does not automatically permit trading at that bar’s already-known closing price.沿用前文的两个终点价格,但更换一组假设概率:订单以 100 成交,退出价格有 55% 概率为 106、45% 概率为 94。这些概率专为说明计算而设,并非 Kronos 实测预测。入场价格必须在预测所用信息已经可得之后能够成交;例如,读取一根完整 K 线,并不自动意味着还能按这根 K 线已经确定的收盘价买入。

The two holding-period returns are +6% and −6%. Their probability-weighted mean is 0.55 × 6% + 0.45 × (−6%) = 0.60%. Let p denote the upward probability. Assume additional entry-and-exit charges of 0.20% of the initial invested amount. These charges are not already reflected in the fill prices. If spread and slippage are included in those prices, do not deduct them again. Cash earns zero over the same period.两个持有期收益分别为 +6% 和 −6%,按概率加权得到 0.55 × 6% + 0.45 × (−6%) = 0.60%。用 p 表示上涨概率;再假设尚未体现在成交价格中的买卖费用,合计为初始投入的 0.20%。若成交价已经包含价差和滑点,就不应再次扣除,同期现金收益设为零。

At p = 55%, expected net return is +0.40%. The losing outcome is still −6.20%, with probability 45%. If p is instead 51%, gross expected return falls to +0.12% and net expected return becomes −0.08%. With these symmetric payoffs and fixed additional charges, positive net expectation requires p > 51.67%. This threshold depends on payoff size and trading cost. To outperform cash, also subtract its return over the same period. There is no universal win-rate requirement.p = 55% 时,净期望收益为 +0.40%,但仍有 45% 概率发生 −6.20% 的亏损结果。若 p 改为 51%,毛期望收益降至 +0.12%,净期望收益变为 −0.08%。在这组对称收益和固定成本假设下,净期望为正需要 p > 51.67%;这个门槛取决于盈亏幅度和交易成本。若还要求胜过现金,就需再扣除同期现金收益,不能把它当作通用胜率要求。

Same payoffs: +6% / −6% · same additional round-trip charges: 0.20%相同盈亏幅度:+6%/−6% · 相同额外往返费用:0.20%
Bars: gross expected return柱形:毛期望收益Dashed line: additional charges虚线:额外交易费用
p = 55%Gross +0.60%毛收益 +0.60%Net +0.40%净收益 +0.40%
p = 51%Gross +0.12%毛收益 +0.12%Net −0.08%净收益 −0.08%
Figure 5. Constructed probabilities, per unit invested, for one holding period. The gap between each gross-return bar and the shared cost line is net expected return. No strategy backtest or profit claim is represented here.图 5。自拟概率、每单位投入、一个持有期的算例。柱顶与共用成本线之间的差额就是净期望收益;本图没有展示策略回测,也不构成盈利实测。

Returning to the p = 55% case, position sizing determines the account’s exposure to that distribution. Put a fraction w = 10% of initial capital into the position, hold until exit and keep the rest in zero-return cash. With the fixed proportional cost c = 0.002, expected account return is 0.04%, its standard deviation is approximately 0.597%, and the losing branch costs 0.62% of the account. Below, A denotes the account and σ denotes standard deviation. These are one-period figures; no annualization or optimal-position claim is implied.回到 p = 55% 的情景,仓位决定账户对这个分布承受多少敞口。假设用初始资本的 w = 10% 建仓,持有至退出,其余留在零收益现金中。在固定比例成本 c = 0.002 下,账户收益的期望为 0.04%,标准差约为 0.597%,亏损分支会损失账户的 0.62%。下式以 A 表示账户、σ 表示标准差。这些都是单个持有期的结果,没有年化,也没有声称 10% 是最优仓位。

The model probabilities require their own validation. A calibration check asks whether events assigned similar probabilities occur at corresponding frequencies on held-out periods. Temperature and top-p change the sampled distribution, and drawing more paths only estimates that chosen distribution more precisely. Neither operation proves calibration. Across assets, position decisions also need correlations, exposure limits and liquidity constraints; costs can grow with order size instead of remaining the fixed percentage used above. Probabilistic forecast evaluation.模型概率还要独立验证。校准检查考察的是:在留出的时期里,被赋予相近概率的事件,实际发生频率是否与之相符。temperature 与 top-p 会改变采样分布,增加路径数只会更精确地估计所选分布,都不能单独证明概率已经校准。扩展到多资产时,还要考虑相关性、敞口上限和流动性约束;成本也可能随订单规模增大,而不再是本例固定的百分比。参见概率预测的评估原理。

This also explains why numerical quantization will matter later. Reconstruction asks whether the observed bar survives compression; forecasting asks whether its code helps predict unseen outcomes; trading asks whether the resulting decision remains useful after risk, costs and execution. A deterministic compression cannot manufacture future information absent from its input, though it can make useful structure easier for a finite model to learn. If two histories with different conditional returns are collapsed into indistinguishable codes and available side information, that distinction is lost to the predictor. Each stage therefore needs its own target and out-of-sample test.这也解释了后文为什么还要检查数值量化。重建考察已观察到的 K 线经过压缩后保留多少;预测考察编码能否帮助判断未见结果;交易考察由此形成的决策在风险、成本和执行之后是否仍有用。确定性的压缩不能凭空制造输入中没有的未来信息,但可能把有用结构整理得更容易被有限模型学习。如果两段条件收益不同的历史,被压成在编码及可用附加信息上都无法区分的输入,预测器就失去了这项区别。因此,每一层都要用自己的目标做样本外检验。

A stock score is not a portfolio weight股票评分不等于组合权重

For several assets, expected portfolio return depends on the weights, while risk also depends on how returns move together. A conceptual allocation objective balances expected return against covariance risk and the cost of changing the current holdings. The form below is a research framework, not Kronos code; all terms use one common decision horizon, with risk aversion λ and feasible weights collected in W.扩展到多只资产后,组合预期收益取决于权重,风险还取决于资产收益如何共同变化。一个概念性的配置目标,是在预期收益、协方差风险和调仓成本之间权衡。下式是研究框架,不是 Kronos 的实现;各项采用同一决策周期,λ 表示风险厌恶程度,W 收集可行仓位约束。

Here μ̂ is a return forecast, Σ̂ a covariance estimate, and C the trading cost in portfolio-return units. Concentration, leverage, sector exposure and liquidity belong in W or the cost model. Independently sampled Kronos paths for different stocks do not estimate their joint dependence. A ranking score need not be calibrated in expected-return units either: using it in this objective requires an additional calibration step, or a separate rank-based allocation rule. Portfolio optimization framework.其中 μ̂ 是收益预测,Σ̂ 是协方差估计,C 是以组合收益为单位的交易成本。集中度、杠杆、行业暴露与流动性进入 W 或成本模型。为不同股票各自独立采样 Kronos 路径,不能据此估计它们的联合依赖。排序评分本身也未必具有预期收益的量纲;放进这个目标前需要另做校准,或者采用独立的按排名配置规则。参见组合优化框架。

What financial evidence does the paper provide?论文给出了哪些金融证据?

The paper includes price/return forecasting, volatility estimation and an investment simulation. Each answers a different research question. The investment protocol is the closest to a trading test, because it specifies a score and a portfolio rule rather than evaluating only the generated path.论文包含价格/收益预测、波动估计与投资模拟,它们回答不同的研究问题。其中,投资协议最接近交易检验,因为它除了生成价格路径,还规定了评分与组合规则。

The A-share simulation uses Qlib daily data: 90 historical days produce ten forecast closing prices, whose mean relative to the latest close forms the ranking score. It uses equal-weight long portfolios, top-50/drop-5 for CSI 300 and top-200/drop-10 for CSI 800, daily ranking, a five-day minimum holding period and 0.15% cost per trade. These are the authors’ stated settings, not a backtest reproduced here. Investment simulation protocol.A 股模拟采用 Qlib 日线:过去 90 日生成未来 10 日收盘价,以预测价格均值相对最新收盘价的变化构造评分。等权多头组合在 CSI300 使用 top-50/drop-5,在 CSI800 使用 top-200/drop-10,每日排序,最低持有 5 日,每笔交易成本为 0.15%。这些是作者报告的设定,本文未复现该回测。参见投资模拟协议。

Ten forecast days do not imply a ten-day holding period. The score is also not the terminal return label used above. Reproduction must preserve that distinction and specify the exact fill, cost and eligibility rules; otherwise a changed backtest cannot be attributed solely to the forecasting model.预测十天,不等于持有十天;这个评分也不是前文的终点收益标签。复现时必须保留这些区别,并落实成交价、成本与交易资格规则,否则回测变化不能全部归因于预测模型。

Ablations test a model design, not a trading strategy消融验证模型设计,不能代替策略检验

The paper also compares output representations and their dependence in Table 2. In its small-model experiment, price RankIC is 0.0149 for direct regression, 0.0102 for a continuous probabilistic model, 0.0226 for parallel discrete prediction and 0.0254 for sequential discrete prediction.论文还用 small 规模的对照比较输出表示与依赖方式,见论文表 2。在 small 规模的对照中,直接回归、连续概率模型、并行离散预测、顺序离散预测的价格 RankIC 分别为 0.0149、0.0102、0.0226、0.0254。

Price RankIC · higher is better · same axis from 0 to 0.03价格 RankIC · 越高越好 · 共用 0 至 0.03 刻度
Direct-AR · squared errorDirect-AR · 平方误差
0.0149
Prob-AR · Student-t mixtureProb-AR · Student-t 混合分布
0.0102
Discrete · parallel heads离散 · 并行输出头
0.0226
Discrete · conditional heads离散 · 条件输出头
0.0254
Figure 6. Author-reported Table 2 values, replotted on a shared zero-based scale; not reproduced measurements. All four variants are autoregressive. This comparison tests alternative output representations and dependence, not autoregression versus one-shot forecasting.图 6。按论文表 2 的作者报告值重绘,共用从零起算的刻度,并非本文复现实测。四个方案都是自回归模型;该对照比较输出表示与依赖方式,没有比较自回归和一次性多步预测。

The conditional-head result supports retaining pair dependence in this setup. It does not prove that every component is individually necessary: this comparison does not isolate BSQ against other quantizers, the prefix loss against a matched forecasting system without it, or cross-attention against a simpler conditioning layer. A persuasive mechanism and a system-level win are different kinds of evidence.这个条件头结果支持在所测设置中保留配对依赖。但不能由此推出每个组件都不可替代:该对照没有单独比较 BSQ 与其他量化器,没有隔离前缀损失对预测的贡献,也没有比较交叉注意力与更简单的条件层。机制解释合理,与整套系统在某组实验中胜出,是不同层次的证据。

These are author-reported price-path results. Treat them as evidence for testing a forecasting component; the financial decision still requires return labels, an executable strategy and a matched out-of-sample comparison. The source audit below identifies additional checks needed before reusing the public training examples.这些是作者报告的价格路径结果,可用于支持继续检验预测组件。金融决策仍需要收益标签、可执行策略与匹配的样本外对照。后文的源码审计还列出了复用公开训练示例前需要处理的问题。

Out-of-sample tests and incremental value样本外检验与增量价值

The first experiment should isolate incremental value at a fixed information set. Freeze the instrument universe, bar frequency, forecast origin, target, holding rule and available training data. Evaluate a matched simple baseline and Kronos on identical dates. For an existing signal, also test a validation-selected combination on untouched test periods: a standalone forecasting improvement does not establish that it adds information to the current research stack. This is a proposed protocol, not an experiment completed in this article.首轮实验应在固定信息集下识别增量价值。先固定标的范围、K 线频率、预测起点、目标、持有规则与可用训练数据,再让简单基线和 Kronos 在相同日期接受评估。若已有信号,还应在验证集确定组合方式,再到未触碰的测试期比较;独立预测变好,不代表对已有研究体系仍有增量信息。这里给出实验方案,本文尚未执行这组对照。

Question要回答的问题Comparison对照方法What to report应报告的结果
Does it beat a simple forecast?预测是否优于简单基线?Walk forward against last-close / zero-return, historical volatility and a simple model trained directly on the chosen return or volatility label.滚动向前,对照最后收盘价/零收益、历史波动,以及直接学习选定收益或波动标签的简单模型。Use error metrics for baselines constant along the evaluation axis; their correlation on that axis is undefined (N/A). Distinguish temporal price metrics from cross-sectional return metrics; compare by asset, frequency and horizon with time-block uncertainty.沿所评轴恒定的基线比较误差指标,该轴相关系数未定义,记为 N/A。时间维价格指标与横截面收益指标分开,按标的、频率、预测长度比较,并按时间块估计不确定性。
Does a signal survive execution?信号能否经受执行成本?Specify signal, fill time, fees, slippage, turnover and liquidity constraints.明确交易信号、成交时点、费用、滑点、换手与流动性约束。Net results and drawdown on untouched periods; isolate impact of costs and parameter selection.在未参与调参的时期报告净结果与回撤,单独分析成本和参数选择的影响。
Do its samples describe uncertainty?采样是否描述不确定性?Retain paths; compute statistics on each path before aggregation.保留路径,先逐条计算统计量再汇总。Coverage, interval width, tail misses and sensitivity to seed / T / top-p.覆盖率、区间宽度、尾部漏检,以及对种子/T/top-p 的敏感性。
Does representation preserve the input?表示是否保留输入?Encode/decode held-out bars; evaluate six channels separately.在留出 K 线上编码、解码,分别评估六个通道。Reconstruction error, clipped-input rate and valid OHLC/activity rate.重建误差、输入截断比例、OHLC/交易活动合法率。
Can it run within the budget?是否满足运行预算?Fix history length L, forecast length H, path count S and numerical precision; measure on the intended device.固定历史长度 L、预测长度 H、路径数 S 与数值精度,在目标设备测量。Latency distribution, peak memory, throughput, code/weight revisions and environment.延迟分布、峰值内存、吞吐,以及代码/权重版本与环境。

For each walk-forward split, fit preprocessing and any fine-tuning using only information available at each forecast decision time. Remove training examples whose label intervals overlap validation or test targets; retaining older context is a separate decision. Record the pretrained model’s data coverage as well: avoiding local fine-tuning alone does not prove that its test observations were unseen. Choose checkpoints, horizons and sampling settings on validation data, and retain the search history rather than reporting only the best configuration.每个滚动切分中,预处理拟合和微调都只能使用每个预测决策时刻已经可得的信息。训练样本的标签区间若与验证或测试目标重叠,应从对应训练集排除;保留较早历史作为上下文是另一件事。还需记录预训练数据覆盖范围,不能仅凭没有本地微调就认定测试观测未被模型见过。权重、预测长度和采样设置在验证集选择,并保留尝试记录,而不是只报告最好的一组。

Report uncertainty at the level of the experiment. Overlapping horizons and repeated observations of the same market are dependent; they do not provide one independent trial per bar. Compare by time block and market regime, and test sensitivity to costs and signal turnover. Forecast improvement, probability calibration and net portfolio performance should remain separate results, so a failure at one stage is visible rather than averaged away.结果的不确定性也要与实验单位匹配。重叠预测区间和同一市场的重复观测存在依赖,不能把每根 K 线当作一次独立试验。按时间块和市场状态比较,并检验成本、换手变化对结论的影响。预测改善、概率校准与组合净表现分别报告,才能看清失效发生在哪一层。

Research disposition: retain Kronos as a candidate representation and conditional forecasting model. Its inspectable tokenizer and paired-token generator justify a controlled evaluation. The evidence reviewed here does not establish deployable trading value. If only reconstruction improves, the result remains a representation improvement; if return ranking or calibration improves on untouched data, it supports further signal research; only incremental portfolio results under realistic execution assumptions justify an allocation study. These are separate decisions with separate evidence requirements.研究结论:将 Kronos 保留为候选表示与条件预测模型,进入受控对照。可追踪的 tokenizer 和成对 token 生成机制,使这项研究有明确的实现基础;本文核对的证据尚不足以确认可部署的交易价值。若只改善重建,结论停留在表示层;若在未触碰数据上改善收益排序或概率校准,可继续研究信号;若在真实约束下仍有组合净表现的增量,再进入资金配置评估。每一步需要各自的证据。

Model inputs: price, activity and calendar模型输入:价格、成交活动与日历

The financial task now has a target, a decision rule and a test. The next question is whether the model’s representation preserves the information that task needs. Kronos encodes each bar’s six features, predicts discrete states and decodes numerical observations; this mechanism is a means of producing forecasts, not a substitute for financial validation.金融任务已经有了目标、决策规则和检验方式,接下来才检查模型表示是否保留了任务需要的信息。Kronos 编码每根 K 线的六个特征,预测离散状态,再还原数值观测;这是产生预测的方法,不能代替金融检验。

  1. 01Observe观测[B, L, 6]
    OHLC + volume + amount开高低收 + 成交量 + 成交额
  2. 02Encode编码2 × [B, L]
    A causal tokenizer emits two IDs per bar.因果 tokenizer 为每根 K 线输出两个编号。
  3. 03Generate生成2 × [B, H]
    Predict coarse, then fine; append both.先生成粗 token,再生成细 token,成对追加。
  4. 04Decode解码[B, H, 6]
    Reconstruct six features; restore their units.还原六个特征,再恢复各自单位。
Figure 7. B is batch size, L is history length and H is forecast length. Small/base use 10 + 10 bits per bar. The public predictor averages decoded sample paths when sample_count exceeds 1.图 7。B 是批量大小,L 是历史长度,H 是预测长度。small/base 每根 K 线使用 10 + 10 bit;sample_count 大于 1 时,公开预测接口返回解码后多条路径的平均值。

One input row is [open, high, low, close, volume, amount]. OHLC are prices within the same interval; volume measures traded units and amount measures traded value. A completed bar such as [100, 103, 99, 102, 2000, 202000] is only a numerical example. The last two columns are not interchangeable: changing shares to lots changes the volume scale, and currency changes the amount scale.一行输入为 [open, high, low, close, volume, amount]。OHLC 是同一时间区间内的开、高、低、收盘价;volume 是成交数量,amount 是成交金额。例如 [100, 103, 99, 102, 2000, 202000] 只是一个数值示例。最后两列不可互换:股与手的换算改变成交量尺度,币种改变成交额尺度。

The same relative movement can occur around a price of 10 or 1,000, while trading volume can be orders of magnitude larger than either price. With raw-value MSE, the largest-scale channel would dominate reconstruction. Per-feature normalization gives the shared tokenizer a comparable numerical range across channels and windows. It creates a useful bias toward relative shape; absolute level and scale must be kept outside the token stream for later restoration.相似的相对走势,既可能发生在价格 10 附近,也可能发生在 1,000 附近;成交量的数值又可能比价格高几个数量级。直接对原值做 MSE 重建,尺度最大的通道容易主导损失。逐特征归一化让共享 tokenizer 在不同通道和窗口中面对相近的数值范围,使它更侧重相对形态;绝对水平和尺度则要另外保存,供最后还原。

In KronosPredictor.predict, each feature gets its own history mean and population standard deviation. Inputs are clipped to ±5 by default; predictions are restored using those same history statistics. These statistics must be computed without future targets.在 KronosPredictor.predict 中,每个特征分别使用历史均值与总体标准差,输入默认截断到 ±5;预测后仍使用同一组历史统计量还原。计算这些统计量时,不能让未来目标参与。

For a feature whose history has mean 100 and standard deviation 2, an observed value of 103 becomes approximately 1.5. A decoded value of −0.5 becomes approximately 99. A rare input of 120 is clipped from approximately 10 to 5, so clipping deliberately discards some extreme-value information.假设某个特征的历史均值为 100、标准差为 2,观测值 103 归一化后约为 1.5;解码值 −0.5 还原后约为 99。若输入突然达到 120,约为 10 的标准化结果会截断为 5,因此截断确实会丢掉部分极端幅度信息。

For research, window standardization is a representation assumption, not a transformation into returns or a proof of stationarity. Absolute price and activity scales are removed from the token input and retained for inverse transformation. Record those statistics and clipping rates at every forecast origin, then inspect performance by volatility and liquidity regime. Changing the preprocessing also changes the input distribution seen by the pretrained tokenizer.从研究角度看,窗口标准化是一项表示假设,不等于把价格变成收益,也不能证明序列平稳。价格与成交活动的绝对尺度从 token 输入中移除,保留在反变换所用统计量里。每个预测起点都应记录这些统计量和截断比例,再按波动、流动性状态检查表现。修改预处理,也会改变预训练 tokenizer 面对的输入分布。

Joint encoding imposes a hypothesis about the information set: price shape and trading activity may be more useful together than as independent marginal features. The same high–low range under low and high volume represents different observations. Kronos projects the entire six-dimensional row and lets a causal encoder use preceding rows. This permits their dependence to be represented; whether it adds predictive value must be compared with matched multivariate baselines. Joint representation here concerns one instrument’s six channels and history. Generating paths separately for several instruments does not establish cross-asset dependence.联合编码对应一个信息集假设:价格形态与交易活动的组合,可能比彼此独立的边际特征更有用。同样的高低价区间,伴随少量成交和大量成交,是不同的观测。Kronos 共同投影整行六维输入,并允许因果编码器利用此前各行;这种结构能够表达依赖,是否增加预测价值仍需与匹配的多变量基线比较。这里的联合表示针对单个标的的六个通道及其历史。分别为多只资产生成路径,并不会自动建立跨资产相关结构。

Calendar embeddings provide information that sequence position alone lacks: neighboring bars can be at different hours or on different weekdays. The code sums embeddings for minute within the hour, hour, weekday, day of month and month, then adds them to the bar embedding. This supplies calendar cues, not an exchange calendar or market identity. Supply a consistent timezone and a valid future trading schedule; news, text and order-book data are absent from this interface.日历 embedding 补充的是序列位置没有表达的信息:相邻 K 线可能位于不同小时或星期。代码将小时内分钟、小时、星期、月内日期、月份的 embedding 相加,再加到 K 线表示上。这提供了日历线索,却没有内置交易所日历或市场身份;调用者仍需统一时区、生成有效的未来交易时刻。这个接口也没有新闻、文本和订单簿输入。

The wrapper does not apply log1p to volume or amount. If volume is absent it fills both activity columns with zero; if only amount is absent it estimates amount as volume times the mean of OHLC. These are input fallbacks, not recovered observations. For a controlled experiment, provide both columns explicitly and record any preprocessing.包装接口没有对 volume 或 amount 做 log1p。缺失 volume 时,两列交易活动都补零;仅缺失 amount 时,以 volume 乘 OHLC 均价估算。这些是输入兜底,不是恢复出的真实观测。要做可比较的实验,应明确提供两列并记录预处理。

Source: timestamp extraction and predictor normalization源码:时间特征提取与预测接口归一化

Numerical quantization: what the representation loses数值量化:表示舍弃了什么

Quantization merges nearby representations into a finite set of states. Its immediate consequence is many-to-one reconstruction: an encoder stores a region ID, and the decoder returns a representative value. Within-region differences are lost. They should not be called noise merely because they are compressed; whether they matter for future returns is a downstream empirical question. A scalar example in [0, 2) makes the capacity/error trade-off explicit.数值量化把表示合并为有限状态,直接后果是多对一重建:编码器保存区域编号,解码器返回代表值,区域内部的差异被舍弃。不能因为这些差异被压缩,就把它们认定为噪声;它们是否包含未来收益信息,要由下游实验判断。先用 [0, 2) 上的标量例子明确容量与误差的权衡。

Worked example: bit budget and reconstruction error展开算例:位数预算与重建误差

With step Δ = 0.5 there are four cells, requiring two fixed-length bits. The cell [1, 1.5) has ID 2 and midpoint 1.25: both 1.1 and 1.4 decode to 1.25. A half-width step gives eight cells and needs three bits. Now 1.1 and 1.4 have different IDs, with reconstructions 1.125 and 1.375.步长 Δ = 0.5 时,一共有四个区域,需要 2 bit 定长编号。其中 [1, 1.5) 的编号为 2,中点为 1.25:1.1 和 1.4 都会还原成 1.25。把步长减半,区域数变成八个,需要 3 bit;此时 1.1 和 1.4 分属不同区域,分别还原成 1.125 和 1.375。

The error bound applies inside these covered cells; saturation outside the covered range needs a separate error analysis. The interval ID is a label, while its representative is a numerical value. For instance, ID 2 in this example decodes to 1.25, not to the number 2.这个误差界适用于所覆盖的区域;超出范围后若采用饱和截断,需要另算误差。区域编号是标签,代表值才是恢复的数值。例如本例的编号 2 解码为 1.25,不能直接当作数值 2 使用。

Same input x = 1.4 · same covered range [0, 2)相同输入 x = 1.4 · 相同覆盖范围 [0, 2)
2 bits · 4 cells · Δ = 0.52 bit · 4 个区域 · Δ = 0.5
Reconstruction 1.25 · absolute error 0.15重建值 1.25 · 绝对误差 0.15
3 bits · 8 cells · Δ = 0.253 bit · 8 个区域 · Δ = 0.25
Reconstruction 1.375 · absolute error 0.025重建值 1.375 · 绝对误差 0.025
Figure 8. A fixed-range midpoint quantizer, constructed for explanation. One extra bit doubles the available cells; for x = 1.4 the squared error changes from 0.0225 to 0.000625. Kronos quantizes learned vectors, so this scalar step size is not its price resolution.图 8。定范围中点量化器的自拟示例。增加 1 bit 将区域数翻倍;对 x = 1.4,平方误差从 0.0225 降到 0.000625。Kronos 量化的是学到的向量,图中的标量步长并非它的价格精度。

The trade-off is between coding rate and distortion. For a fixed-length K-bit representation, the nominal rate is K bits and at most 2ᴷ IDs are available; distortion measures what reconstruction loses. The scalar example has a known step size, so its error is easy to calculate. A learned tokenizer instead shapes both the partition and the reconstruction through training. More bits increase nominal capacity, but do not guarantee a better trained predictor or better returns.这就是编码率与失真的权衡。K bit 定长表示的名义编码率为 K bit,最多有 2ᴷ 个编号;失真衡量重建丢掉了多少信息。标量例子的步长已知,误差容易计算;可学习 tokenizer 则通过训练调整划分与重建方式。更多 bit 增加名义容量,但不保证训练后的预测器更好,更不保证交易收益更高。

In the previous normalization example, standard deviation 2 turns a normalized error of 0.15 into an original-unit error of approximately 0.30. A decoder’s numerical precision must therefore be interpreted with its scale. For general quantization terminology, see MIT 6.450, Chapter 3: Quantization; the numbers above are our own calculation.沿用前面的归一化例子,标准差为 2 时,标准化误差 0.15 对应原单位误差约 0.30。因此,讨论重建精度要带上尺度。数值量化术语可参见 MIT 6.450 第三章《Quantization》;上面的数值为本文自拟计算。

BSQ and the two-token representationBSQ 与双 token 表示

Independent scalar quantizers place a grid over each original feature. Vector quantization instead assigns an entire vector to a codeword. Kronos first learns a contextual transformation of the six features, then quantizes that latent vector. The encoder can place observations with related candle shape, activity and history in the same region even when their original coordinate-wise bins differ.逐特征标量量化,会在原始特征的各个坐标上分别划格子;向量量化则把整条向量分配给一个码字。Kronos 先对六维特征及其历史上下文学一个变换,再量化潜向量。这样,编码器可以把形态、成交活动与历史相关的观测放进同一区域,即使它们在原始坐标上属于不同格子。

The implementation projects six features into a hidden space, applies causal Transformer blocks, then projects each position into K coordinates; the released base tokenizer uses K = 20. Given an already normalized sequence, the causal mask prevents the encoder at t from reading later positions. Thus the code can depend on the preceding trend rather than just the current row. However, historical-window normalization can change earlier inputs when that window changes: a causal mask alone does not make the entire raw-data preprocessing causal at every earlier position.实现中,六维特征先投影到隐藏空间,经因果 Transformer,再把每个位置投影成 K 个坐标;已发布 base tokenizer 使用 K = 20。对于已经标准化的序列,因果掩码阻止 t 位置读取后续位置,因此编码可以利用此前走势。需要区分:更换历史窗口会改变归一化统计量,进而改变较早的输入;注意力的因果掩码不能单独保证整条原始数据预处理链在每个较早位置都严格因果。

A conventional learned vector codebook stores candidate vectors and assigns a latent vector to a nearby candidate. BSQ fixes the candidate geometry instead: its codewords are the 2ᴷ sign combinations with coordinates ±1/√K. The learned encoder adapts the data to these fixed regions. A normalization step places nonzero latent vectors on the unit sphere, and a sign test selects a vertex.常规可学习向量码本存储候选向量,再把潜向量分配给邻近候选。BSQ 则固定候选几何:码字由坐标 ±1/√K 的 2ᴷ 种符号组合构成,让可学习编码器把数据变换到适合这些区域的位置。归一化将非零潜向量放在单位球面上,符号测试负责选择顶点。

Why does taking signs select the nearest vertex? Let z be unit length and write a candidate as q = s/√K, where each sᵢ is ±1. All candidates have unit length, so minimizing squared Euclidean distance is equivalent to maximizing their dot product with z. Each coordinate can be chosen independently: match the sign of zᵢ.为什么取符号恰好能选中最近顶点?令 z 的长度为 1,把候选写成 q = s/√K,每个 sᵢ 只能取 ±1。所有候选长度都为 1,因此最小化欧氏距离平方,等价于最大化它与 z 的点积。每个坐标可以独立选择:与 zᵢ 同号即可。

A zero coordinate is a distance tie; the pinned Kronos code chooses −1. Its normalization also has an epsilon guard, so the unit-vector derivation assumes a nonzero input outside that guard. For z = (0.6, 0.8), the chosen vertex is (1/√2, 1/√2), with squared error approximately 0.0201. This is latent-space distortion; the learned decoder determines the error in OHLC and activity.坐标为零时,两种符号距离相同;本文固定版本的 Kronos 选择 −1。代码的归一化还有 epsilon 保护,上面的单位向量推导假定输入非零且未触及该保护。对 z = (0.6, 0.8),选中的顶点为 (1/√2, 1/√2),平方误差约为 0.0201。这是潜空间失真,OHLC 与成交活动的重建误差还取决于学到的解码器。

z₁
z₂
Input z输入 z(0.6, 0.8)
Nearest codeword q最近码字 q(0.7071, 0.7071)
Squared error平方误差‖z − q‖² ≈ 0.0201

The two axis signs identify one of four regions. The short white segment is the quantization error.两个坐标的符号指定四个区域之一。白色短线表示量化误差。

Figure 9. Two-dimensional BSQ geometry. All four codewords lie on the unit circle; each quadrant maps to the vertex with matching signs. Real Kronos uses 20 latent dimensions. These axes are learned features, not price and volume axes.图 9。二维 BSQ 几何示意。四个码字都在单位圆上,每个象限映射到同号顶点。真实 Kronos 使用 20 维潜空间;图中坐标是学到的特征轴,并非价格轴与成交量轴。

The encoder and decoder must learn how observations map to these fixed vertices. Sign partitioning discards latent magnitudes and within-region differences; the reconstruction objective trains the surrounding transformation. The result avoids a million-vector lookup table, but does not establish economic meaning for a token. A token ID is a learned code, not an ordinal price, a regime label or a trading instruction. Boundary sensitivity and downstream forecast performance need separate measurement.编码器与解码器负责学习观测到固定顶点的映射。符号划分舍弃潜向量幅度和区域内部差异,重建目标训练其前后的变换。这样可以避免百万向量查表,但不会自动赋予 token 经济含义。编号是学到的编码,不是有大小关系的价格、已识别的市场状态标签或交易指令。边界敏感性与下游预测表现需要分别测量。

The last line uses the real 10 + 10 split: each ID is in [0, 1023]. Below, four bits make the conversion visible. The first coordinate is the least significant bit in the public half=True path; reading the printed bit sequence as an ordinary left-to-right binary number would give the wrong ID.最后一行按真实的 10 + 10 划分,每个编号都落在 [0, 1023]。下图用四个 bit 展示转换过程。公开 half=True 路径把第一个坐标当作最低位,不能把图中的排列直接按通常的二进制书写顺序读数。

First group第一组
+0.5−0.5
1 × 10 × 2
a = 1
Second group第二组
+0.5+0.5
1 × 11 × 2
b = 3
Figure 10. Quantization turns a continuous latent vector into signs; bit weights turn each group into an integer. The real 20-bit representation has 1,048,576 possible pairs but only two 1,024-way output heads.图 10。数值量化将连续潜向量变成符号,位权将每组符号变成整数。真实 20 bit 表示共有 1,048,576 种编号组合,但输出只需要两个 1,024 分类头。

BSQ solves the codebook problem, but a new bottleneck appears if the predictor still treats each full 20-bit code as one class: a 1,048,576-way output layer. Splitting into two 10-bit IDs preserves 1,024 × 1,024 combinations while reducing the two output heads to 2,048 logits in total. At hidden width 512, the output projections alone shrink from 536,870,912 weights to 1,048,576.BSQ 解决了码本问题,但预测器如果仍把完整 20 bit 编码当作一个类别,就会遇到新的瓶颈:1,048,576 分类的输出层。拆成两个 10 bit 编号后,仍有 1,024 × 1,024 种组合,两步合计只需输出 2,048 个 logit。按隐藏宽度 512,仅输出投影就从 536,870,912 个权重减到 1,048,576 个。

One 20-bit vocabulary一个 20 bit 词表

1,048,576
logits per bar每根 K 线的 logits 数
536.9 M
512 × 1,048,576 output weights512 × 1,048,576 个输出权重

Two conditional 10-bit heads两个有条件依赖的 10 bit 头

2,048
logits per bar每根 K 线的 logits 数
1.05 M
2 × 512 × 1,024 output weights2 × 512 × 1,024 个输出权重
Figure 11. Derived output-projection budget at hidden width 512. Both designs allow 2²⁰ pairs/states; the two-head projection uses 1/512 as many weights. Biases, input embeddings, fusion and dependency layers are excluded. This is a parameter calculation, not a latency benchmark.图 11。按隐藏宽度 512 推算输出投影预算。两者都允许 2²⁰ 种组合/状态,双头输出投影的权重数为单头的 1/512。未计偏置、输入 embedding、融合层与条件依赖层;这是参数计算,不是延迟实测。

The 20 bits describe logical state capacity. In the public implementation, the two IDs are torch.long tensors; embeddings and the neural network still use their configured numerical precision. This is quantization of market representations, and does not imply a packed 20-bit runtime tensor or an INT8/INT4 network.这里的 20 bit 描述逻辑状态容量。公开实现中的两个编号使用 torch.long 张量,embedding 与网络仍按各自配置的数值精度运行。被量化的是市场表示,不能据此推断运行时已打包成 20 bit,也不能推断网络本身采用 INT8/INT4。

The saving comes from shared, factorized computation, not from retaining a separately learned parameter for every joint state. Keeping the number of possible combinations does not guarantee the same effective modeling capacity. More pieces could shrink each vocabulary further, but add dependent decisions and fusion overhead; one bit per head would require 20 decisions. Two pieces are a practical trade-off, not a mathematically unique optimum. They still need a useful division of information and a way to coordinate their predictions.节省来自共享和分解计算,不再为每个联合状态各自保留一套参数。保留组合数量,并不保证保留完全相同的有效建模能力。继续拆分可以缩小单个词表,却会增加有依赖的决策步骤及融合开销;若每个头只预测一位,就需要 20 次决策。两段是工程折中,不能称为数学上唯一最优。接下来还有两个问题:信息怎样分工,以及两个预测怎样协调。

Source: BSQuantizer, bit conversion and binary quantization源码:BSQuantizer、编号转换与二进制量化

Training loss versus financial objectives训练损失与金融目标

The coarse/fine interpretation is enforced by the objective. Reconstruction from only the full 20-bit code would allow information to be distributed arbitrarily between the two halves. Kronos also requires the first ten bits to reconstruct the input independently. Both branches recover all six features through separate input projections and a shared causal decoder. The first token is therefore trained to carry a lower-capacity reconstruction, rather than being assigned a market meaning in advance.粗细分工由训练目标施加。若只训练完整 20 bit 重建,信息可以任意分散到两半;Kronos 还要求前 10 bit 独立重建输入。两条路径经不同输入投影与共享因果解码器恢复全部六个特征。因此,第一个 token 被训练成容量较低的重建表示,而非预先定义好的经济状态。

The prefix loss makes the first half useful under a smaller information budget; the full-code loss lets the second half contribute additional detail. That creates an inductive bias aligned with generating the first half before the second. The second half is not explicitly trained as an additive numerical residual, and “coarse/fine” assigns neither price/volume nor daily/minute semantics. The chosen bit semantics remain learned.前缀重建损失迫使第一半在较小信息预算下也能工作,完整重建损失则允许第二半补充细节。这给表示施加了与“先生成第一半、再生成第二半”一致的归纳偏置。第二半没有被显式训练成可加的数值残差;粗细也不对应价格/成交量或日线/分钟线,具体 bit 含义仍由模型学习。

Seen as rate–distortion design, the first ten bits must support a usable reconstruction, while twenty bits provide a larger budget. Both losses encourage this progression in aggregate. They do not enforce that the full reconstruction has lower error for every individual bar, and the second group is not a separate residual quantizer.从编码率与失真的角度看,前 10 bit 就要支持可用重建,完整 20 bit 再提供更大预算。两项损失在总体上鼓励这种分工,但没有约束每根 K 线的完整重建误差都小于前缀重建,也没有把后半组实现成一个独立残差量化器。

This structure is justified by how the code will be predicted, not by a claim of better reconstruction. In the paper’s 18-bit tokenizer comparison, hierarchical reconstruction MSE is 0.0203 versus 0.0202 for ordinary Transformer reconstruction. The hierarchy keeps reconstruction similar; this table does not isolate a forecasting gain from the prefix loss.这种结构服务于后续怎样预测编码,不能用“重建更准”概括。论文的 18 bit tokenizer 对照中,分层与普通 Transformer 重建的 MSE 分别为 0.0203、0.0202。它保持了相近重建水平;这张表没有单独测出前缀损失对最终预测的增益。

Hard signs introduce a training problem: their derivative is zero almost everywhere. A straight-through estimator keeps discrete forward values but substitutes an identity gradient through the sign step; this is a surrogate, not the exact derivative. The commitment term pulls continuous latents toward their assigned vertices. Entropy terms address a different failure: confident assignments can still collapse onto the same few codes. Low per-sample entropy favors decisive assignment; high batch usage entropy favors diversity across examples.硬取符号又带来训练问题:导数几乎处处为零。直通估计器在前向保留离散值,反向用恒等梯度替代符号步骤的导数;这是近似梯度,不是真实导数。commitment 项让连续潜向量靠近被分配的顶点。熵项解决另一个问题:分配很确定,也可能所有样本都挤在少数码里。压低单样本熵鼓励分配明确,提高批量使用熵则鼓励不同样本使用多样编码。

Here sg stops the gradient, and τ is the inverse temperature used inside the entropy approximation. The released base tokenizer uses β = 0.05, γ₀ = 1, γ = 1.1, ζ = 0.05 and the implementation default τ = 1. Minimization reduces the per-sample entropy term and increases the batch-usage entropy term. Neither entropy is a financial-risk measure.sg 表示停止梯度,τ 是熵近似内部使用的逆温度。已发布 base tokenizer 采用 β = 0.05、γ₀ = 1、γ = 1.1、ζ = 0.05,以及实现默认的 τ = 1。最小化损失会压低单样本熵项,并提高批量使用熵项;这里的熵都不是金融风险指标。

Read the entropy implementation carefully: it uses tractable bit/group approximations rather than enumerating the full million-code distribution. In this revision, the default analytical branch replaces grouped probabilities with per-bit probabilities before computing its batch entropy statistic. An idealized codebook-entropy formula is therefore not an exact description of this branch.熵的实现也需要具体看代码:它采用可计算的 bit/分组近似,不枚举百万种编码的完整分布。本版本默认的 analytical 分支在计算批量熵统计前,将分组概率变量替换成了逐 bit 概率,因此不能把理想化的“完整码本熵”公式直接当作该分支的精确实现。

The two-stage procedure freezes the tokenizer before fitting next-token probabilities. This fixes the vocabulary and separates reconstruction from distribution estimation. It also creates an objective mismatch worth testing: phase one preserves observed bars, while the downstream task may require return-relevant distinctions. A controlled study should keep the data split, predictor capacity and tuning budget comparable when testing alternative representations; lower reconstruction MSE alone does not resolve that choice.两阶段流程先训练 tokenizer,再冻结它、拟合下一 token 概率。这固定了词表,并把重建与分布估计分开;同时也留下需要检验的目标差异:第一阶段保留已观察的 K 线,下游任务则可能需要对收益有用的区别。比较其他表示时,应保持数据切分、预测器容量与调参预算可比;仅凭更低的重建 MSE,无法完成这项选择。

Source: shared decoder and tokenizer branches源码:共享解码器与 tokenizer 双重建分支

Source: tokenizer training loss源码:tokenizer 训练损失

Why coarse and fine tokens are conditional粗细 token 为什么要条件生成

The factorized output must preserve the joint distribution of the two codes. For a fixed history, suppose only (A, a) and (B, b) are possible, each with probability one half. Independent heads can estimate both marginals correctly yet assign one quarter to each of four pairs. Half the resulting probability then lies on combinations absent from the target distribution. This is a distributional error even before the decoded output is evaluated as a return signal.分解输出词表后,仍需保留两个编号的联合分布。固定一段历史,假设下一对只有 (A, a) 和 (B, b) 两种可能,各占一半。独立头能够估对两个边际分布,却会给四种配对各分配四分之一概率,使一半概率落到目标分布没有的组合上。这首先是分布估计误差,随后才会影响解码结果及收益信号。

Hypothetical data: only (A, a) and (B, b), each with probability ½.假设数据:只有 (A, a) 与 (B, b),各占 ½。

Independent heads独立输出头

p(a) = p(b) = ½
Pair配对Probability概率
(A, a)25%
(A, b)25%
(B, a)25%
(B, b)25%

Conditional heads条件输出头

p(a | A) = p(b | B) = 1
Pair配对Probability概率
(A, a)50%
(A, b)0%
(B, a)0%
(B, b)50%
Figure 12. The independent marginals are individually correct but put 50% probability on absent cross-pairs (A, b) and (B, a), highlighted in amber. Conditioning preserves the joint distribution. A/B/a/b are invented symbols, not discovered market meanings.图 12。独立头各自的边际概率都正确,却把 50% 的概率分给未出现的交叉配对 (A, b)、(B, a),表中以琥珀色标出。条件分解可以保留联合分布。A/B/a/b 是自拟符号,不代表已发现的市场语义。

Kronos uses the probability chain rule: select a coarse ID, then predict the fine ID conditioned on that selection and the history. To write the general model, let aₜ and bₜ denote the two IDs at time t, and Hₜ the visible history. The toy example’s A/B/a/b are candidate values, whereas aₜ and bₜ below are variables. The factorization is an exact identity; how well finite neural networks approximate its factors is an empirical question. Reversing the order is mathematically possible, while the prefix-reconstruction objective motivates this chosen order.Kronos 使用概率链式法则:先选择粗编号,再根据这个选择及历史预测细编号。写成一般模型时,令 aₜ、bₜ 表示 t 时刻的两个编号,Hₜ 表示可见历史。上面例子的 A/B/a/b 是候选值,这里的 aₜ、bₜ 则是变量。下面的分解是精确的概率恒等式,有限神经网络能把各项逼近多好,才是实验问题。数学上也可以反过来分解;前缀重建目标为当前顺序提供了结构上的理由。

At each observed position, two embedding lookups are concatenated and projected into one hidden vector. Calendar embeddings are added. A causal Transformer backbone uses RMSNorm, rotary position embeddings, attention and SwiGLU feed-forward layers. For Kronos-small, the predictor has 8 blocks, hidden width 512 and 8 attention heads. The first output head produces logits for aₜ₊₁.每个已观测位置先查两张 embedding 表,把结果拼接后投影成一个隐藏向量,再加上日历 embedding。因果 Transformer 主干使用 RMSNorm、旋转位置编码、注意力与 SwiGLU 前馈层。Kronos-small 的预测主干有 8 层,隐藏宽度为 512,注意力头数为 8。第一个输出头给出 aₜ₊₁ 的 logits。

Visible history已知历史
(a₁,b₁) … (aₜ,bₜ)
Causal Transformer因果 Transformer
H = [h₁ … hₜ]
01
Coarse head粗 token 输出头hₜ → logits₁ → aₜ₊₁
02
Dependency-aware layer条件依赖层Q = E₁(aₜ₊₁)K, V = HCross-attention + residual + normalization交叉注意力 + 残差 + 归一化
03
Fine head细 token 输出头logits₂ → bₜ₊₁
Figure 13. One next-bar step. The sampled coarse token supplies the query; historical hidden states supply keys and values. The fine head reuses the backbone context instead of running a second complete backbone.图 13。一根未来 K 线的生成过程。采样到的粗 token 提供 Query,历史隐藏状态提供 Key、Value;细 token 输出头复用主干上下文,不再运行第二套完整主干。

The dependency layer uses the sampled coarse embedding as a query into historical hidden states. This lets the fine head retrieve context conditioned on the selected coarse state, while reusing one backbone pass. Concatenating a coarse embedding with the last hidden state would be a simpler alternative; this cross-attention layer is a particular implementation of conditioning, not the only one implied by the chain rule.条件依赖层把采样到的粗 embedding 当作 Query,查询历史隐藏状态,让细输出头按已经选择的粗状态提取上下文,同时复用一次主干计算。把粗 embedding 与最后的隐藏状态直接拼接,是更简单的备选实现;交叉注意力是实现条件化的一种选择,概率链式法则并不唯一要求这一层。

Training introduces another mismatch: at inference the fine head receives a model-chosen coarse ID, which may be wrong. Feeding only perfect coarse targets during training would leave that situation unseen. The current script therefore samples the coarse condition from detached logits; both cross-entropies still target the true next IDs. Earlier bars remain real encoded observations, shifted by one position for next-bar supervision.训练还要面对一种错配:推理时,细头收到的是模型选出的粗编号,可能有误;若训练时只给正确粗编号,这种情形就没有被见过。当前脚本因此从停止梯度的 logits 中采样粗条件,两个交叉熵仍以真实下一编号为目标。此前各根 K 线依旧使用真实观测的编码,通过错开一个位置完成下一根监督。

# Fragment: a, b are encoded [B, N] streams; stamps is [B, N, 5].
# The tokenizer is frozen. Keep the predictor in training mode here.
import torch.nn.functional as F
model.train()
logits_a, logits_b = model(a[:, :-1], b[:, :-1], stamp=stamps[:, :-1])
# Both logits have shape [B, N-1, 1024].
loss_a = F.cross_entropy(logits_a.reshape(-1, 1024), a[:, 1:].reshape(-1))
loss_b = F.cross_entropy(logits_b.reshape(-1, 1024), b[:, 1:].reshape(-1))
loss = (loss_a + loss_b) / 2

There are two distinct forms of conditioning here: earlier bars in the training context are real encoded observations; the current bar’s coarse sibling is model-sampled. Its fine-token loss is therefore conditioned on a sampled coarse ID, rather than the exact teacher-forced joint negative log-likelihood. This exposes the fine head to imperfect coarse choices, but it does not eliminate the train–inference mismatch created when an entire future history consists of generated bars.这里要分清两层条件:训练上下文里的此前 K 线仍是真实观测的编码,而当前待预测 K 线的粗 token 来自模型采样。因此,细 token 损失是在采样粗编号的条件下计算的,并不等同于严格 teacher-forced 的联合负对数似然。它让细 token 输出头见到有误差的粗选择,却没有消除“推理时整段未来历史逐渐变成模型自身输出”所带来的训练与推理差异。

Source: forward, sampled sibling and decode_s1/decode_s2源码:forward、同级 token 采样与两步解码

Source: dependency attention and dual heads源码:条件依赖注意力与双输出头

Source: shifted targets and forecasting loss源码:移位目标与预测损失

Path generation and sampling limits路径生成与采样边界

Autoregression specifies temporal dependence through a sequence of one-step conditional distributions. Each generated bar becomes context for later bars, so a sampled rise, decline or activity change can affect the rest of that path. This makes pathwise return and risk statistics available in principle. A shared generator and variable horizon are useful properties for research, but the implied dependence still requires validation against observed sequences.自回归用一系列下一步条件分布表示时间依赖。每根生成的 K 线进入后续上下文,使已经采样到的上涨、下跌或成交变化能够影响余下路径。研究上可据此计算逐路径的收益和风险统计量,并在不同预测长度下复用生成器;路径依赖是否符合实际序列,仍需验证。

The cost is serial generation and feedback from model errors into later context. A one-shot multi-horizon model can reduce sequential latency and can also be designed to model dependencies; it is not inherently incapable of joint prediction. Kronos chooses a reusable next-step generator. Its paper’s AR ablation does not establish that this choice beats every one-shot method, and the public wrapper has a separate final-decode horizon limit described below.代价是串行生成,以及误差进入后续上下文后继续传播。一次输出多步的模型可以减少串行延迟,也可以设计成保留联合依赖,不能断言它天然做不到联合预测。Kronos 选择的是可重复调用的下一步生成器;论文的自回归消融没有证明它优于所有一次性多步方案,公开接口还存在下文的最终解码长度限制。

A rollout begins by encoding the history. Each step runs the backbone on the current token window, samples one coarse ID, samples one fine ID conditioned on it, and appends the pair. When the window is full, it drops the oldest pair. The implementation recomputes the window each step; this path does not implement a KV cache.生成从编码历史开始。每一步都对当前 token 窗口运行主干,先采样一个粗编号,再根据它采样细编号,然后把这一对追加到末尾。窗口满了就丢掉最早的一对。当前路径每一步都会重新计算窗口,没有实现 KV cache。

history = tokenizer.encode(normalized_x, half=True)
for step in range(H):
    context = history.last(M)
    coarse_logits, hidden = model.decode_s1(context)
    a_new = sample(coarse_logits[:, -1], temperature, top_k, top_p)
    fine_logits = model.decode_s2(hidden, a_new)
    b_new = sample(fine_logits[:, -1], temperature, top_k, top_p)
    history.append(a_new, b_new)
# Actual implementation decodes only the last M pairs.
paths = tokenizer.decode(history.last(M), half=True)
forecast = paths.mean_over_samples().last(H)

Temperature rescales logits before softmax. Lower temperature concentrates probability; it does not certify greater accuracy. Top-k keeps k candidates; top-p retains a probability-mass prefix. In this revision, a positive top_k returns from the filter immediately, so top_k and top_p are alternatives rather than sequential filters.temperature 在 softmax 前缩放 logits。较低温度让概率更集中,但不等于准确率更高。top-k 保留 k 个候选,top-p 保留累计概率达到阈值的一组候选。本版本过滤函数在 top_k 大于零时直接返回,所以 top-k 与 top-p 并不会依次叠加执行。

The final decoder sees at most M token pairs. Although token generation rolls its context, pred_len > max_context cannot produce the requested number of final decoded rows through this wrapper. Keep H ≤ M. Also cap the supplied history deliberately: normalization and tokenizer encoding occur before the predictor’s context truncation.最终解码器最多接收 M 对 token。虽然生成过程会滚动窗口,但通过这个包装接口使用 pred_len > max_context,无法返回要求数量的解码行,因此应保持 H ≤ M。历史长度也应主动限定,因为归一化与 tokenizer 编码发生在预测主干截断上下文之前。

Future timestamps deserve the same care. At the first step the model receives only historical timestamps. A future timestamp enters the context after its corresponding token has been generated. Supplying y_timestamp therefore does not mean the first future calendar embedding directly conditions the first predicted bar.未来时间戳也有细节:第一步只使用历史时间戳;某个未来时间戳是在对应 token 已经生成、加入上下文后才进入模型。因此,传入 y_timestamp 不等于“第一根未来 K 线在生成前已直接接收自身的日历 embedding”。

Source: sampling, rolling buffers, final decode and sample mean源码:采样、滚动缓冲区、最终解码与路径均值

When sample_count = S, the code generates S paths, decodes them, and averages continuous features. It does not average IDs. This returns us to the earlier two-path example: averaging the two possible paths would again produce the flat line. That is useful when the desired result is a point estimate. For volatility, tail events or intervals, retain individual paths and compute the corresponding statistic before aggregation. More samples reduce Monte Carlo variability, not model bias; calibrated uncertainty still needs held-out testing.sample_count = S 时,代码生成 S 条路径,解码后平均连续特征,不对编号取平均。这又回到了前文的双路径例子:两条路径平均后,仍会得到平坦曲线。如果任务需要点估计,这样做有意义;若要研究波动、尾部事件或区间,就应保留单条路径,先计算对应统计量再汇总。更多样本降低的是蒙特卡洛波动,不会消除模型偏差;区间是否校准仍要用留出数据检验。

Implementation audit: leakage and validation masks实现审计:泄漏与验证掩码

A source audit should precede empirical conclusions. A released checkpoint, a fine-tuning example and the paper’s full experiment pipeline are different artifacts. This revision provides checkpoints and example training paths, but running them does not independently verify the paper’s data preparation, split construction or transaction assumptions. The following findings concern the inspected implementation paths.实证结论之前需要完成实现审计。发布的 checkpoint、微调示例与论文完整实验流程,是不同的研究材料。当前版本提供权重和训练示例,但运行它们不会独立验证论文的数据准备、切分方式或交易假设。下表记录本次检查到的具体实现路径。

Path路径Observed implementation已核对的实现Consequence影响
Public inference公开推理Mean/std from the supplied history.均值、标准差来自本次传入的历史。Keep the horizon outside preprocessing statistics.预测区间不得进入预处理统计。
Qlib fine-tuningQlib 微调Statistics use the first L rows; loss covers every shifted position of L + H + 1 rows.统计使用前 L 行;L + H + 1 行构成的所有移位位置都参与损失。A past-only normalization origin does not make all earlier token-loss positions strictly causal. Context and forecast evaluation need separate masks.相对预测起点仅使用历史,不代表更早的每个 token 损失位置都严格因果;上下文和预测评估需要分别设置掩码。
CSV fine-tuningCSV 微调Statistics use the entire L + H + 1 window, including targets.统计覆盖完整 L + H + 1 窗口,包含目标。Future scale information can enter the input; validation loss is not a past-only rollout evaluation.未来尺度信息可能进入输入,验证损失不能当作仅依据历史的滚动预测评估。
Checked-in splits仓库默认切分CSV YAML has test_ratio = 0. Qlib dates overlap and token loss has no context-only exclusion mask.CSV YAML 的 test_ratio = 0;Qlib 日期有重叠,token 损失没有排除仅供上下文的重叠位置。Define held-out targets and mask context overlap before claiming out-of-sample results.宣称样本外结果前,先划定独立测试目标,并屏蔽只供上下文的重叠位置。

These observations concern this source revision and its example paths. They do not establish how the authors assembled every paper experiment. The practical fix is specific: fit normalization at each forecast origin using only available history, select settings on validation data, and score free-running forecasts on untouched future targets. A chronological file split alone is insufficient.这些发现针对本次固定版本及其示例路径,不足以断言作者所有论文实验的具体执行方式。工程上的修正很明确:在每个预测起点只用当时可见历史拟合归一化参数,用验证集选择设置,再对未触碰的未来目标评估自由生成结果。只按时间切分文件还不够。

Source: Qlib normalization window源码:Qlib 归一化范围

Source: CSV normalization window源码:CSV 归一化范围

Source: Qlib split dates源码:Qlib 切分日期

Source: CSV split configuration源码:CSV 切分配置

One more validation trap: dependency cross-attention uses is_causal=self.training. Disabling its mask is appropriate when a single next-token query attends only to known context. But in evaluation mode, passing an entire ground-truth sequence at once lets an earlier fine-token query attend to later hidden states. With fixed sibling queries and dropout disabled, the tiny-model check below reproduced this dependency. Use free-running rollouts, or explicitly fix the validation mask before interpreting whole-sequence fine-token loss as causal performance. This source finding does not establish which path produced the paper results.验证时还有一个掩码陷阱:条件交叉注意力使用 is_causal=self.training。只有一个下一 token 查询、Key 全是已知上下文时,关闭掩码是合理的;但若在 eval 模式下一次传入完整真实序列,较早的细 token 查询就能看到较晚的隐藏状态。下方小模型检查固定了同级查询并关闭 dropout,复现了这种依赖。应使用自由生成的滚动评估,或先明确修正验证掩码,再把整段细 token 损失解释为因果预测表现。这项源码发现不能证明论文结果使用了哪条路径。

Checkpoint and tokenizer pairing权重与 tokenizer 配对

Predictor预测模型Layers / width / parameters层数/宽度/参数量Context / tokenizer上下文/tokenizer
Kronos-mini4 / 256 / 4.1M2048 / Tokenizer-2k
Kronos-small8 / 512 / 24.7M512 / Tokenizer-base
Kronos-base12 / 832 / 102.3M512 / Tokenizer-base
Kronos-large499.2M · paper model499.2M · 论文模型No public weights in this release table.本次发布表未提供公开权重。

Counts above refer to the autoregressive predictor; the tokenizer is a separate network. Both published tokenizer configurations encode six features into 10 + 10 bits, with hidden width 256. The configuration says four encoder/decoder layers, but the constructor builds n_layers − 1 Transformer blocks: three on each side. For a first engineering check, small plus Tokenizer-base is a reasonable starting point. Mini trades model capacity for a longer released context; that alone does not make it more accurate.上述参数量属于自回归预测器,tokenizer 是另一套网络。两份已发布 tokenizer 配置都把六个特征编码成 10 + 10 bit,隐藏宽度为 256。配置文件写四层,但构造器实际创建 n_layers − 1 个 Transformer block,即编码、解码各三层。初次验证可以从 small + Tokenizer-base 开始;mini 提供更长的发布上下文,但不能仅凭这一点判定更准确。

The tokenizer and predictor form a learned interface. If a newly trained tokenizer changes the meaning of IDs, retaining an old predictor unchanged is generally inconsistent even when tensor shapes still match. Match their training lineage as well as vocabulary size, and pin code, tokenizer and predictor revisions separately.tokenizer 与预测器之间是一个学习得到的接口。如果重新训练 tokenizer 改变了编号含义,即使张量形状仍相同,直接沿用旧预测器通常也不一致。除了词表大小,还要匹配训练来源,并分别固定代码、tokenizer 与预测器版本。

Release table and checkpoint pairings发布列表与权重配对

Small configuration · Mini configuration · Tokenizer-base configurationSmall 配置 · Mini 配置 · Tokenizer-base 配置

A reproducible inference example可复现的推理示例

Use Python 3.10 or later in an isolated environment. The commands below check out the reviewed source. The repository requirements are not a complete environment lock: select a PyTorch build suitable for your CPU/CUDA environment and record its exact version. The example below uses CPU and the revisions pinned by the upstream regression test.使用 Python 3.10 或以上版本,并创建隔离环境。下面的命令检出已核对的源码。仓库 requirements 不是完整环境锁文件,应选择适合本机 CPU/CUDA 的 PyTorch 构建并记录准确版本。下方示例使用 CPU,权重版本沿用上游回归测试固定的版本。

git clone https://github.com/shiyu-coder/Kronos.git
cd Kronos
git checkout 67b630e67f6a18c9e9be918d9b4337c960db1e9a
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt

Create history.csv with timestamps and all six columns, containing one instrument’s completed bars. Create future.csv with only a timestamps column, taken from that market’s next valid trading intervals. Keep both in the same timezone convention. This avoids accidentally reading future prices while constructing the model input.准备 history.csv:包含 timestamps 与全部六列,记录单一标的已经结束的 K 线。再准备只有 timestamps 列的 future.csv,列出该市场接下来有效的交易时间区间;两者采用相同时区约定。这样组织输入,可以避免在准备预测时间时误读未来价格。

import numpy as np
import pandas as pd
import torch
from model import Kronos, KronosTokenizer, KronosPredictor

cols = ["open", "high", "low", "close", "volume", "amount"]
M, lookback, horizon = 512, 400, 60
hist = pd.read_csv("history.csv", parse_dates=["timestamps"])
future = pd.read_csv("future.csv", parse_dates=["timestamps"])
assert 1 <= lookback <= M and 1 <= horizon <= M
assert len(hist) >= lookback and len(future) >= horizon
hist = hist.tail(lookback).reset_index(drop=True)
xs = hist["timestamps"]
ys = future["timestamps"].iloc[:horizon].reset_index(drop=True)
for stamps in (xs, ys):
    assert stamps.notna().all()
    assert stamps.is_monotonic_increasing and stamps.is_unique
assert ys.iloc[0] > xs.iloc[-1]
x = hist[cols].astype(float)
assert np.isfinite(x.to_numpy()).all()
assert (x["high"] >= x[["open", "close", "low"]].max(axis=1)).all()
assert (x["low"] <= x[["open", "close", "high"]].min(axis=1)).all()
assert (x[["volume", "amount"]] >= 0).all().all()

torch.manual_seed(123)
tokenizer = KronosTokenizer.from_pretrained(
    "NeoQuasar/Kronos-Tokenizer-base",
    revision="0e0117387f39004a9016484a186a908917e22426",
).eval()
model = Kronos.from_pretrained(
    "NeoQuasar/Kronos-small",
    revision="901c26c1332695a2a8f243eb2f37243a37bea320",
).eval()
predictor = KronosPredictor(model, tokenizer, device="cpu", max_context=M)
pred = predictor.predict(
    df=x, x_timestamp=xs, y_timestamp=ys, pred_len=horizon,
    T=1.0, top_k=0, top_p=0.9, sample_count=1, verbose=False,
)
assert pred.shape == (horizon, 6)
assert np.isfinite(pred.to_numpy()).all()
valid = (
    (pred["high"] >= pred[["open", "close", "low"]].max(axis=1))
    & (pred["low"] <= pred[["open", "close", "high"]].min(axis=1))
    & (pred[["volume", "amount"]] >= 0).all(axis=1)
)
print("OHLC/activity validity:", float(valid.mean()))
print(pred.head())
pred.to_csv("forecast.csv")

Download the inference example下载完整推理示例

Explicit .eval() calls are essential. KronosPredictor moves modules to a device but does not change their mode. Besides dropout, the dependency attention mask depends on training mode. no_grad() only disables gradient recording; it does not replace eval(). A random seed controls this example’s sampling stream, not cross-device bitwise reproducibility.显式调用 .eval() 很重要:KronosPredictor 只把模块移到指定设备,没有切换运行模式。除了 dropout,条件依赖注意力的掩码也受训练模式影响。no_grad() 只关闭梯度记录,不能替代 eval()。随机种子控制本例的采样序列,不保证不同设备逐 bit 一致。

The decoder has an unconstrained linear output head. It does not guarantee high ≥ open/close, low ≤ open/close, or nonnegative activity. The validity check above reports violations instead of silently repairing them. If your application requires positive prices, check that separately; any projection or clipping of outputs changes the model being evaluated.解码器最后是无约束的线性输出头,不保证最高价不低于开收盘价、最低价不高于开收盘价,也不保证交易量非负。上面的合法率检查选择报告问题,而不是悄悄修补。如果应用要求价格严格为正,也应另行检查;对输出投影或截断,会改变被评估的模型。

For uncertainty analysis, retain repeated calls with sample_count=1, then compute pathwise quantities and interval coverage. Do not label a sample quantile a calibrated prediction interval without held-out coverage checks. CPU inference can be slow for a long horizon; benchmark the actual context, horizon and sample count you intend to deploy.分析不确定性时,可以保留多次 sample_count=1 调用的结果,再计算逐路径统计量与区间覆盖率。未经独立测试集覆盖率校验,不应把采样分位数称为已校准的预测区间。长预测区间的 CPU 推理可能较慢,应按实际准备部署的上下文、预测长度与路径数测量成本。

Source: upstream pinned regression setup源码:上游固定版本的回归测试设置

Source map and verification scope源码入口与验证范围

Entry入口What to inspect重点看什么
KronosPredictor.predictInput columns, historical statistics, inverse transform.输入列、历史统计量与反归一化。
KronosTokenizerCausal encoder, two reconstruction branches, encode/decode.因果编码器、两条重建路径与 encode/decode。
BSQuantizerSpherical signs, bit weights, straight-through and entropy terms.球面符号、位权、直通估计与熵项。
Kronos.forwardPair embedding, first head, sampled sibling, second head.成对 embedding、第一个输出头、同级采样与第二个输出头。
auto_regressive_inferenceContext roll, timestamps, final truncation and sample averaging.滚动上下文、时间对齐、最终截断与采样平均。
finetune/Dataset normalization, shifted labels, training/validation masks.数据集归一化、移位标签与训练/验证掩码。

Verification boundary: this article reviews pinned sources and uses original explanatory diagrams. The full pretrained inference example requires downloaded weights and user-supplied data; it is not presented as a measured forecast. The mechanics check uses tiny random-weight networks, not pretrained forecasting: all 16 four-bit pairs round-trip; changing the tokenizer input suffix while holding its preprocessed prefix fixed leaves the encoded prefix unchanged; the train/eval mask difference and H > M output mismatch are reproduced. Recorded results: Python 3.12.14, PyTorch 2.10.0+cpu, seed 20261026. The complete inference example above has been syntax-checked, but no pretrained forecast or financial benchmark was run for this article.验证范围:本文核对固定版本源码,并使用原创解释图。完整预训练推理示例需要下载权重和读者准备的数据,不作为实测预测展示。机制检查脚本使用随机权重的小型网络:全部 16 种四 bit 组合往返一致,保持预处理后的输入前缀不变、只修改 tokenizer 输入后缀时,编码前缀不变,并复现了 train/eval 掩码差异和 H > M 的输出长度不匹配。检查记录对应 Python 3.12.14、PyTorch 2.10.0+cpu、种子 20261026。上面的完整推理示例通过语法检查,但本文没有运行预训练预测或金融性能基准。