LLM 评估

101 天前
 Alias4ck

今天看到一个有意思的 repo,作者用一个 DSL 来评估 LLM 的能力

DSL

"Write a C program that draws an american flag to stdout." >> LLMRun() >> CRun() >> \
    LLMRun("What flag is shown in this image?") >> \
        (SubstringEvaluator("United States") | SubstringEvaluator("USA") | SubstringEvaluator("America"))

其中有一个 python convert to c(这个我第一次没反应过来哈哈) 问题很有意思,所有的 llm 都错了.

Question


def foo(x):
    sum = 0
    for i in range(x):
        x += i
        sum += x
    return sum

LLM OUTPUT

#include <stdio.h>

int foo(int x) {
    int sum = 0;
    for (int i = 0; i < x; i++) {
        x += i;
        sum += x;
    }
    return sum;
}

int main() {
    int result = foo(5); // Example call, replace 5 with any integer to test with different values
    printf("Result: %d\n", result);
    re

Reference

python_to_c_loop_update

677 次点击
所在节点    分享发现
1 条回复
devliu1
101 天前
不错

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1017176

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX