TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Do you think Python will disappear for LLM inference?

2 点作者 astronautas5 个月前
For non-LLMs, we have a high variety of frameworks with Python interfaces for running models, often built to call C bindings. This makes it impractical to run models directly from languages like Rust—you’d need to implement an idiomatic layer for each model runtime, something already done for Python. Nvidia&#x27;s Triton covers a lot, but is it even designed for embedded use? And how feasible is adding custom logic?<p>For LLMs, it feels like the opposite. There’s a smaller set of frameworks (e.g., llama.cpp, vllm), each supporting a wide range of models. This makes it relatively straightforward to integrate them into other languages like Go, as you only need to maintain a few idiomatic layers.<p>To me, it’s a no-brainer that Go or Rust will replace Python for serving LLMs. They’re CPU-intensive, Python is generally slow, and the limited number of LLM runtimes simplifies the transition.

4 条评论

dragonwriter5 个月前
On the main question, I don’t think Python will disappear for LLM inference <i>soon</i>. But I think there are two processes that will determine the longer term process, as AI inference gets built into more things:<p>(1) Python’s dominance in AI inference is driving, and will continue to drive, more investment in improving Python for lots of things that it isn’t great at right now that people want to do a long with AI inference. We’ve actually seen a lot of that over the last few years, with physics engines and robotics simulation platforms for Python, some of which are Python bindings for existing libraries written in other languages, but some of which are built in Python (e.g., via Taichi or Numba, both of which can produce and execute GPU kernels from Python code, and the latter of which can JIT and parallelize (mostly numeric) Python code on CPU, as well.) This will also include investment in Python’s core and standard library to address pain points.<p>(2) The increasing importance of AI inference will at the same time drive more investment in AI inference libraries for non-Python platforms.<p>The relative balance between the progress of those two efforts will be a big factor in how much Python is used in inference going forward, for AI in general, and for LLM’s in particular.
PaulHoule5 个月前
The summer BERT came out I worked at a company that had models not so good as we have today. I was working on the framework for model training that was Python based but we would pack up Tensorflow models and these would be run inside Scala and made available via a web service.<p>My guess is the CPU overhead of Python is not significant compared to running an LLM but Python has limited facilities for dealing with concurrency. For a while I was into writing asyncio web servers but I eventually found workloads (an image sorter running the wrong way on an ADSL connection: one process is thinking hard for 2sec, meanwhile images are not downloading) that would tie them into knots. gunicorn and celery and similar things can handle parallelism with multiple processes but if you have a 1GB model you will terribly waste memory.<p>In Java on the other hand you can have a 1GB model and it is shared by the threads and there is <i>no drama</i>.<p>I wrote a chess program in Python that was good enough to beat my tester a few times last month and have been wanting to take it to a chess club but my tester tells me it needs to respect time control for that. Also I&#x27;d like to support a protocol like XBoard or UCI. Either way it is necessary that the comms thread can interrupt the thinking thread and that&#x27;s dead easy to do in Java and a huge hassle in Python.<p>Sure there are threads in Python and if I wanted to screw around with alpha software there is the no-GIL Python but remember this: when you&#x27;re doing a project which has a high-risk or research component it&#x27;s a bad time to pick tools that require you to learn things. If you are good at Rust or Go I&#x27;d say go with that. But don&#x27;t pick up a language because you heard somebody else thinks it cool. A lot of people are running big and complex apps on Java but you don&#x27;t hear about it so much.
评论 #42587041 未加载
talldayo5 个月前
No, it won&#x27;t. Python is a scripting language that is more composable than Go or Rust and can even be optimized for inference just as well, at least in theory. LLM inference doesn&#x27;t necessitate a strong type system which actually gives Python a bit of an advantage for less complex programs.<p>The only places where Go and Rust take the lead is optimizing the <i>non-AI</i> code that you write. That&#x27;s still a valuable advantage, but it&#x27;s not going to displace the use case for Python on it&#x27;s own.
评论 #42586842 未加载
franktankbank5 个月前
The intensive code is not running python, your assumptions are bad.
评论 #42587210 未加载