一句话:人工研究 360 个使用 ML 云 API 的开源应用,发现 70% 存在误用,归纳出 8 类反模式并实现自动检查器。
机器学习(ML)云 API 让开发者能够方便地把学习能力集成进软件系统,但这类 API 语义独特、对数据有特殊要求,并涉及精度与性能之间的权衡,因此难以被正确、高效地使用。已有工作多聚焦于如何设计 ML API 或云服务,而缺少对开源应用实际使用方式的实证研究。本文人工分析了 360 个使用 Google 或 AWS 云 ML API 的代表性开源应用,发现其中 70% 在其最新版本中存在 API 误用,损害了软件的功能质量、性能或经济性。作者据此归纳出 8 类反模式,并实现了相应的自动检查器,在更大范围的应用集合上又识别出数百个存在 ML API 误用的应用,表明该问题普遍存在且可通过自动化手段检测。
Machine learning (ML) cloud APIs enable developers to easily incorporate learning solutions into software systems. Unfortunately, ML APIs are challenging to use correctly and efficiently, given their unique semantics, data requirements, and accuracy-performance tradeoffs. Much prior work has studied how to develop ML APIs or ML cloud services, but not how open-source applications are using ML APIs. In this paper, we manually studied 360 representative open-source applications that use Google or AWS cloud-based ML APIs, and found 70% of these applications contain API misuses in their latest versions that degrade functional, performance, or economical quality of the software. We have generalized 8 anti-patterns based on our manual study and developed automated checkers that identify hundreds of more applications that contain ML API misuses.