|
| 1 | +const std = @import("std"); |
| 2 | +const tc = @import("../src/trinity_constants.zig"); |
| 3 | +const jepa = @import("../src/jepa_t.zig"); |
| 4 | + |
| 5 | +pub fn main() !void { |
| 6 | + const writer = std.io.getStdOut().writer(); |
| 7 | + |
| 8 | + try writer.print("IGLA-GF16 Architecture Verification\n", .{}); |
| 9 | + try writer.print("====================================\n\n", .{}); |
| 10 | + |
| 11 | + try writer.print("Architecture:\n", .{}); |
| 12 | + try writer.print(" d_model = {} (Fib(12))\n", .{tc.D_MODEL}); |
| 13 | + try writer.print(" n_heads = {} (Fib(6))\n", .{tc.N_HEADS}); |
| 14 | + try writer.print(" d_head = {} (d_model/n_heads)\n", .{tc.D_HEAD}); |
| 15 | + try writer.print(" d_ffn = {} (Fib(13) = d_model*phi)\n", .{tc.D_FFN}); |
| 16 | + try writer.print(" n_layers = {}\n", .{tc.N_LAYERS}); |
| 17 | + try writer.print(" vocab = {} (GPT-2 BPE)\n\n", .{tc.VOCAB}); |
| 18 | + |
| 19 | + const total_mb = jepa.totalMB(); |
| 20 | + const encoder_params = jepa.encoderParams(); |
| 21 | + const predictor_params = jepa.predictorParams(); |
| 22 | + const total_params = jepa.totalParams(); |
| 23 | + |
| 24 | + try writer.print("Parameter Count:\n", .{}); |
| 25 | + try writer.print(" Encoder: {d:>12} params ({d:.1} MB GF16)\n", .{ encoder_params, @as(f64, @floatFromInt(encoder_params)) * 2.0 / 1048576.0 }); |
| 26 | + try writer.print(" Predictor: {d:>12} params ({d:.1} MB GF16)\n", .{ predictor_params, @as(f64, @floatFromInt(predictor_params)) * 2.0 / 1048576.0 }); |
| 27 | + try writer.print(" Total: {d:>12} params ({d:.1} MB GF16)\n", .{ total_params, total_mb }); |
| 28 | + try writer.print(" Budget: 16.0 MB GF16 — {}\n\n", .{if (total_mb <= 16.0) "PASS" else "FAIL"}); |
| 29 | + |
| 30 | + try writer.print("Trinity Constants:\n", .{}); |
| 31 | + try writer.print(" PHI = {d:.16}\n", .{tc.PHI}); |
| 32 | + try writer.print(" PHI^2 = {d:.16}\n", .{tc.PHI_SQ}); |
| 33 | + try writer.print(" 1/PHI^2 = {d:.16}\n", .{tc.PHI_INV_SQ}); |
| 34 | + try writer.print(" Trinity = {d:.16} (should be 3.0)\n", .{tc.TRINITY}); |
| 35 | + try writer.print(" ALPHA_PHI = {d:.16} (= phi - 1.5)\n", .{tc.ALPHA_PHI}); |
| 36 | + try writer.print(" phi-split = {d:.3} (encoder/predictor)\n\n", .{jepa.PhiSplit}); |
| 37 | + |
| 38 | + try writer.print("Proofs:\n", .{}); |
| 39 | + const trinity_err = @abs(tc.TRINITY - 3.0); |
| 40 | + try writer.print(" [1] Trinity Identity |phi^2+1/phi^2 - 3| = {e} {}\n", .{ trinity_err, if (trinity_err < 1e-12) "PASS" else "FAIL" }); |
| 41 | + const fib_proof = @as(f64, @floatFromInt(tc.D_MODEL)) * tc.PHI; |
| 42 | + const fib_err = @abs(fib_proof - @as(f64, @floatFromInt(tc.D_FFN))); |
| 43 | + try writer.print(" [5] Fib proof 144*phi = {d:.2} vs d_ffn={d} |err|={e} {}\n\n", .{ fib_proof, @as(f64, @floatFromInt(tc.D_FFN)), fib_err, if (fib_err < 0.1) "PASS" else "FAIL" }); |
| 44 | +} |
0 commit comments