[论文解读] Did the Model Change? Efficiently Assessing Machine Learning API Shifts
本文提出 MA-SAM,一种新颖的自适应采样算法,通过估计混淆矩阵的变化,高效检测并量化机器学习 API 预测随时间的变化。通过根据预测的不确定性动态采样数据点,MA-SAM 将 API 调用成本降低了高达 90%,同时估计误差比均匀采样低一个数量级,从而实现在生产系统中成本效益高且精确的模型漂移监控。
Machine learning (ML) prediction APIs are increasingly widely used. An ML API can change over time due to model updates or retraining. This presents a key challenge in the usage of the API because it is often not clear to the user if and how the ML model has changed. Model shifts can affect downstream application performance and also create oversight issues (e.g. if consistency is desired). In this paper, we initiate a systematic investigation of ML API shifts. We first quantify the performance shifts from 2020 to 2021 of popular ML APIs from Google, Microsoft, Amazon, and others on a variety of datasets. We identified significant model shifts in 12 out of 36 cases we investigated. Interestingly, we found several datasets where the API's predictions became significantly worse over time. This motivated us to formulate the API shift assessment problem at a more fine-grained level as estimating how the API model's confusion matrix changes over time when the data distribution is constant. Monitoring confusion matrix shifts using standard random sampling can require a large number of samples, which is expensive as each API call costs a fee. We propose a principled adaptive sampling algorithm, MASA, to efficiently estimate confusion matrix shifts. MASA can accurately estimate the confusion matrix shifts in commercial ML APIs using up to 90% fewer samples compared to random sampling. This work establishes ML API shifts as an important problem to study and provides a cost-effective approach to monitor such shifts.
研究动机与目标
- 识别并量化第三方 ML API 随时间推移的显著性能变化,这些变化往往未被察觉,但会影响下游应用。
- 解决通过标准随机采样监控 ML API 性能的高昂成本问题,该方法需要大量昂贵的 API 调用。
- 开发一种轻量级、自适应的采样策略,在大幅降低计算和财务成本的同时保持高估计精度。
- 为生产团队提供一种实用且成本效益高的解决方案,以在不牺牲精度的前提下实时监控真实世界 ML API 中的模型漂移。
- 将 API 漂移检测形式化为在固定样本预算下的混淆矩阵变化估计问题。
提出的方法
- MA-SAM 使用自适应采样,优先选择对估计混淆矩阵漂移最具信息量的数据点,重点关注预测不确定或影响重大的样本。
- 它对数据集进行聚类,并根据模型预测的不确定性,自适应地从每个聚类中采样,从而降低漂移估计的方差。
- 该算法使用置信区间方法自动调整每个聚类的采样率,以在准确性和成本之间取得平衡。
- 它在高不确定性区域采用超采样策略,以提高最可能发生漂移区域的估计精度。
- MA-SAM 利用估计误差的理论上限,确保在样本量受限条件下仍能保持可靠性能。
- 该方法设计轻量且与真实世界 ML API 兼容,对现有监控流水线的改动极小。
实验结果
研究问题
- RQ1ML API 在多长时间内会发生显著性能漂移?这些漂移如何影响下游应用?
- RQ2使用标准均匀采样监控模型漂移的成本是多少?是否可以在不牺牲精度的前提下降低该成本?
- RQ3自适应采样策略是否能在更少的 API 调用下,优于均匀采样来估计混淆矩阵漂移?
- RQ4在相同的样本预算下,自适应采样与均匀采样的估计误差相比如何?
- RQ5自适应采样在保持可接受的估计误差的前提下,最多能将所需 API 调用次数减少多少?
主要发现
- 研究在 2020 至 2021 年间识别出 36 个 ML API 和数据集组合中的 12 个存在显著模型漂移,其中多个案例的性能下降超过 1%。
- 在某一案例中,IBM 的语音识别 API 从 2020 年 3 月到 2021 年 3 月整体准确率下降了 7%,主要原因是将 'four' 错误分类为 'five'。
- 与均匀采样相比,MA-SAM 将所需的 API 调用次数最多减少了 90%,同时估计误差降低了整整一个数量级。
- 平均而言,对于相同样本量,MA-SAM 的估计误差比均匀采样低一到两个数量级。
- 在给定预算下,MA-SAM 在大多数实际测试的 API(包括 Google、Microsoft 和 Amazon 的 API)中,将估计误差降低了超过 50%。
- 该方法保持了高可靠性与低计算成本,使其适用于生产环境中的持续监控。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。