interplane.Get Omega
Read in your language

aien-train

AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.

Brought by drakestapleton

branch main Branches Tags History

aien-train / native / neuralese / nl1r-task / task.om

244 lines · 3661 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note Frozen NL6-NL1R-20261028-1; imports unchanged capacity.om and wire.om.
3note TC is shared task, seed, split; receiver reads only task plus explicit context.
4global TC ulong 3
5global TL ulong 1
6
7fn tpar id ulong to ulong
8ret and xor xor id shr id 1 xor shr id 2 shr id 3 1
9end
10fn tactive j ulong to bool
11if eq get TC 0 1
12ret eq j 0
13end
14if eq get TC 0 2
15ret ge j 2
16end
17ret true
18end
19fn tprep id ulong to void
20ninput id id
21if eq get TC 0 1
22put NT 0 f64 tpar id
23end
24nsend
25nrecv
26note Inactive residuals are zero; their targets are not learned or communicated.
27for j ulong 4
28if not tactive j
29put NT j get NO j
30end
31end
32end
33fn tloss id ulong to f64
34tprep id
35ret nloss
36end
37fn ttrain mask ulong to int
38for epoch ulong 2000
39for id ulong 16
40if ne and shr mask id 1 0
41tprep id
42ngrad
43rc = nstep 0.1f64
44if ne rc 0
45ret rc
46end
47end
48end
49end
50ret 0
51end
52fn tclear to void
53for i ulong 32
54put WB i uchar 0
55end
56put TL 0 0
57end
58fn tencode id ulong arm ulong variant ulong to int
59tclear
60if or gt id 15 or gt arm 4 gt variant 2
61ret 2
62end
63if or eq variant 2 eq arm 3
64ret 0
65end
66src = id
67if eq variant 1
68src = and add id 1 15
69end
70if eq arm 0
71v = src
72if eq get TC 0 1
73v = tpar src
74end
75if eq get TC 0 2
76v = shr src 2
77end
78put WB 0 uchar v
79put TL 0 1
80ret 0
81end
82if eq arm 4
83for j ulong 4
84put WB j uchar add and shr src j 1 48
85end
86put TL 0 4
87ret 0
88end
89ninput src src
90nsend
91v = ulong 0
92for j ulong 4
93h = get NH j
94if not le fabs h 1.0f64
95ret 2
96end
97q = ulong 0
98if eq arm 1
99note Exact frozen inference quantizer; not a straight-through training rule.
100r = add div mul 3.0f64 add h 1.0f64 2.0f64 0.5f64
101q = ulong r
102if gt q 3
103q = 3
104end
105v = or v shl q mul j 2
106else
107if ge h 0.0f64
108q = 1
109end
110v = or v shl q j
111end
112end
113put WB 0 uchar v
114put TL 0 1
115ret 0
116end
117fn tcanon context ulong to void
118if eq get TC 0 1
119for j ulong 3
120put NO add j 1 0.0f64
121end
122end
123if eq get TC 0 2
124put NO 0 f64 and context 1
125put NO 1 f64 and shr context 1 1
126end
127end
128fn tbits value ulong context ulong to void
129for j ulong 4
130put NO j f64 and shr value j 1
131end
132tcanon context
133end
134fn tvalid arm ulong variant ulong context ulong bytes ulong to bool
135if or gt get TC 0 2 or gt arm 4 gt variant 2
136ret false
137end
138if eq variant 2
139ret false
140end
141if eq get TC 0 2
142if gt context 3
143ret false
144end
145else
146if ne context 0
147ret false
148end
149end
150want = ulong 1
151if eq arm 3
152want = 0
153end
154if eq arm 4
155want = 4
156end
157ret eq bytes want
158end
159fn tdecode schema ulong arm ulong variant ulong context ulong bytes ulong effect ulong to int
160note No sample ID, sender NX/NT, or training mask is consulted by this receiver.
161if or ne schema 2 ne effect 0
162ret 2
163end
164if ne get NSH 0 1
165ret 2
166end
167if ne get NSH 1 4
168ret 2
169end
170if ne get NSH 2 40
171ret 2
172end
173if not tvalid arm variant context bytes
174ret 2
175end
176ret treceive arm context
177end
178fn treceive arm ulong context ulong to int
179v = ulong get WB 0
180if eq arm 0
181limit = ulong 15
182if eq get TC 0 1
183limit = 1
184end
185if eq get TC 0 2
186limit = 3
187end
188if gt v limit
189ret 2
190end
191if eq get TC 0 2
192v = shl v 2
193end
194tbits v context
195ret 0
196end
197if eq arm 4
198v = 0
199for j ulong 4
200c = get WB j
201if not or eq c 48 eq c 49
202ret 2
203end
204v = or v shl ulong sub c 48 j
205end
206if eq get TC 0 1
207v = tpar v
208end
209tbits v context
210ret 0
211end
212if and eq arm 2 gt v 15
213ret 2
214end
215for j ulong 4
216h = 0.0f64
217if eq arm 1
218q = and shr v mul j 2 3
219h = div sub mul 2.0f64 f64 q 3.0f64 3.0f64
220end
221if eq arm 2
222h = sub mul 2.0f64 f64 and shr v j 1 1.0f64
223end
224put WH j h
225end
226note All schema, context, shape and bytes validated before output/state commit.
227for j ulong 4
228put NH j get WH j
229end
230nrecv
231tcanon context
232ret 0
233end
234fn tabst rc int to ulong
235if ne rc 0
236ret 1
237end
238for j ulong 4
239if and tactive j lt fabs sub get NO j 0.5f64 0.1f64
240ret 1
241end
242end
243ret 0
244end