Hacker News· Bluestein·· 8 天前AI 评分22
Sage:让软件在运行时"思考"的新编程方式
Intelligence. At runtime. What if software could think while it runs?
AI 导读
Sage 提出一种在程序运行时调用模型做语义判断的编程方式:同一份文档,正则匹配 SSN、信用卡号等已知模式会漏掉姓名和地址,而通过 `decide(doc, yesno("Contains personal information?
正文 · AI 翻译
编写软件的新方式
文档:Maya Chen 住在 14 Cedar Lane。. 所示的正则表达式既找不到姓名,也找不到地址。
匹配已知模式
ssn = r"\b\d{3}-\d{2}-\d{4}\b"
card = r"\b(?:\d[ -]?){16}\b"
if (re.search(ssn, doc)
or re.search(card, doc)
or "passport" in doc.lower()):
block(doc)
else:
publish(doc)运行中的程序询问 Sage
private = decide(
doc, yesno("Contains personal information?")
)
match private["answer"]:
case "yes": block(doc)
case "no": publish(doc)
case None: review(doc)Sage 返回 yes,因此应用程序阻止该文档。No 会发布它;null 会将其送去审核。
01 / 深入机器内部
一种编写软件的
新方式。
相同输入
Maya Chen 住在 14 Cedar Lane。
之前
匹配已知模式。
ssn = r"\b\d{3}-\d{2}-\d{4}\b"
card = r"\b(?:\d[ -]?){16}\b"
if (re.search(ssn, doc)
or re.search(card, doc)
or "passport" in doc.lower()):
block(doc)
else:
publish(doc)这些检查漏掉了姓名和地址。
使用 Sage
询问含义。
private = decide(
doc, yesno("Contains personal information?")
)
match private["answer"]:
case "yes": block(doc)
case "no": publish(doc)
case None: review(doc)同一份文档。一个语义决策。
应用程序询问
这份文档是否包含个人信息?
程序运行时,问题和文档会发送给 Sage。
Sage 回应
{
"answer": "yes",
"probability": 0.99
}应用程序阻止发布。不确定的答案会交给人工处理。
来源:Hacker News · levanto.ai