Hacker News ★ 104 6 min

I built non-autoregressive decision models with RL a year ago

🔗 https://laya.convaiinnovations.com/

📌 搶先Jev一年的開源決策模型:Laya

TL;DR:他一年前就發表同概念論文與開源模型,如今推出更快版本迎戰爆紅的Jev。

這幾天AI圈都在討論一種「不是自迴歸、不生成文字、只吐出結構化機率」的新架構,聽起來像是憑空冒出的突破。但開發者 nandakishor_ml 說,這件事他一年前就做過了。

🤔 為什麼用LLM做決策是殺雞用牛刀

現代AI pipeline有個常見的效能黑洞:用生成式LLM去回答本該簡單、結構化的問題。像是客服單該分派到哪個部門、一封email是不是釣魚信、一段prompt是不是想做jailbreak或prompt injection、緊急程度該打幾分(0到3)。這些問題丟給8B、70B甚至frontier等級的生成式LLM處理,等於是用500到2000毫秒的token streaming時間、真金白銀的推論成本,換來一段還要自己寫regex或JSON parser去解析的自由文字。更麻煩的是,LLM很愛生成「假自信」:輸出「confidence: 0.95」時,它其實只是在預測聽起來很有把握的token,背後沒有任何數學上的校準(calibration)。作者認為,這類任務需要的是人腦System 1式的反射決策:30到35毫秒內給出誠實、經過校準的機率。

🧩 三個決策原語與三個checkpoint

作者去年3月發表的arXiv論文(arXiv:2503.23303)用PPO在sequence representation上訓練模型,針對垂直領域的銷售對話輸出逐輪的轉換機率(0.0到1.0),同步釋出模型權重(sales-conversion-model-reinf-learning)、開放資料集(saas-sales-conversations)與PyPI套件。今年9月,他又發表第二篇論文(arXiv:2510.01237),把「由強化學習引導的schema-based決策」框架系統化。

這次推出的Laya,把整個做法收斂成三種決策原語,對任何狀態(純文字、email、工單或JSON文件)做單次前向傳播即可完成判斷:

  • choice:從一組候選字典中選一個選項,回傳選中的key、跨所有選項的機率分布,以及校準過的信心分數。
  • score:把狀態放到一個順序量表(0、1、2……)上,回傳期望等級、各等級分布與信心。
  • noul:直接的布林問題,回傳校準過的P(true)(0.0到1.0,P(false)=1-P(true))。

由於輸出空間純粹是機率與數字,模型不會生成文字,也就不可能出現hallucination,更不會有格式錯誤或JSON壞掉的問題。

Laya釋出三個專門化checkpoint,統一放在同一個Hugging Face repository下:

Checkpoint骨幹參數量Context主要強項
layaModernBERT-large421M512英文文字分類、guardrail、email分流
laya-multilingualmmBERT-base(256k詞表)322M1024(最高8k)100+語言、速度快2.2倍、跨語言NLI
laya-typed-decisionsModernBERT-large421M1024Agent可觀測性、客服、發票處理、資安警示(準確率0.766)

透過Hugging Face的allow_patterns,SDK可以只下載需要的subfolder,例如只抓英文模型(約808MB)或多語言子資料夾(約647MB),不必整包下載2.5GB。

⚠️ 信心分數會騙人:不同文字系統的災難性失效

作者在MASSIVE benchmark(20個選項,隨機基準線0.050)上對51種語言做了掃描,結果顯示英文模型一旦離開拉丁字母系統就會全面失準:高棉語準確率0.000,但平均信心高達0.952;亞美尼亞語準確率0.050(等於隨機猜),信心卻有0.885;希伯來語準確率0.060、信心0.964;孟加拉語準確率0.080、信心0.945;印地語準確率0.100、信心0.941。整整51種語言掃下來,英文checkpoint的平均信心從未低於0.885,不管實際準確率是82%還是0%。這代表信心分數本身完全無法提示「這個模型看不懂這段文字」,該用哪個checkpoint必須在做前向傳播之前就決定好,而不是靠模型自己的confidence把關。

為此Laya內建一個Router,能辨識22種文字系統(天城文、CJK漢字、西里爾字母、阿拉伯文、希伯來文、泰米爾文、泰文等)並分析拉丁停用詞分布:一般英文文字偵測開銷只要0.09毫秒,天城文/印度語系文字0.54毫秒,大型200列巢狀JSON文件0.73毫秒。相較於33毫秒的前向傳播,路由開銷可以忽略不計(<2%)。搭配Router(preload=True)把所有checkpoint常駐在VRAM/RAM中,還能完全消除語言切換時7到10秒的冷啟動代價。

💡 蹭熱度,還是站在自己一年前的肩膀上

九月,由前OpenAI「ChatGPT共同發明人」Diogo Almeida創辦的TypeSafe AI推出了Jev,主打的正是同樣的非自迴歸、輸出校準信心分布的決策概念,取名RLCD(Reinforcement Learning for Calibrated Decisions),定價每百萬input token 0.042美元,回應時間約150毫秒。但作者指出,Jev沒有附上技術論文,沒有開放權重,也沒有公開訓練資料集。相比之下,他把這一年的經驗全部重做一遍,做出完全開放、跑在雙向編碼器(bidirectional encoder)上的Laya:單張GPU上32.8毫秒即可完成推論(批次處理時每題僅7.2毫秒),號稱比Jev快6到8倍,支援100多種語言,沒有API訂閱費用,並以Apache 2.0授權完全開源。

🎯 實務啟示

如果你的系統裡有大量「分類/評分/是非題」式的判斷,卻在用GPT等級的生成式模型硬解,這篇分享值得參考:先問自己是否真的需要生成文字,還是只需要一個誠實、快速、可校準的機率。另一個更重要的提醒是,confidence gating並不安全,當輸入語言或格式超出模型訓練分布時,模型可能依然自信滿滿地給出錯誤答案,路由與語言偵測必須做在推論之前,而不是事後靠信心分數把關。

🔗 來源

#NonAutoregressive #DecisionModels #ReinforcementLearning #ModernBERT #OpenSource #LLMRouting #Calibration #MachineLearning #NLP #HuggingFace

原始資料 Hacker News · 收集於 2026-09-19
來源原標題
I built non-autoregressive decision models with RL a year ago
作者
nandakishor_ml
原始標籤
hackernews
來源訊號
HN points 777 HN 留言 186
原始連結
https://laya.convaiinnovations.com/

摘要原文

Everyone in AI right now is talking about a new kind of model: an architecture that is not autoregressive, does not generate text, and gives lightning-fast probability predictions over structured schemas. Seeing the hype online feels both validating and deeply frustrating. I worked on this literally one year back in March 2025. I spent months of hard work, sweat, and sleepless nights building it, published an arXiv paper ( arXiv:2503.23303 ), released the model weights on Hugging Face ( sales-conversion-model-reinf-learning ), published the open dataset ( saas-sales-conversations ), built a PyPI package, and posted the whole approach on Reddit ( r/LocalLLaMA discussion ). Then in September 2025, I published a second paper ( arXiv:2510.01237 ), formalizing the framework for schema-based decisions guided by reinforcement learning. The guiding brain in my system was always reinforcement learning, not just an embedding model or an autoregressive LLM. And then in September 2026, a well-funded frontier lab called TypeSafe AI (founded by Diogo Almeida, a co-inventor of ChatGPT at OpenAI) launched Jev. They proposed the exact same non-autoregressive decision concept as if it was a brand-new scientific breakthrough. Except they launched without technical papers, without open weights, and with zero open training datasets. My earlier model used PPO over sequence representations to output turn-by-turn conversion trajectories (probabilities from 0.0 to 1.0) in vertical sales conversations. Jev generalized parallel sampling using what they called RLCD (Reinforcement Learning for Calibrated Decisions) to output confidence distributions and schema choices horizontally, charging $0.042 per million input tokens with typical response times around 150 ms. Instead of staying bitter, I decided to take everything I learned, fix every architectural limitation of the old approach, and build a completely open, horizontal System 1 decision model family: Laya . And because we built it properly on bidirectional encoders, our models run in 32.8 milliseconds on a single GPU (7.2 ms/question batched) , making it 6 to 8 times faster than Jev , with full support for over 100 languages, zero API subscription costs, and 100% open-source Apache 2.0 weights. 1. The Core Realization: System 1 vs System 2 Every modern AI pipeline has a giant bottleneck: we use generative LLMs for simple reflex decisions. When a customer support ticket arrives, or an email hits your inbox, or a user submits a prompt to your API, you usually only need to answer simple, structured questions: Which department should this ticket route to? Is this incoming email a phishing attack or spam? Is this prompt trying to jailbreak or inject instructions? How urgent is this issue on an ordinal rubric (0 to 3)? Does this query require code execution or a simple factual reply? Calling an 8B, 70B, or frontier generative LLM for this is complete overkill. You wait 500 ms to 2,000 ms for tokens to stream out, spend real money on inference, and then have to write regex or JSON parsers to extract a clean label from free-form text. Worst of all, LLMs love to hallucinate and generate fake confidence. When an LLM outputs "confidence: 0.95" , it is just predicting tokens that sound confident. There is zero mathematical calibration behind it. We needed a model that works like the human brain's System 1: instant reflex decisions with honest, calibrated probabilities, taking only 30 to 35 milliseconds on standard commodity hardware. 2. The Three Decision Primitives Laya evaluates typed questions over any state (raw text, email, ticket, or JSON document) in a single forward pass . It relies on three primitives: choice : Pick one option from a dictionary of criteria. Returns the selected key, probability distribution across all options, and a calibrated confidence score. score : Place the state on an ordinal rubric (levels 0, 1, 2, ...). Returns the expected level, the distribution over rubric ranks, and confidence. noul : A direct boolean question returning calibrated probability P(true) from 0.0 to 1.0 (with P(false) = 1 - P(true) by construction). Because the output space consists purely of probabilities and numbers, the model never generates text, cannot hallucinate, and schema violations or malformed JSON are physically impossible. 3. The Three Checkpoints & Bundled Hub Architecture One model cannot be optimal for every task and language. We released three specialized checkpoints, now consolidated under a single repository hub on Hugging Face: Checkpoint Backbone Encoder Params Context Primary Strength convaiinnovations/laya ModernBERT-large 421M 512 English text classification, guardrails, email triage convaiinnovations/laya-multilingual mmBERT-base (256k vocab) 322M 1024 (up to 8k) 100+ languages, 2.2x faster, cross-lingual NLI convaiinnovations/laya-typed-decisions ModernBERT-large 421M 1024 Agent observability, customer service, invoice processing, security alerts (0.766 acc) Selective Subfolder Downloads Rather than forcing users to manage three separate repositories or download 2.5 GB of combined weights, the main repository convaiinnovations/laya bundles all three. Using Hugging Face's allow_patterns , Laya's SDK downloads only the specific subfolder requested: # Downloads English model (~808 MB) agent_en = laya.load("convaiinnovations/laya") # Downloads ONLY the multilingual subfolder (~647 MB), not the entire 2.5 GB bundle agent_ml = laya.load("convaiinnovations/laya", subfolder="multilingual") 4. Why Routing Is Essential: The Multi-Script Reality One of the most eye-opening findings from our 51-language sweep on the MASSIVE benchmark (20 options, random baseline = 0.050) was how English models fail outside Latin script. ModernBERT-large's 50,000-token English BPE vocabulary simply shreds non-Latin alphabets: Khmer: 0.000 accuracy at 0.952 mean confidence . Not one correct decision in 100 questions, while reporting ~95% confidence. Armenian: 0.050 accuracy (exact coin-flip random) at 0.885 confidence. Hebrew: 0.060 accuracy at 0.964 confidence. Bengali: 0.080 accuracy at 0.945 confidence. Hindi: 0.100 accuracy at 0.941 confidence. This is the crucial lesson: the model's own confidence gives no warning when it cannot read the input script . Across 51 languages, the English checkpoint's mean confidence never drops below 0.885, regardless of whether its accuracy is 82% or 0%. Therefore, confidence gating cannot protect you . The decision of which model to use must be made before the forward pass. Sub-Millisecond Pure Python Routing Laya includes a built-in Router that inspects the Unicode scripts of incoming text across 22 alphabets (Devanagari, CJK Han, Cyrillic, Arabic, Hebrew, Tamil, Thai, etc.) and analyzes Latin stopword distributions: Standard English text: 0.09 ms detection overhead. Devanagari / Indic text: 0.54 ms detection overhead. Large 200-row nested JSON documents: 0.73 ms detection overhead. Compared to a 33 ms forward pass, routing overhead is negligible (<2%). And with Router(preload=True) , all required models stay resident in VRAM/RAM, completely eliminating the 7 to 10-second cold-swap penalty when traffic alternates between languages. from laya import Router # Preload checkpoints into memory for instant sub-35ms routing router = Router(preload=True) # English -> automatically routed to ModernBERT-large res_en = router.predict({"body": "I was charged twice, please refund."}, questions) # Hindi -> automatically routed to mmBERT-base (100+ languages) res_hi = router.predict({"body": "मुझसे दो बार शुल्क लिया गया, कृपया पैसे वापस करें।"}, questions) # Explicit override when you already know the domain res_spec = router.predict(state, questions, model="typed-decisions") 5. Head-to-Head: Laya (with Routing) vs TypeSafe Jev We benchmarked Laya directly against TypeSafe Jev across public datasets and standard benchmarks. (777 points, 186 comments on Hacker News)

由 claude-code/sonnet 自動生成