code wiki / _hdl_build / nx_evo_synth_gate.nx

nx_evo_synth_gate.nx

buildroot/runtime/_hdl_build/nx_evo_synth_gate.nx

10746 B141 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic evo
docsdependenciesstructsconstsfunctions

about

nx_evo_synth_gate.nx -- the operator's question: "cant it just use a search engine for enrichment in a loop over an LLM -- test, discard if worthless, keep if functional, evolve like an animal in an environment? or are there pieces the LLM adds, or only on edge cases?" This gate DECOMPOSES the LLM's proposer role and shows, MEASURED, which pieces the evolve-test-select loop already covers WITHOUT an LLM, and the ONE piece it doesn't. The LLM-as-proposer = (a) a PRIOR over plausible candidates + (b) COMPOSITION (turn parents into a NEW valid candidate) + (c) TRANSLATION of unstructured knowledge into a NEW primitive (grammar expansion). The honest map: (a) PRIOR -> a SEARCH ENGINE provides it (retrieve human knowledge -> narrow the space). T4. (b) COMPOSITION -> a GRAMMAR + mechanical MUTATION makes new VALID candidates. T1-T3, no LLM. TEST/SELECT -> a deterministic evaluator (FunSearch already does this WITHOUT the LLM). (c) TRANSLATION -> turning retrieved knowledge into a NEW grammar primitive = the piece evolution CANNOT do (mutation explores WITHIN the grammar; it cannot INVENT a construct outside it). T5 proves it. FOUND THE HARD WAY: naive greedy single-gene evolution got STUCK in a local optimum; escaping it needed multi-gene mutation + random restart (iterated local search) = classical EA mechanics, NOT an LLM. T1 EVOLVE-TEST-SELECT solves a target with NO LLM, NO exhaustive enumeration (mutation + environment selection). T2 MEASURED: evolution finds it in FAR fewer evaluations than blind random search (selection/environment works). T3 the evolved program GENERALIZES on held-out (it's a real solution, not memorized). T4 ENRICHMENT: a RETRIEVED prior that NARROWS the space (search-engine proxy) makes evolution far cheaper. T5 THE ONE LLM PIECE: an OUT-OF-GRAMMAR target (x^4 vs a cubic-only construct) is UNREACHABLE -> grammar EXPANSION. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_ncf_synth.nx nx_syscalls.nx nx_evo_synth_gate.nx

imports: nx_ncf_synth.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ncf_w sys_write sys_mmap evolve sys_mmap ↻ rand_gene lcg_next g_error ncf_loop_eval3 lcg_next ↻ random_search sys_mmap ↻ rand_gene ↻ g_error ↻ ncf_n sys_write ↻ sys_mmap ↻ ncf_loop_eval3 ↻ sys_exit

structs

none

consts

none

functions

24func lcg_next(st: *i64) -> i64 { st[0]=((1103515245*st[0])+12345)&2147483647; return st[0] }
called by 2: rand_geneevolve
25func rand_gene(st: *i64, lo: i64, hi: i64) -> i64 { return lo+(lcg_next(st)%((hi-lo)+1)) }
called by 2: evolverandom_search calls 1: lcg_next
29func g_error(g: *i64, xs: *i64, ys: *i64, n: i64) -> i64
called by 2: evolverandom_search calls 1: ncf_loop_eval3
37func evolve(xs: *i64, ys: *i64, n: i64, seed: i64, lo: i64, hi: i64, evalbox: *i64, best: *i64) -> i64
79func main() -> i64