问HN:你是如何让大型语言模型生成优质代码的?

1作者: bjourne大约 18 小时前原帖
最近,我想看看能否让这个机器人帮助我整理我的音乐收藏。具体来说,我希望它编写一个Python函数,该函数接受一首歌曲的音频文件路径,并返回该歌曲的首张专辑(即规范专辑)的名称。如果忽略重制版、现场录音、盗版等,这实际上是一个简单的启发式映射:例如,《Smoke on the Water》对应《Machine Head》,《Come as You Are》对应《Nevermind》,《Fools Gold》对应《The Stone Roses》。 我可以快速使用MusicBrainz API编写这个函数,我相信其他许多HN的读者也可以。然而,经过许多个小时的尝试,无论我如何提示机器人,我都无法让它完成这个任务。这是ChatGPT生成的内容——其他机器人也给出了类似的无用回复: https://chatgpt.com/share/6a396ea9-44d4-83eb-bdfd-216dfcc87e99 它们抱怨问题模糊(其实并不模糊)或MusicBrainz没有数据(实际上是有的)。我是在错误地提示机器人,还是没有使用足够强大的编码模型?结果让我感到非常失望。
查看原文
Lately, I wanted to see if I could get the bot to help me organize my music collection. Specifically, I want it to code a Python function that takes the path to an audio file of a song and returns the name of the canonical (i.e., first) album of that song. If one ignores remasters, live recordings, bootlegs, etc., this is an easy heuristic surjective mapping: Smoke on the Water -&gt; Machine Head, Come as You Are -&gt; Nevermind, Fools Gold -&gt; The Stone Roses.<p>I can code this function quickly using the MusicBrainz API and I believe most other HN readers can too. Yet many hours later, no matter how I prompt the bot I can&#x27;t get it to do it. This is what ChatGPT generates---other bots reply with similar garbage:<p>https:&#x2F;&#x2F;chatgpt.com&#x2F;share&#x2F;6a396ea9-44d4-83eb-bdfd-216dfcc87e99<p>They complain about how the problem is ambiguous (is not) or how MusicBrainz doesn&#x27;t have the data (it does). Am I prompting the bot incorrectly or not using powerful enough coding models? The results are very underwhelming.