Files
floop/RUNLOG.md
T
onibot 6db05fef48 fix(knowledge): cold-start gather — vertical tables, global rank, early exit
Emili's home run failed where the VPS seemed to work: warm-KG illusion; cold path never validated. Reproduced with a wiped KG. Fixes: (1) tables_as_text parses BOTH wikitext layouts (horizontal pipes and one-cell-per-line with row separators) + _clean_cell drops attrs/links/templates; (2) gather searches all queries, dedupes, ranks globally by title relevance, fetches ONE article at a time with EARLY EXIT when the KG answers; (3) hybrid order keeps each query's top-1 slot guaranteed (title relevance buries entity pages like 'Loire'). Also: NameError from refactor caught by baseline fallback; counters accumulate. Cold E2E verified: France (table quote) -> Loire (early exit, 1 article) in 2hops. RUNLOG Run D.
2026-10-17 10:39:34 +02:00

19 KiB
Raw Blame History

FLOOP — Virtual run log

Question (depth 0): "Quants qubits cal que tingui un ordinador quàntic per minar un bloc de bitcoin?"

Format: each entry [T<turn> | depth=<d> | <component>] with input / output / cost / notes.

  • [REAL] = a real tool call was executed. [NARRATED] = step walked by hand, no tool ran.
  • T0–T2 are reconstructed after the fact (the walkthrough predates this log). From T3 on: live.
  • Budget unit: calls (informal — GAP-6 still open).
  • Evidence ids carry over from run 1 with provenance intact; E5 RETRACTED (GAP-7 case). Run 1's flaws are in GAPS.md, not here.

Carried evidence

id type content provenance status
E1 Citation difficulty ≈ 132.7×10¹²; hashrate ~950 EH/s (Oct 2026) startmining.io, pickaxe.io live
E2 Citation Aggarwal: PoW resistant to near-term QC; ASIC clock ≫ QC clock arXiv:1710.10377 live
E3 Citation Amy et al. (Waterloo): cost estimates for generic quantum preimage attacks on SHA-2/SHA-3 PQCrypto 2016 live
E4 Citation Zalka: Grover optimal; parallelization = space partition; (π/4)√N oracle calls arXiv:quant-ph/9711070 live
E5 Citation "1,151 logical qubits, ~1.3M Toffoli — Bitcoin attack halved" shattered.io RETRACTED (Shor/ECDSA ≠ mining)
E6 Citation reversible double-SHA-256 oracle ≈ 3×10⁵ non-Clifford T gates per Grover iteration; magic-state factories: thousands of physical qubits (surface code) arXiv:2603.25519 live
E7 Algorithm function: double-SHA-256(header 80B); variable: nonce 4B + extraNonce; condition: hash ≤ target (nBits) UserReply (load-bearing, confirmed vs E2+E6 — GAP-9) live
E8 QuantumAlgo Grover; search_space: nonce 2³² ⇒ register ⌈log₂⌉ = 32 qubits (derivable); oracle: double-SHA-256 reversible (E6); iterations: (π/4)·√N Delgado 2022 (MDPI Entropy 24(3):323), E4, E6 live

T0 — INIT (depth 0)

[T0 | depth=0 | INIT — LLM translate stage] [NARRATED] — 1 call

  • input: user question (NL)
  • output:
    • GoalSchema{ quantity: n = "qubits d'un ordinador quàntic que pot minar un bloc de bitcoin"; answer_type: OPEN; criterion: every factor of n carries a source }
    • subquestions (dependency chain, epistemic closure per GAP-8):
      • m1 "quin algorisme computacional mina un bloc?" → Algorithm
      • m2 "quin és l'equivalent quàntic de #m1?" (template) → QuantumAlgo
      • m3 "quants qubits necessita la màquina que executa #m2?" (template) → QubitCount
  • notes: the run-1 INIT imported domain vocabulary + the competitive time framing (GAP-8) and inflated the answer; this is the corrected INIT.

T1 — turn 1: m1 (child run, depth 1)

[T1.a | depth=0 | stop-check] goal derivable from table? → NO (no Algorithm row). [NARRATED] [T1.b | depth=0 | route] m1 + declared type Algorithm → attendant: floop child (depth 1) — bare knowledge also defensible; the child adds the typed adequacy contract. [NARRATED] [T1.c | depth=1 | INIT] input: "com és l'algorisme per minar bitcoins?" + parent context ("per comptar qubits") → 1 subquestion typed Algorithm{function, input, variable, success_condition}. [NARRATED] — 1 call [T1.d | depth=1 | stop-check on open question] type vs visible table → 4/4 fields coverable (E2, E6, user row); 2 fields covered only by the user row → GAP-9: load-bearing → cheap confirm. [NARRATED] [T1.e | depth=1 | EXPERT knowledge] input: "confirm mining mechanism, attach citation" → E7 Algorithm — PASS arrival check. [NARRATED — no real call: piggybacked on E2/E6 provenance; a live run does one search+fetch here]

  • result: m1 done. cost: ~3 LLM calls + 1 knowledge call.

T2 — turn 2: m2 (child run, depth 1)

[T2.a | depth=0 | stop-check] → NO (no QuantumAlgo row yet). [NARRATED] [T2.b | depth=1 | INIT] input: "quin és l'equivalent quàntic de #E7?" + context → 1 subquestion typed QuantumAlgo{primitive, search_space, oracle, iterations}. [NARRATED] — 1 call [T2.c | depth=1 | stop-check] 3/4 fields derivable (E4: primitive + iterations; E6: oracle); search_space ✗ → targeted retry, not decomposition (GAP-10b). [NARRATED] [T2.d | depth=1 | EXPERT knowledge] input: "quin espai de cerca recorre Grover al minatge? què va en superposició?" → E8 QuantumAlgo — PASS. [REAL: web_search ×2 → Delgado 2022, MDPI Entropy 24(3):323 — "the entire search space of the golden nonce can be queried at once"]

  • result: m2 done. Adequacy note: iterations carries an unbound N → flagged; becomes m3's business.

T3 — turn 3: m3 (child run, depth 1) — LIVE from here

[T3.a | depth=1 | INIT] input: "quants qubits necessita la màquina que executa #E8?" + parent context ("l'objectiu és respondre la pregunta de l'usuari, no una fita intermèdia"). Decomposition driven by the declared type + the table's holes — the generic machine scaffold says: machine = state register (✓ E8: 32 qubits) + oracle circuit width (✗ no row) + error correction (✗ no row):

  • m3.1 "quina amplada (qubits lògics) té el circuit oracle reversible de #E8?" → CircuitWidth{width, included, font} [knowledge]
  • m3.2 "quants qubits físics calen per qubit lògic segons #E6?" → ECOverhead{ratio, scheme, font} [knowledge]
  • m3.3 template (waits for both slots): n_logical = 32 + #m3.1 ; n_physical = n_logical × #m3.2 [analytic] [NARRATED] — 1 call. Fork flagged (GAP-2): "tenir qubits" suggests physical; the literature quotes logical — but both readings share every subquestion except the final ×ratio → answer both, don't ask (refinement logged in GAPS.md).

T3.b — m3.1 (circuit width) [REAL]

[T3.b | depth=1 | EXPERT knowledge] input: "quina amplada (qubits lògics) té el circuit oracle reversible de #E8?"

  • calls: web_search ×3 + GitHub README fetch + arXiv HTML extract (curl ×2) — 6 tool calls, 1 turn
  • output → E9 CircuitWidth{ width: [1,346 .. 4,418] logical qubits per machine, register INCLUDED, sources: [arXiv:2603.25519 ("1,346 logical qubits per iteration once the search register and comparison ancillas join the 1,153-qubit hash pipeline"), slothgar/quantum-bitcoin-miner ("4,417 qubits, double SHA-256 fully reversible" / "Logical qubits: 4,418 — verified vs genesis block, zero dirty ancillas"), Amy et al. arXiv:1603.09383 (SHA-256 preimage width ≈ 2^12.6 ≈ 6,208 — same band, third source)] } — PASS (3 independent sources, band 10³–10⁴)
  • notes: the slothgar repo is executable primary evidence (circuit runs, CI-verified against the genesis block) — stronger than a paper quote. Its README states the design thesis verbatim: "The honest gap is width, not fidelity — and width is exactly what matters."

T3.c — m3.2 (error-correction overhead) [REAL]

[T3.c | depth=1 | EXPERT knowledge] (same calls as T3.b, one search round) → E10 ECOverhead{ ratio: [1,000 .. ~1,450] physical:logical, scheme: surface code d≤27, sources: [literature "1,000:1 or higher" (quantumintel.tech summary), slothgar "physical ~6.4M / logical 4,418 at d=27" → 1,449, arXiv:2603.25519 (Litinski framework, T-factory sizing)] } — PASS

  • notes: the interval comes from concrete instances, not vibes: d=27 is a real design point.

T3.d — arrival check & template correction [NARRATED]

[T3.d | depth=1 | CHECK] proposed template said n_logical = 32 + #m3.1. E9's included field says the register is already in the width → adding 32 would double-count the nonce register. Template corrected by evidence: n_logical = #m3.1 (not additive). The typed field CircuitWidth.included is what allows the composer to catch this — LLM proposal amended, not blindly applied. (Logged as a working mechanism, candidate PIPELINE §5 note.)

T3.e — m3.3 (composition) [REAL]

[T3.e | depth=1 | EXPERT analytic+numeric] input: compose QubitCount from E9 × E10 (SymPy, no mental arithmetic — engine run, output verbatim):

n_logical  ∈ [1,346 .. 4,418]
ratio     ∈ [1,000 .. 1,449]        (surface code, d≤27)
n_physical∈ [1.35e6 .. 6.40e6]      per machine
cross-checks: slothgar direct quote 4,418 → ~6.4M  MATCH
              Amy et al. 2^12.6 ≈ 6,208 logical (same band)  OK

→ E11 QubitCount{ n_logical: [1,346..4,418], n_physical: [1.35×10⁶..6.4×10⁶], reading: per-machine width, nonce-only Grover (partial preimage, b=32), answer_type: INTERVAL } — PASS (dimensions: qubits = qubits × 1 ✓)

T4 — depth-0 stop-check → ANSWER [NARRATED]

[T4 | depth=0 | PROVER] goal "how many qubits to mine a block" derivable from table?

  • E11 exists, typed, sourced, composed (derivation chain E8→E9/E10→E11 all provenance-linked) → YES.
  • answer_type tightens OPEN → INTERVAL. D (difficulty) does not enter the width: the hash function fixes the width; difficulty only scales iterations (time). The parameter run-1 imported turned out to be irrelevant to this reading — GAP-8 vindicated by payoff.
  • Honest complements already in table: competitive framing → fleet ~10²³ physical (arXiv:2603.25519 at Jan-2025 difficulty); nonce-only partial preimage b=32 → ~10⁸ physical (same paper). Both are the time-collapsed variants of the same machine — quoted as context, marked as alternative framings, not merged into E11 (type separation prevents the merge).
  • Unresolved fork (GAP-2), logged not asked: "tenir qubits" = machine size (E11). If the user meant "beat the network", the answer is the fleet variant. Both readings carried into ANSWER.

[T5 | depth=0 | ANSWER] — final synthesis (LLM, one formal→NL pass over the table): "Per minar un bloc (una màquina, sense cursa contra el temps): ~1.400–4.400 qubits lògics, ~1,4–6,4 milions de qubits físics amb surface code (d≤27). L'amplada la fixa SHA-256 reversible, no la dificultat; la dificultat només allarga el rellotge. La lectura competitiva (guanyar el bloc de 10 min) és una altra pregunta: ~10²³ físics a dificultat actual." Marked: verified for the machine-size reading; the competitive reading quoted from source, not derived.


Run summary (as logged)

  • Turns: T0–T5. Real calls: 1 (T2.d searches) + 6 (T3.b/c) + 1 analytic engine run (T3.e). Everything else narrated (LLM calls not executed — a live run spends ~8 more LLM calls: INITS, routes, checks).
  • Depth reached: 1 (m1, m2, m3 as child runs; no depth-2 needed — m3's decomposition stayed inside the child).
  • Evidence: E1–E11 (E5 RETRACTED). E7 carries user provenance (confirmed). E11 composed, derivation-linked.
  • Design lessons this run:
    1. T3.d — typed included fields let evidence correct an LLM proposal (double-count caught).
    2. T4 — difficulty never entered the width answer: a parameter imported by run-1's INIT was irrelevant under the honest reading. The epistemic closure (GAP-8) pays off concretely.
    3. The stop-check doubling as cache (GAP-10) fired twice: m1 closed with zero searches, m2 with one.
    4. The fork at m3 resolved by typing the answer both ways rather than asking (interval band shared by both readings except the ×ratio term) — GAP-2 criterion refined: ask only when readings diverge in kind, not when they diverge in one multiplicative term.
  • Open items: GAP-6 (budget units still informal), GAP-2 (fork criterion refinement to merge), GAP-10 (adequacy contract) — all logged in GAPS.md.

Executable runs (v0.1 draft, code/)

2026-10-10. First executable run. dspy 3.4.0 over OpenAI-compatible endpoints; every LLM stage (INIT, ROUTE, EXPERT, MISSING, ANSWER) is a dspy call; check layer, prover and engines are stubs — so everything is honestly Unverified. LM: local qwen3.8:27b (hub 127.0.0.1:11435).

Run A — question with no answerable evidence (honesty demo)

"How many physical qubits would be needed to break RSA-2048, and what makes the estimate uncertain?"

  • INIT → 3 subquestions (logical qubit count → EC overhead → uncertainty sources), deps typed.
  • ROUTE → knowledge ×3. The stub knowledge engine cannot retrieve (no search in the draft), the question states no literals, so E1 = UNKNOWN → arrival check refuses → Q1 failed → Q2, Q3 cascade-fail (dependency-directed failure). Stop = stack terminal (prover stub).
  • ANSWER (UNVERIFIED): correctly refuses to invent a number, cites E1.
  • 3 LLM calls + 1 engine call, 132 s. The honest fallback path works end-to-end.

Run B — answerable-from-question-literals (happy path)

"A train travels 120 kilometers in 90 minutes. What is its average speed in km/h?"

  • INIT → Q1 "90 min in hours?" [CONSTANT, numeric] → Q2 "formula for average speed?" [FUNCTION, knowledge] → Q3 "average speed using converted time + distance" [FUNCTION, numeric], dependency chain Q1→Q3.
  • Q3's question text referenced Q1's slot and was instantiated with E1's value at execution time (plan-on-slots working).
  • E1=1.5 h (stub:numeric, quote = question literal), E2=formula (stub:knowledge), E3=80 km/h (stub:numeric). ANSWER (UNVERIFIED): "80 km/h" with every claim cited to E1–E3.
  • 8 LLM calls (init 1 + route 3 + engines 3 + answer 1), 154 s — budget accounting exact.

Design lessons (executable run 1):

  1. The failure cascade (Run A) is the design working: no retrieval engine → honest UNKNOWN → no invented answer. The next vertical (knowledge with real search) is what unlocks Run-A-class questions.
  2. Slot instantiation (#E refs substituted at execution, not planning) kept hops visible in question text — matching the PIPELINE law that multi-hop lives in the plan.
  3. dspy 3.4 + litellm: model ids need the openai/ prefix for OpenAI-compatible endpoints; the class is dspy.LM (not dspy.LLM). Wrapped once in floop/llm.py.
  4. Budget must charge engine LLM calls too (the engine IS an LLM call in the draft) — fixed after Run A showed engines riding for free.

Run C — the knowledge vertical, live (2026-10-17)

Goal: give the knowledge expert a real engine (KNOWLEDGE.md): KG-first probe -> Wikipedia gather -> containment-checked extraction -> answer from quoted rows. Wikipedia (en) only, per decision 2026-10-17; DuckDuckGo/general-web later.

C1 — Loire length (cold then warm)

  • Cold run: search "loire river" -> fetch Loire (40,229 chars) -> 28 section chunks -> 3 gated -> 1 fact extracted: loire river | length | 1,006 kilometres with verbatim quote, containment-checked against the full article text. 4/4 candidates passed.
  • Warm run (KG already holds it): "1,006 kilometres" answered from the graph with zero network calls, source=knowledge_graph, quote verbatim. The KG-first law pays.

C2 — "Longest river of the second most populated EU state" (the 2-hop question)

This one took six real bugs to close, each found by a live run:

  1. Wikipedia pip lib unusable — default User-Agent 403; empty-string params make the API return HTML. Fix: official MediaWiki action API with own session (wiki.py).
  2. Plain extracts drop tables — the population ranking article is all table; the extract was 393 chars. Fix: fetch_rich appends wikitext tables parsed to rows.
  3. Pipes inside quotes — the extractor quoted table rows ("France | 68,635,900 | 15.2%"); parse_facts split on every pipe and the quote collapsed to "France" (<10 chars, rejected). Fix: split("|", 3) — the quote is the last field and may contain pipes.
  4. Gate too strict — "populated" never matched "population" in chunks. Fix: stemming in the gate and in the probe (store.stem).
  5. Probe matched only entity names — ranking questions have unknown answer entities; the probe now also matches relations and values.
  6. Pronouns reached the pipeline naked — "What is the longest river located in THAT STATE?" translated to "United States" river lists (50 wasted extraction calls in one dead run). Fix: the machine passes parent question + answered evidence rows into the pipeline; TRANSLATE resolves references; the initial probe seeds include the resolved entities (E1 "France" -> probe finds the loire | is the longest river in | France).

Final run (2026-10-17 23:17): Q1 France (E1, quote = population table row) -> Q2 "that state" resolved to France -> KG hit: The Loire River (E2) -> answer cites both rows. 12 LLM calls, 75s, zero network on Q2 (all facts already in the graph).

Honesty notes

  • Extraction quality bounds KG quality: containment guarantees fidelity to the source, not source truth.
  • The gather still spends calls on tangential articles (US river lists matched the "longest river" gate); tuning pending (README next-steps #5).
  • KG carries noise from the debugging runs (e.g. the loire vs loire river nodes); entity-resolution policy pending by design (conservative draft).
  • verified=False still: the prover is a stub. But knowledge rows now carry source-verified: verbatim containment in trusted doc — a real, deterministic check.

Environment notes

  • Run C2 used uv run (pyproject fixed earlier: name floop, hatchling, packages=["floop"]).
  • dspy 3.4 dspy.LM(...) returns a list of AttributeDicts on raw call (text key) — wrapped in floop/llm.py:active_lm.
  • Tests at this point: 9 state + 5 machine + 3 knowledge = 17/17.

Run D — cold-start fixed (2026-10-17)

Trigger: Emili's home run failed on the same question that worked on the VPS. The log was conclusive — and honest: the VPS success had been a warm-KG illusion; the cold-start path had never been validated end-to-end. Reproduced 1:1 on the VPS with a wiped KG (same queries, same articles, same UNKNOWN).

Root causes (three, all in the gather):

  1. Vertical wikitext tables unparsed. 'Demographics of the European Union' holds the ranking table with ONE CELL PER LINE; the parser assumed horizontal pipes. The article was fetched, chunked, extracted — and its table was garbage rows. Fix: tables_as_text handles both layouts + cell attributes (_clean_cell). Verified live: France | 69,112,309 | 15.29% | 638,475 | 15.1% | 107.
  2. Quota eaten by per-query fetch order. 'List of EU member states by population' appeared in search results but never got a slot (quota spent on the first query's generic articles). Fix: search ALL queries, dedupe, rank globally, fetch one at a time with early exit when the KG starts answering.
  3. Pure title-relevance rank buried entity pages. 'Loire' shares no word with 'longest river in France' — lexical rank 0. Fix: hybrid order — each query's #1 keeps a guaranteed slot (the engine's own relevance), the rest ranked by title relevance.

Cold-run result (KG empty at start): Q1 France (table row quote, source-verified) -> Q2 The Loire (early exit after ONE article) -> final answer cites E1+E2. Two bugs of my own found during the fix: a NameError from the refactor (caught by the baseline fallback — the fallback layer earned its keep) and counter resets.

Note for benchmarks: early exit cut Q1 from ~22 to ~3 articles-extracted and Q2 to 1 article; the gather now stops when the graph answers.