Third-party Python libraries introduce dependency management overhead, supply chain risk, and deployment friction in constrained environments. A natural question is how much of this ecosystem can be replicated using only Python's standard library -- and at what correctness and performance cost. We address this empirically through zerodep, a growing collection of single-file Python modules, each a stdlib-only reimplementation of a popular third-party library, developed with LLM assistance under strict constraints: no external imports, single file, drop-in API compatibility, and mandatory correctness validation against the reference library. Spanning over 40 modules across 12 categories -- including serialization, networking, cryptography, agent protocols, and text processing -- zerodep provides a controlled testbed for two interrelated questions: (1) Where does the stdlib suffice? and (2) Can LLMs effectively generate correct, performant code under tight symbolic constraints? Systematic benchmarking shows that stdlib-only implementations achieve performance parity (within 2x of the reference) in the majority of cases. The primary performance cliff is C-extension-backed computation (image processing, binary serialization, low-level crypto), not the inherent overhead of pure-Python third-party libraries. Conversely, many widely-used libraries carry architectural overhead that LLM-generated stdlib reimplementations avoid, yielding 5--115x speedups in several categories. We characterize the stdlib capability boundary across complexity tiers and library categories, discuss where LLM-assisted development succeeds and where it requires iterative human correction, and examine implications for dependency-free software engineering at scale. zerodep is open-source at https://github.com/Oaklight/zerodep.


翻译:第三方Python库在受限环境中会引入依赖管理开销、供应链风险以及部署摩擦问题。一个自然的问题是:在仅使用Python标准库的情况下,能在多大程度上复现这些生态功能——同时需要付出多大的正确性与性能代价?我们通过zerodep项目对此进行实证研究。该项目是一个持续扩展的单文件Python模块集,每个模块都是在LLM辅助下、在严格约束下(无外部导入、单个文件、即插即用的API兼容性、对参考库进行强制性正确性验证)对流行第三方库的标准库纯重写。涵盖序列化、网络通信、密码学、智能体协议和文本处理等12大类的40余个模块,zerodep为两个相互关联的问题提供了受控测试平台:(1)标准库在哪些场景中已足够?(2)LLM能否在严格的符号约束下有效生成正确且高性能的代码?系统性基准测试表明,在多数情况下,纯标准库实现能达到与参考库的性能相当(偏差在2倍以内)。主要的性能瓶颈出现在基于C扩展的计算场景(图像处理、二进制序列化、底层密码学),而非纯Python第三方库的固有开销。相反,许多广泛使用的库存在架构性开销,而LLM生成的标准库重写版本能规避这些开销,在多个类别中实现5-115倍的加速。我们按复杂性层级和库类别刻画了标准库的能力边界,分析了LLM辅助开发在何种场景下成功、哪些环节需要人工迭代修正,并探讨了对大规模无依赖软件工程的启示。zerodep为开源项目,地址:https://github.com/Oaklight/zerodep。

0
下载
关闭预览

相关内容

【新书】《实用规范分析:使用Python优化决策制定》
专知会员服务
31+阅读 · 2024年11月23日
【2023新书】快速Python:大数据集的高性能技术, 304页pdf
专知会员服务
83+阅读 · 2023年7月31日
专知会员服务
92+阅读 · 2021年4月12日
吐血整理!140种Python标准库、第三方库和外部工具都有了
炼数成金订阅号
16+阅读 · 2019年7月30日
手把手教你用Python实现“坦克大战”,附详细代码!
机器学习算法与Python学习
12+阅读 · 2019年6月8日
一个牛逼的 Python 调试工具
机器学习算法与Python学习
15+阅读 · 2019年4月30日
Python 3 尴尬了这么久,终于有救了
AI100
13+阅读 · 2017年11月18日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
13+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
4+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
7+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
4+阅读 · 6月17日
相关VIP内容
【新书】《实用规范分析:使用Python优化决策制定》
专知会员服务
31+阅读 · 2024年11月23日
【2023新书】快速Python:大数据集的高性能技术, 304页pdf
专知会员服务
83+阅读 · 2023年7月31日
专知会员服务
92+阅读 · 2021年4月12日
相关资讯
吐血整理!140种Python标准库、第三方库和外部工具都有了
炼数成金订阅号
16+阅读 · 2019年7月30日
手把手教你用Python实现“坦克大战”,附详细代码!
机器学习算法与Python学习
12+阅读 · 2019年6月8日
一个牛逼的 Python 调试工具
机器学习算法与Python学习
15+阅读 · 2019年4月30日
Python 3 尴尬了这么久,终于有救了
AI100
13+阅读 · 2017年11月18日
相关基金
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
13+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
7+阅读 · 2015年12月31日
国家自然科学基金
6+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员