Technical notes by KbWen

Notes on AI, machine learning, Python, and data engineering, plus tools I build.

Latest posts

AI Systems

How constrained decoding works for JSON

Let's see how a JSON schema, or a plain JSON mode, changes what a model is able to write.

2026-10-12 · 5 min read · 894 words · KbWen · EN
AI Systems

JSON schema 怎麼限制 LLM 的輸出

我們用 xgrammar 看看給了 JSON schema 之後,模型會受到甚麼影響。

2026-10-12 · 3 min read · 1351 words · KbWen · ZH
Python

Python __slots__ and class attribute defaults

Let's see what happens when an attribute listed in __slots__ is given a default value.

2026-10-12 · 3 min read · 605 words · KbWen · EN
Python

Python 的 __slots__ 能省下多少記憶體

兩個只差在 __slots__ 這個區塊的 class,量量看最後的差別是什麼。

2026-10-12 · 3 min read · 1160 words · KbWen · ZH

Latest by category

More posts

AI Systems

How tool call arguments stream in the Claude API

A look at the input_json_delta events that carry a tool call's arguments in a streamed Claude API response, and what changes when a tool streams them eagerly.

2026-10-05 · 4 min read · 706 words · KbWen · EN
AI Systems

Claude API 串流時的工具呼叫與不完整的 JSON

用 Claude API 開串流的時候,參數會是一段段字串。這篇簡單的看這些片段長什麼樣子,以及程式該怎麼接手處理。

2026-10-05 · 2 min read · 982 words · KbWen · ZH
AI Systems

Where the cache_control breakpoint goes in Claude prompt caching

A walk through how the Claude API writes and looks up prompt cache entries, using the docs' example of a breakpoint that never gets a cache hit, and how to check the result in the usage fields.

2026-10-05 · 5 min read · 970 words · KbWen · EN
AI Systems

Claude API 的 prompt caching:cache_control 放在哪裡

來看看 Claude API 的 prompt caching 是怎麼找快取的,以及 cache_control 放在哪裡會影響有沒有正確讀到。

2026-10-05 · 3 min read · 1470 words · KbWen · ZH
開源專案怎麼看 AI 寫的程式碼:QEMU、Linux 核心與 Debian 的規定
AI Systems

開源專案怎麼看 AI 寫的程式碼:QEMU、Linux 核心與 Debian 的規定

QEMU、Linux 核心和 Debian 都有在文件寫怎麼處理 AI 的貢獻。這篇簡單的看三家各自的規定以及理由。

2026-09-23 · 2 min read · 835 words · KbWen · ZH
GPT-6 Astra 評測與價格:跟 GPT-5.6 Sol、Fable 5.1 的比較
AI Systems

GPT-6 Astra 評測與價格:跟 GPT-5.6 Sol、Fable 5.1 的比較

我們來看看新模型 GPT-6 Astra 跟上一代 Sol、Anthropic 的 Fable 5.1 在分數和花費上差在哪裡。

2026-09-23 · 2 min read · 880 words · KbWen · ZH