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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: MonkeyPatch – Cheap, fast and predictable LLM functions in Python

95 点作者 JackHopkins超过 1 年前
Hi HN, Jack here! I&#x27;m one of the creators of MonkeyPatch, an easy tool that helps you build LLM-powered functions and apps that get cheaper and faster the more you use them.<p>For example, if you need to classify PDFs, extract product feedback from tweets, or auto-generate synthetic data, you can spin up an LLM-powered Python function in &lt;5 minutes to power your application. Unlike existing LLM clients, these functions generate well-typed outputs with guardrails to mitigate unexpected behavior.<p>After about 200-300 calls, these functions will begin to get cheaper and faster. We&#x27;ve seen 8-10x reduction in cost and latency in some use-cases! This happens via progressive knowledge distillation - MonkeyPatch incrementally fine-tunes smaller, cheaper models in the background, tests them against the constraints defined by the developer, and retains the smallest model that meets accuracy requirements, which typically has significantly lower costs and latency.<p>As an LLM researcher, I kept getting asked by startups and friends to build specific LLM features that they could embed into their applications. I realized that most developers have to either 1) use existing low-level LLM clients (GPT4&#x2F;Claude), which can be unreliable, untyped, and pricey, or 2) pore through LangChain documentation for days to build something.<p>We built MonkeyPatch to make it easy for developers to inject LLM-powered functions into their code and create tests to ensure they behave as intended. Our goal is to help developers easily build apps and functions without worrying about reliability, cost, and latency, while following best software engineering practices.<p>We&#x27;re only available in Python currently but actively working on a Typescript version. The repo has all the instructions you need to get up and running in a few minutes.<p>The world of LLMs is changing by the day and so we&#x27;re not 100% sure how MonkeyPatch will evolve. For now, I&#x27;m just excited to share what we&#x27;ve been working on with the HN community. Would love to know what you guys think!<p>Open-source repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;monkeypatch&#x2F;monkeypatch.py">https:&#x2F;&#x2F;github.com&#x2F;monkeypatch&#x2F;monkeypatch.py</a><p>Sample use-cases: <a href="https:&#x2F;&#x2F;github.com&#x2F;monkeypatch&#x2F;monkeypatch.py&#x2F;tree&#x2F;master&#x2F;examples">https:&#x2F;&#x2F;github.com&#x2F;monkeypatch&#x2F;monkeypatch.py&#x2F;tree&#x2F;master&#x2F;ex...</a><p>Benchmarks: <a href="https:&#x2F;&#x2F;github.com&#x2F;monkeypatch&#x2F;monkeypatch.py#scaling-and-finetuning">https:&#x2F;&#x2F;github.com&#x2F;monkeypatch&#x2F;monkeypatch.py#scaling-and-fi...</a>

20 条评论

p10jkle超过 1 年前
Nice! If I were to write a test for invariant aspects of the function (eg, it produces valid json), will the system guarantee that those invariants are fulfilled? I suppose naively you could just do this by calling over and over and &#x27;telling off&#x27; the model if it didn&#x27;t get it right
评论 #38279139 未加载
Scipio_Afri超过 1 年前
Can I use open source LLMs with this? Would be great if everything was available self hosted with open source models.
评论 #38285191 未加载
ipsum2超过 1 年前
This is like calling a python package &quot;ListComprehension&quot;, that loops through a list and calls OpenAI&#x27;s API on each item. Confusing and unproductive.
评论 #38286120 未加载
mitthrowaway2超过 1 年前
There seems to be a lot of (justified) concern about the name. Maybe call it LLMonkeyPatch?
评论 #38293519 未加载
评论 #38286670 未加载
评论 #38286638 未加载
m_vyas123超过 1 年前
Hey Jack! Thanks for sharing this. The incremental fine-tuning of smaller and cheaper models for cost reduction is definitely a really interesting differentiator. I had a few questions regarding the reliability of the LLM-powered functions MonkeyPatch facilitates and the testing process. How does MonkeyPatch ensure the reliability of LLM-powered functions it helps developers create, and do the tests employed provide sufficient confidence in maintaining consistent output? If tests fall short of 100% guarantee, how does MonkeyPatch address concerns similar to historical challenges faced with testing traditional LLMs? Thanks.
评论 #38286078 未加载
OJFord超过 1 年前
Why &#x27;Monkeypatch&#x27;, when it&#x27;s for Python, where that has an established and as far as I can tell (?) completely irrelevant meaning?
评论 #38284528 未加载
CyberDildonics超过 1 年前
MonkeyPatch is a specific programming term that people have been using for decades. What would posses someone to name a programming tool &quot;MonkeyPatch&quot; when the tool doesn&#x27;t even have something to do with patching?
评论 #38285220 未加载
sweetgiorni超过 1 年前
Slightly tangential: is it unfair&#x2F;unreasonable to judge a project by its name? It&#x27;s hard not to interpret this project&#x27;s name as the result of poor judgement. Is that sufficient cause to write off the project entirely? That may seem a tad dramatic but I feel that it&#x27;s a fairly strong signal for how little effort I need to put into evaluating it.
评论 #38288791 未加载
babyshake超过 1 年前
Not including &quot;pass&quot; in a function definition in Python makes the code not compilable, and if we&#x27;re using VSCode, PyCharm, etc. our IDEs will complain about this whenever the code is viewed. Is this an intentional design decision?
评论 #38286795 未加载
whoiskatrin超过 1 年前
Would love to try a typescript implementation. Any plans to do that?
评论 #38280730 未加载
评论 #38284015 未加载
angryemu超过 1 年前
Tests to align your model seems neat. How reliable is it? Won’t models still hallucinate time to time? How do you think about performance monitoring&#x2F;management?
评论 #38278247 未加载
ian_dot_so超过 1 年前
This is really interesting! What would be a good example of when I would want to use monkeypatch vs langchain or OpenAI functions?
评论 #38279385 未加载
lamroger超过 1 年前
The guardrails are cool!<p>I think more details of where the data goes and when it goes from few-shot to fine-tune will be helpful.
评论 #38289108 未加载
vutch超过 1 年前
tried a shot , quite impressed. I am implementing the bedrock interface (OpenAPI is limited access from my location). Look promised. Will check it out the fine-tuning with bedrock. But not sure we can do that or not. Appreciate your work
pietz超过 1 年前
Could you explain the differences to Marvin AI? I see a large overlap.
评论 #38284146 未加载
eychu94超过 1 年前
Awesome stuff! What other potential integrations are on the roadmap?
评论 #38286269 未加载
jondwillis超过 1 年前
Where in the codebase are you performing the distillation process?
评论 #38286047 未加载
fudged71超过 1 年前
This is incredibly cool, I’m excited to try it out
评论 #38286035 未加载
jackmcclelland超过 1 年前
this is super cool! what&#x27;s the use case you&#x27;re most excited about?
评论 #38279263 未加载
jacoboplu超过 1 年前
Super cool Jack
评论 #38284468 未加载