Spaces:
Running on Zero

word-problem-reader / README.md
Bigbearbo's picture
README: per-sentence mix
852b328 verified
|
Raw History Blame Contribute Delete
3.43 kB

A newer version of the Gradio SDK is available: 6.33.0

Upgrade
metadata
title: Word-problem reader
emoji: 📖
colorFrom: indigo
colorTo: blue
sdk: gradio
app_file: app.py
pinned: false
license: cc-by-nc-4.0
models:
  - Qwen/Qwen3-8B
  - Bigbearbo/handwired-left-brain-1
short_description: Qwen3-8B reads word problems; program brain solves

Word-problem reader (英文應用題讀題)

English word problem → Qwen3-8B (ZeroGPU, team v7 prompt, greedy, thinking off) writes Spiral information sentences such as have(reggie, usd, 48, start). and ask(have(reggie, usd, ?, now)). → parser → program brain (Python, CPU: blocks → equations → exact solve → Spiral prefix) → guards → hand-wired left brain (Bigbearbo/handwired-left-brain-1 v0.4) computes the prefix. If the reading does not check out, the Space refuses and says which sentence it got stuck on.

Two layers: layer 1 程式讀題 = the team's rule-tree reader (規則樹/資訊句輸出.py, no model; cannot have memorised anything). Its coverage is tiny today: 2 of 7,066 GSM8K-train development questions (both correct; held-out ids removed), growing with each rule. Only when it cannot read does layer 2 模型讀題 call Qwen3-8B, followed by the #350 reading repair (讀法修補.py, R1 + R3 on) when the read is refused. The answer box says which layer answered. In layer 2, after Qwen replies, the #348 per-sentence mix (mixer.py) replaces every fact sentence whose atomic clauses all match one of 31 allowed constructions with the construction reader's program reading (spaCy en_core_web_sm; reader trained offline, data/construction_reader.pkl); model lines that do not belong to that sentence are kept (取代守門 keep). On the 168 saved Qwen replies this leaves 11 / 7 / 150 unchanged while 69 sentences are program-read. An optional 🔧 switch (default off) lets the program point out bad lines for Qwen to rewrite once (#350 v1).

Honest numbers (self-reported, not independently verified): on 168 GSM8K-train development questions, Qwen3-8B with the v7 prompt (zero-shot, one read) got 10 right, 7 wrong, 151 refused; one DeepSeek v7 read of the same questions got 19 / 5 / 144. The team's main reader uses DeepSeek (paid API, not in this Space).

🔀 New numbers (換數字再讀): the model may have seen GSM8K train, so a reading only counts if it still works with new numbers. The button replaces every Arabic integer (word numbers like two / twice / half stay), reads both versions, and for dataset questions recomputes the new reference answer with the program brain from the DeepSeek reference reading (redraw up to 5 times; about 72% of the 480 questions get a valid variant offline).

Random questions: data/problems.json, GSM8K train development questions only (held-out and fixed-evaluation ids removed; GSM8K test not used), chosen where the DeepSeek v7 reading is answered correctly by the current program brain.

Files: app.py (UI + Qwen on ZeroGPU), pipeline.py (wiring, no Gradio), core.py (left-brain loader, from the HandWired-LeftBrain-1 Space), hs/ (unchanged copies of the team's 程式腦.py, 解析.py, 讀題_LLM.py, 讀題_提示v7.py, v7守門.py, 探索模式.py and the knowledge files they read), tools/ (how the bundle and data were built; local replay test).

License: cc-by-nc-4.0 for this Space's code and data. Qwen3-8B: Apache-2.0. GSM8K: MIT.