用大模型动态解决系统间接口不兼容问题,提升分布式系统互通性。
SAGAI-MID: A Generative AI-Driven Middleware for Dynamic Runtime Interoperability
- 基于大模型的五层架构,实时检测并修复接口模式差异。
- 最佳配置在10个场景中达90%准确率,生成代码策略优于直接转换。
- 适合关注AI驱动系统集成的开发者与架构师参考。
现代分布式系统集成异构服务,包括不同版本的REST API、GraphQL端点及使用专有数据格式的物联网设备,长期存在接口模式不匹配问题。传统静态适配器需为每对模式手动编码,无法处理运行时新组合。本文提出SAGAI-MID,一个基于FastAPI的中间件,利用大语言模型(LLMs)在运行时动态检测并解决模式不匹配。系统采用五层流水线:混合检测(结构差异+大模型语义分析)、双策略解析(按请求转换与生成可复用适配代码)、三重安全机制(验证、集成投票、规则回退)。通过Bass等人的互操作性策略框架,将设计阶段的规范转化为运行时能力。在涵盖REST版本迁移、物联网到分析平台桥接、跨GraphQL协议转换的10个场景中评估,使用来自两家提供商的6个大模型。最优配置实现0.90 pass@1准确率;CODEGEN策略平均优于DIRECT(0.83 vs 0.77),且模型成本相差超30倍,但最高准确率模型反而最便宜。讨论了将大模型作为运行时架构组件对软件架构设计的影响。
原文摘要 · Abstract (English)
Modern distributed systems integrate heterogeneous services, REST APIs with different schema versions, GraphQL endpoints, and IoT devices with proprietary payloads that suffer from persistent schema mismatches. Traditional static adapters require manual coding for every schema pair and cannot handle novel combinations at runtime. We present SAGAI-MID, a FastAPI-based middleware that uses large language models (LLMs) to dynamically detect and resolve schema mismatches at runtime. The system employs a five-layer pipeline: hybrid detection (structural diff plus LLM semantic analysis), dual resolution strategies (per-request LLM transformation and LLM-generated reusable adapter code), and a three-tier safeguard stack (validation, ensemble voting, rule-based fallback). We frame the architecture through Bass et al.'s interoperability tactics, transforming them from design-time artifacts into runtime capabilities. We evaluate SAGAI-MID on 10 interoperability scenarios spanning REST version migration, IoT-to-analytics bridging, and GraphQL protocol conversion across six LLMs from two providers. The best-performing configuration achieves 0.90 pass@1 accuracy. The CODEGEN strategy consistently outperforms DIRECT (0.83 vs 0.77 mean pass@1), while cost varies by over 30x across models with no proportional accuracy gain; the most accurate model is also the cheapest. We discuss implications for software architects adopting LLMs as runtime architectural components.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。