Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
artificial-intelligence
recursive-self-improvement
continual-learning
representation-learning
world-models
cognitive-architecture
File size: 17,362 Bytes
1c1abed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | """Reproduce finite exact experiments. No transformer, GPU or network required.
Strong conventional baselines are reported. Greater closure rank is NOT called
an intelligence score, and selection-only budgets are NOT total compute matches.
"""
from __future__ import annotations
from pathlib import Path
import sys
ROOT=Path(__file__).resolve().parent
sys.path.insert(0,str(ROOT/'src'))
import argparse, json, platform, subprocess, time
from itertools import combinations
import numpy as np
from axiomesh.core import *
from axiomesh.esre_v01 import (rank_mod, rref_mod, CentralExtension, wedge_row,
coefficients_to_omega, RelationalMemory, learn_from_relations)
def chain(d, active=None):
active=d if active is None else active
a,b=np.eye(d,dtype=np.int64),np.eye(d,dtype=np.int64)
for j in range(active-1):
(a if j%2==0 else b)[j,j+1]=1
return np.eye(d,dtype=np.int64)[:1],{'a':a,'b':b}
def conventional_batch_closure(q,ops,p):
"""Independent classical batch observability baseline. Not a novel method."""
r,piv=rref_mod(q,p);r=r[:len(piv)];products=0
while True:
stack=[r]
for t in ops.values():
stack.append(r@t%p);products+=len(r)
rr,piv=rref_mod(np.vstack(stack),p);rr=rr[:len(piv)]
if len(rr)==len(r):return rr,products
r=rr
def checks_for_model(frozen,q,ops,x,p,rng,n=200):
names=list(ops);correct=0
for _ in range(n):
word=tuple(rng.choice(names,size=int(rng.choice([0,1,2,4,8,16,32]))))
truth=q@word_matrix(word,ops,p)@x%p
correct+=int(np.array_equal(frozen.run(word),truth))
return correct
def experiment_counterexample():
q,ops=chain(3);p=101
m=Memory(np.eye(3,dtype=np.int64)[:2],np.array([3,4]),p)
c=close_operators(q,ops,p);certificate=hole_certificate(c,m)
x=np.array([3,4,2]);v=np.array(certificate['null_vector'])
word=certificate['word']
return {'current_query_status':m.recall(q)[0], 'future_status':weave(q,ops,m).status,
'certificate':certificate,'compatible_state_1':x.tolist(),'compatible_state_2':((x+v)%p).tolist(),
'future_output_1':(q@word_matrix(word,ops,p)@x%p).tolist(),
'future_output_2':(q@word_matrix(word,ops,p)@(x+v)%p).tolist()}
def experiment_closure_and_frozen(rng):
rows=[]
for active,d in [(4,8),(8,16),(12,24),(16,32),(24,48),(32,64)]:
p=101;q,ops=chain(d,active);x=rng.integers(p,size=d)
t=time.perf_counter();c=close_operators(q,ops,p);proposed_sec=time.perf_counter()-t
t=time.perf_counter();b,products=conventional_batch_closure(q,ops,p);baseline_sec=time.perf_counter()-t
f=c.compile(c.basis@x%p);base_seed=b@x%p
bh={a:coordinates(b@t%p,b,p) for a,t in ops.items()}
bf=FrozenModel(p,base_seed,bh,coordinates(q,b,p))
words=[tuple(rng.choice(['a','b'],size=int(rng.integers(0,65)))) for _ in range(300)]
cp=cb=0
for word in words:
truth=q@word_matrix(word,ops,p)@x%p
cp+=int(np.array_equal(f.run(word),truth));cb+=int(np.array_equal(bf.run(word),truth))
e=emergence_rank(q,[{'a':ops['a']},{'b':ops['b']}],p)
rows.append({'ambient_dimension':d,'quotient_rank':c.rank,'mixed_depth':c.depth,
'isolated_union_rank':e['isolated_union_rank'],'emergence_rank':e['emergence_rank'],
'test_words':len(words),'weave_correct':cp,'classical_correct':cb,
'weave_row_products':c.row_operator_products,'batch_row_products':products,
'weave_wall_seconds':proposed_sec,'batch_wall_seconds':baseline_sec,
'dense_runtime_matvec_symbols_per_action':{'source':d*d,'quotient':active*active},
'optimized_classical_worklist_expected_products':2*c.rank})
return {'rows':rows,'scope':'Known finite operator matrices; classical optimized worklist has the same algorithmic complexity. Dense matvec counts do not compare against sparse source execution.'}
def experiment_erasures(rng):
rows=[]
for r,e in [(4,3),(8,4),(12,4)]:
for erased in [0,e,e+1]:
exact=ambiguous=false=0
for trial in range(100):
y=rng.integers(101,size=r);cap=Capsule.encode(y,101,e)
lost=rng.choice(list(cap.shares),size=erased,replace=False).tolist()
status,got=cap.erase(lost).recover()
exact+=status=='exact';ambiguous+=status=='ambiguous'
false+=status=='exact' and not np.array_equal(y,got)
rows.append({'rank':r,'stored_symbols':r+e,'erased_symbols':erased,'trials':100,
'exact':int(exact),'abstentions':int(ambiguous),'false_certificates':int(false)})
return {'rows':rows,'baseline':'Ordinary Reed-Solomon erasure decoding is identical; novelty is not assigned to this result.'}
def experiment_curriculum(rng):
p=101;d=18;x=rng.integers(p,size=d);q=np.eye(d,dtype=np.int64)[:1]
mem=Memory(q,q@x%p,p);ops={};rows=[];total_acquired=0
for j in range(15):
t=np.eye(d,dtype=np.int64);t[j,j+1]=1;ops[f't{j}']=t
result=weave(q,ops,mem,oracle=lambda row:int(row@x)%p,observation_budget=1,erasure_budget=2)
total_acquired+=result.acquisitions;mem=result.memory
lost=list(result.capsule.shares)[:2];status,seed=result.capsule.erase(lost).recover()
result.offspring.seed=seed
correct=checks_for_model(result.offspring,q,ops,x,p,rng,n=100)
rows.append({'round':j+1,'rank':result.closure.rank,'new_observations':result.acquisitions,
'after_erasure':status,'correct':correct,'tested':100})
return {'rows':rows,'additional_observations':total_acquired,'initial_observations':1,
'source_dimension':d,'final_rank':len(mem.matrix),
'interpretation':'Incremental capability-library growth in a supplied linear family; not autonomous improvement of a neural proposer.'}
def experiment_gauge(rng):
correct=0;trials=100;p=17;d=6
q,ops=chain(d)
original=close_operators(q,ops,p)
for _ in range(trials):
while True:
g=rng.integers(p,size=(d,d))
if rank_mod(g,p)==d:break
gi=inverse(g,p);x=rng.integers(p,size=d)
transformed={a:g@t@gi%p for a,t in ops.items()};qt=q@gi%p
c=close_operators(qt,transformed,p)
f=c.compile(c.basis@g@x%p)
word=tuple(rng.choice(['a','b'],size=20))
correct+=int(np.array_equal(f.run(word),q@word_matrix(word,ops,p)@x%p))
return {'trials':trials,'exact_gauge_equivalent_outputs':correct,
'mapping_information':'Invertible chart maps supplied by the lineage, not guessed from unpaired data.'}
def experiment_bundle_scheduler():
p=101;core=24;distractors=6;d=core+2*distractors
q,ops=chain(d,core)
for i in range(distractors):
t=np.eye(d,dtype=np.int64);j=core+2*i;t[0,j]=1;t[j,j+1]=1;ops[f'd{i}']=t
names=list(ops)
selected=[];greedy_evaluations=0;greedy_products=0
for _ in range(2):
candidates=[]
for a in names:
if a in selected:continue
c=close_operators(q,{k:ops[k] for k in selected+[a]},p)
greedy_evaluations+=1;greedy_products+=c.row_operator_products
candidates.append((c.rank,a))
best=max(candidates,key=lambda t:(t[0],t[1]))
selected.append(best[1])
gc=close_operators(q,{k:ops[k] for k in selected},p)
bundles=[];pair_products=0
for pair in combinations(names,2):
c=close_operators(q,{k:ops[k] for k in pair},p);pair_products+=c.row_operator_products
bundles.append((c.rank,pair))
rank,pair=max(bundles,key=lambda t:t[0])
return {'operator_candidates':len(names),'live_operator_budget':2,
'individual_greedy':{'selected':selected,'rank':gc.rank,'evaluations':greedy_evaluations,'row_products':greedy_products},
'bounded_bundle_search':{'selected':list(pair),'rank':rank,'evaluations':len(bundles),'row_products':pair_products},
'conventional_exhaustive_baseline_rank':rank,
'warning':'Equal live-operator capacity, NOT equal total selection compute. Conventional pair search matches. Rank is not general intelligence.'}
def experiment_partial_execution():
p=101;m=Memory(np.array([[1,0,0]]),np.array([7]),p)
ops={'swap':np.array([[0,1,0],[1,0,0],[0,0,1]]),
'reset':np.zeros((3,3),dtype=np.int64)}
q=np.eye(3,dtype=np.int64)[:1]
rows=[{'word':list(w),**execute_partial(m,ops,q,w)} for w in [(),('swap',),('swap','swap'),('reset',),('reset','swap')]]
return {'rows':rows,'full_state_status':m.recall(np.eye(3,dtype=np.int64))[0],
'interpretation':'Some future answers remain exact despite full-state ambiguity; this does not restore erased past information.'}
def experiment_learned_esre_pipeline(rng,out):
p=101;n=8;a=rng.integers(p,size=n);b=rng.integers(p,size=n)
omega=(np.outer(a,b)-np.outer(b,a))%p
truth=CentralExtension(omega,p)
count=n*(n-1) # twice the number of independent alternating coefficients
probes=[];values=[]
for _ in range(count):
u,v=rng.integers(p,size=(2,n));probes.append(wedge_row(u,v,p));values.append(truth.commutator(u,v))
mem=RelationalMemory(np.array(probes),np.array(values),p)
learned=learn_from_relations(mem,n)
assert learned is not None
q,ops=affine_extension_operators(learned.omega,p)
state=np.r_[rng.integers(p,size=n),int(rng.integers(p)),1]
m0=np.eye(n+2,dtype=np.int64)[[n,n+1]]
result=weave(q,ops,Memory(m0,m0@state%p,p),oracle=lambda row:int(row@state)%p,
observation_budget=n,erasure_budget=3)
damaged=result.capsule.erase([1,2,3]);status,restored=damaged.recover()
result.offspring.seed=restored
names=list(ops);correct=classical=0;tests=2000
for _ in range(tests):
word=tuple(rng.choice(names,size=int(rng.integers(1,65))))
answer=result.offspring.run(word)
# Independent conventional group composition implementation.
sx,sz=state[:n].copy(),int(state[n])
for action in word:
u=np.zeros(n,dtype=np.int64);u[int(action[1:])]=1 if action[0]=='+' else -1
sx,sz=learned.multiply((sx,sz),(u,0))
# Ground truth uses independently retained true omega.
tx,tz=state[:n].copy(),int(state[n])
for action in word:
u=np.zeros(n,dtype=np.int64);u[int(action[1:])]=1 if action[0]=='+' else -1
tx,tz=truth.multiply((tx,tz),(u,0))
correct+=int(int(answer[0])==tz);classical+=int(sz==tz)
payload={'format':'axiomesh-frozen-v0.2','program':result.offspring.json_object(include_seed=False),
'memory':damaged.json_object()}
path=out/'frozen_erased_seed.json';path.write_text(json.dumps(payload,indent=2))
env=dict(__import__('os').environ);env['PYTHONPATH']=str(ROOT/'src')
word='+0,+1,-0,-1,+2'
proc=subprocess.run([sys.executable,'-m','axiomesh.cli',str(path),'--word',word],env=env,capture_output=True,text=True,check=True)
fresh=json.loads(proc.stdout)
expected=result.offspring.run(tuple(word.split(','))).tolist()
assert fresh['output']==expected
# Fresh seed is absent; generation of the model matrices has already occurred.
actual_bytes=len(json.dumps(payload,separators=(',',':')).encode())
full_model=FrozenModel(p,state,ops,q).json_object()
full_bytes=len(json.dumps(full_model,separators=(',',':')).encode())
return {'ambient_dimension':n+2,'omega_rank':rank_mod(omega,p),
'supplied_alternating_family_parameters':n*(n-1)//2,'mixed_probes':count,'primitive_oracle_actions':4*count,
'learned_omega_exact':bool(np.array_equal(learned.omega,omega)),
'quotient_rank':result.closure.rank,'initial_state_measurements':2,'additional_state_measurements':result.acquisitions,
'stored_seed_code_symbols':len(result.capsule.shares),'deleted_seed_symbols':3,'state_recovery':status,
'test_words':tests,'weave_correct':correct,'conventional_pooled_group_correct':classical,
'fresh_process':fresh,'serialized_frozen_payload_bytes':actual_bytes,
'serialized_uncoded_dense_source_bytes':full_bytes,
'limitations':'Algebraic family, action coordinates and observation language supplied. Constant coordinate is encoded and counted. JSON byte comparison excludes offline compiler and source training archive; strong quotient compiler can match.'}
def experiment_operator_excision(rng):
p=101;r=4;h=rng.integers(p,size=(r,r));cap=Capsule.encode(h.ravel(),p,4)
# Decoder below receives only rank and surviving relations, not original h.
damaged=cap.erase([1,2,3,4]);status,reconstructed=damaged.recover()
return {'matrix_shape':[r,r],'stored_symbols':len(cap.shares),'deleted_symbols':4,
'status':status,'exact_operator':bool(np.array_equal(reconstructed.reshape(r,r),h)),
'baseline':'Conventional polynomial erasure code exactly matches. Additional metadata must survive.'}
def experiment_damage_property(rng):
trials=200;false=0;exact=ambiguous=0
p=3;d=4
for _ in range(trials):
m=rng.integers(p,size=(int(rng.integers(0,6)),d));q=rng.integers(p,size=(2,d));x=rng.integers(p,size=d)
memory=Memory(m,m@x%p,p);status,y,v=memory.recall(q)
# Enumerate the entire compatible world fiber, not just the true state.
worlds=np.array(list(__import__('itertools').product(range(p),repeat=d)),dtype=np.int64)
compatible=worlds[np.all((worlds@m.T-m@x)%p==0,axis=1)]
answers=compatible@q.T%p;identifiable=bool(np.all(answers==answers[0]))
exact+=status=='exact';ambiguous+=status=='ambiguous'
false+=int((status=='exact')!=identifiable)
if status=='exact':false+=int(not np.array_equal(y,q@x%p))
return {'trials':trials,'worlds_enumerated_per_trial':p**d,'exact':exact,'ambiguous':ambiguous,
'incorrect_certificates':false}
def experiment_recursive_fracture(rng,out):
p=101;d=9;q=np.eye(d,dtype=np.int64)[:1];ops={}
for j in range(d-1):
t=np.eye(d,dtype=np.int64);t[j,j+1]=1;ops[f't{j}']=t
x=rng.integers(p,size=d)
source=Memory(np.eye(d,dtype=np.int64),x,p)
tree=fractalize(q,ops,source,max_depth=3)
path=out/'recursive_fracture.json';path.write_text(json.dumps(tree,indent=2))
restored=regenerate_tree(json.loads(path.read_text()))
observations=[];nodes=0;max_depth=0;stored=0
def visit(node,depth):
nonlocal nodes,max_depth,stored
nodes+=1;max_depth=max(max_depth,depth)
item=node['memory'] if node['kind']=='leaf' else node['tether']
rows=np.asarray(item['matrix'],dtype=np.int64).reshape(-1,item['width'])
observations.extend(rows);stored+=len(item['rhs'])
for child in node.get('children',[]):visit(child,depth+1)
visit(tree,0)
correct=checks_for_model(restored.offspring,q,ops,x,p,rng,n=300)
# Two-child minimal seam demonstration.
cq,cops=chain(12);cx=rng.integers(p,size=12)
split=split_with_tether(cq,cops,Memory(np.eye(12,dtype=np.int64),cx,p),[['a'],['b']])
return {'nodes':nodes,'depth':max_depth,'raw_state_symbols':stored,
'independent_state_symbols':rank_mod(np.asarray(observations),p),
'source_behavior_rank':restored.closure.rank,'test_words':300,'correct':correct,
'serialized_tree_bytes':len(path.read_bytes()),
'minimal_tether_example':{'parent_rank':split.parent_rank,'child_union_rank':split.child_union_rank,
'tether_symbols':split.tether_symbols},
'qualification':'The physical tree duplicates shared coordinates. Nine independent symbols do not mean nine total stored symbols; the raw tree stores sixteen plus substantial program/map metadata.'}
def main():
ap=argparse.ArgumentParser(description=__doc__);ap.add_argument('--seed',type=int,default=20261007)
ap.add_argument('--output',type=Path,default=ROOT/'results');args=ap.parse_args()
args.output.mkdir(parents=True,exist_ok=True);rng=np.random.default_rng(args.seed);start=time.perf_counter()
results={'version':'0.2.0','seed':args.seed,'scope':'Finite exact CPU experiments, not general AI or transformer benchmarks.',
'environment':{'python':platform.python_version(),'numpy':np.__version__,'platform':platform.platform()},
'counterexample':experiment_counterexample(),
'closure_and_frozen':experiment_closure_and_frozen(rng),
'erasure_recovery':experiment_erasures(rng),
'recursive_curriculum':experiment_curriculum(rng),
'cross_chart':experiment_gauge(rng),
'bundle_scheduler':experiment_bundle_scheduler(),
'partial_execution':experiment_partial_execution(),
'learned_esre_pipeline':experiment_learned_esre_pipeline(rng,args.output),
'operator_excision':experiment_operator_excision(rng),
'exhaustive_identifiability':experiment_damage_property(rng),
'recursive_fracture':experiment_recursive_fracture(rng,args.output)}
results['elapsed_seconds']=time.perf_counter()-start
(args.output/'results.json').write_text(json.dumps(results,indent=2),encoding='utf8')
print(json.dumps({'result_file':str(args.output/'results.json'),'elapsed_seconds':results['elapsed_seconds'],
'learned_pipeline':results['learned_esre_pipeline'],'scheduler':results['bundle_scheduler']},indent=2))
if __name__=='__main__':main()
|