v0.24.0-readme

ada-ai-amplifier

Readable AI building blocks in Ada. The tensor kernels are SPARK. The network, the tokenizer, and attention are plain Ada. The parts that run in the browser are compiled from that Ada to WebAssembly. The splash is a picture of that idea: points and weights flow into a small network. Ada computes every position. JavaScript only draws.

The network in the splash is a drawing. It is not trained.

Tensor demo

Edit the matrix and the vector, then Compute. Ada multiplies them and runs softmax on the product. JavaScript only passes the numbers. The shapes are 3 and 3, so the shape checks pass. Mat-vec and softmax are Silver: no run-time error, and softmax stays in range. The numeric product is not proved. A component past 1e18 fails the product check, and on this page the module stops. The panel wrapper is plain Ada. This is not a trained network.

Matrix

Vector

Product

………

Softmax

………

Leaky ReLU

Three numbers go in. Ada applies leaky ReLU: a positive number stays, and any other number is multiplied by the slope. That component rule is a Gold proof. The slope figure is read from Ada. JavaScript only copies the boxes. The How-To walks through this kernel.

Slope …

Input

Output

………

Train a small network

Two inputs, eight tanh units, one sigmoid output. Ada initializes the weights from a fixed seed, then runs the forward pass, binary cross-entropy, and gradient descent. JavaScript draws the loss and the decision boundary. It does not train. The splash above is still only a drawing.

step 0 · loss … · rate 0.50

Waiting for the Ada module.

Gold is class 1, blue is class 0. The heat is the network's probability. Eight hidden units separate XOR and the two circles. The spirals are a harder cut: the loss falls, and the boundary stays a rough one.

Weights

The same network, as text. Ada writes one labelled line per neuron and checks the shape and each value when a file comes back. The hand-written XOR net was never trained: hidden 1 is OR, hidden 2 is AND, and the output is OR and not AND. A slider or a number writes one weight into Ada, and Ada recomputes the boundary above. JavaScript does not do that arithmetic. Reset to trained puts back the last training step on this dataset, or the seeded start if training has not run.

Waiting for the Ada module.

Training speed

The same XOR net, from the same seed, at rate 1. Ada trains it for the step count it reports, repeated so the clock has a duration to read. A run counts only when the loss and the four answers pass the same checks as the native test. The baseline calls that trainer once per step. The faster variant is the same update, written in place, without the extra loss pass between steps. Ada times the work and rejects a run that moved the steps outside the clock, skipped steps, or changed the batch. JavaScript reads the host clock around the call and passes the two readings in. It does not train.

Waiting for the Ada module.

The published microseconds are a record from the machine that added this page. A different computer will not match them. The comparison that matters is the faster variant against the baseline on this page. This is not someone else's speedup.

Tokens and attention

Type in the box. JavaScript sends the UTF-8 bytes. Ada learns a small byte-level vocabulary from a public-domain excerpt, splits the text into those pieces, and runs one causal attention block. The colours and the heatmap are a drawing of what Ada returned. The block is not trained. Its weights are a fixed seed.

Waiting for the Ada module.

Waiting for the Ada module.

Each chip is one token, with its id. A gold cell is the weight that token gives an earlier one, including itself. Dark cells are the future, and the mask sets them to zero. A row adds up to one. In this vocabulary ß is one learned piece and ä is still two bytes.

Recursive prompts

A state blob stands in for a prompt that would call itself. It carries a Fibonacci index and two running values. Ada reads each next blob and stops at the first one that is wrong: the text has to parse, the index has to move one step closer to zero, and the two values have to follow the recurrence. These chains are recorded in the module. The page does not call a language model and does not send a key.

Waiting for the Ada module.

A native program can ask a model for the next blob. It does that only when you give it your own key, and this page never runs that program.

Wrong turns

Four traces of this XOR trainer, each ending on a step that left the net in a bad state. Ada replays the trace up to that step. Pick a next step from the menu. Ada runs it on the trainer and says whether it fixes the net, leaves it no better, or makes it worse, and which rule decided. The known-good step is shown beside that verdict. JavaScript only copies the words. This page does not call a model.

Waiting for the Ada module.

    This step

    Known-good step

    A native program can ask a model for the next step. It does that only when you give it your own key, and this page never runs that program.

    Benchmark audit

    Twenty short tasks about this repository's XOR labels, its Fibonacci checker, and its weight files. Five of them are broken on purpose. Ada checks every task before it scores. A score that still includes a flagged task is not accepted. The second line is the same samples with those tasks removed. JavaScript only copies the words. This page does not call a model, and it does not read a task file from disk.

    Waiting for the Ada module.

      audit_cli prints this same report for the built-in tasks, or for a task file you pass it. The page does not run that program.

      Reward hacking

      One task: make the XOR net right. The flawed grader trusts a low reported loss, or two outputs above 0.5, or an answer that only looks finished. The real check runs the net again and requires every XOR output to be at least 0.8 or at most 0.2, on the correct side. Only that check counts. The cheats are written in Ada. They are not a model's replies. A hill-climb then tunes the weights from a fixed seed. One search climbs the flawed proxy. The other climbs the real loss. Yellow on each curve is the score that search is aimed at. Blue is the other score. JavaScript only draws.

      Waiting for the Ada module.

      Aimed at the flawed proxy

      Aimed at the real check

      reward_cli prints this same table, and it can run either search. The page does not run that program. This is a toy with planted gaps. It is not evidence of how often a real model does this.

      Same model, different harness

      One Ada solver, four harnesses, the same eight tasks and the same seed. One-shot keeps the first reply. Retry keeps the first reply that parses. Checked runs each step through the Fibonacci checker or the wrong-turn checker and does not keep a failed step. Budgeted is that check with three calls. The solver does not change. Pick a task to see where the four walks diverge. JavaScript only copies the words. This page does not call a model. The solver is a tiny fixed procedure, so the table is not a measurement of a real model.

      Waiting for the Ada module.

      Harness Solve rate Steps Wrong accepted

      harness_cli prints this same table. It can ask a model for the checked harness only when you give it your own key, and this page never runs that program.

      Checked steps, not just answers

      Twelve worked solutions of this repository's own arithmetic. One grade looks only at the final answer. The other accepts a solution only when every step matches a value Ada recomputes. Pick a row. The first bad step is marked. JavaScript only copies the words. Ada can check these steps because each one is recomputed from code in this repository. Most real reasoning is not like that.

      Waiting for the Ada module.

      Solution Answer only Steps

        steps_cli prints this same table. Give it a solution file and it grades that file. The page does not run that program. A right answer is not enough. What this checks.

        Reasoning summary vs checked steps

        Eight worked problems. Each one has a short summary written in this repository, and the steps that were actually taken. Ada checks each step on its own with the item 15 checker: checked-correct, checked-wrong, or not checkable. A summary that leaves out a failed step, claims a step that never happened, or tells a smoother story is marked. These summaries were written here. They are not a model's words. JavaScript only draws.

        Waiting for the Ada module.

        Problem Summary check

        Summary

          Checked steps

            summary_cli prints this same table. The page does not run that program. A clean sentence is not a checked step. What a summary does not show.

            Locked statements

            Nineteen statements: items 1 through 19. Each one is the plain Ada assertions in specs/. This build ran them. The fingerprint is the SHA-256 of that source. JavaScript only copies the words. A fingerprint stops a silent edit. It cannot tell whether a spec is the right one.

            Waiting for the Ada module.

            Item Statement Fingerprint This build

            What a fingerprint does not show.

            Second checker

            The verdicts of the wrong turns, the benchmark audit, and the checked steps are graded twice. The second grader does not call the first. This build compared them. JavaScript only draws the counts.

            Waiting for this build's report.

            Item Cases Agree
            
                  
            pair 11 44 44
            pair 12 22 22
            pair 15 12 12

            Agreement makes a shared bug less likely. It does not prove either checker right. Both were written in this project. What an agreement does not prove.

            Checking status

            Items 1 through 19, each labelled from this build. Proved means that item's own GNATprove run finished with nothing unproved. Tested means the checks named in the row passed, and the row says why that is not a proof. Anything else is unchecked. JavaScript only draws the lines.

            Waiting for this build's report.

            Item Label Evidence
            item 01 proved gnatprove proof/item_01.out summary 18 flow 4 provers 14 unproved 0; unit ai_amplifier-version 3/3 checks 14; spec item_01 pass asserts 5; check-version ok
            item 02 tested item_02 cases 9 spec pass; not proved: the splash is a drawing and is not a proof target
            item 03 proved gnatprove proof/item_03.out summary 414 flow 36 provers 378 unproved 0; unit ai_amplifier-tensors 30/30 checks 378; not in this run: ai_amplifier-tensors-demo, ai_amplifier-tensors-leaky_demo; spec item_03 pass asserts 15
            item 04 tested mlp_test cases 185 spec item_04 pass asserts 19; not proved: gradient descent on float weights is not a proof target
            item 05 tested attention_test cases 48 spec item_05 pass asserts 20; not proved: the tokenizer and the attention block are not a proof target
            item 06 tested item_06 cases 17 spec pass; tensors_test cases 67; not proved: the how-to is a document and the leaky demo is not analyzed
            item 07 proved gnatprove proof/item_07.out summary 414 flow 36 provers 378 unproved 0; unit ai_amplifier-tensors 30/30 checks 378; spec item_07 pass asserts 24
            item 08 tested mlp_test cases 185 spec item_08 pass asserts 27; not proved: weight-file checks run with the program and are not proved
            item 09 proved gnatprove proof/item_09.out summary 6 flow 3 provers 3 unproved 0; unit ai_amplifier-chain_rule 3/3 checks 3; recurse_test cases 37 spec item_09 pass asserts 15; tested against a stand-in model: recurse_cli --ask used RECURSE_LLM_URL, RECURSE_LLM_KEY, and RECURSE_LLM_MODEL; ask_standin cases 36; no real model is called; real-model behaviour stays unchecked
            item 10 tested mlp_test cases 185 spec item_10 pass asserts 18; not proved: a measured training time is not a proof
            item 11 proved gnatprove proof/item_11.out summary 15 flow 4 provers 11 unproved 0; unit ai_amplifier-trace_rule 4/4 checks 11; traces_test cases 4 spec item_11 pass asserts 22; tested against a stand-in model: traces_cli --ask used TRACES_LLM_URL, TRACES_LLM_KEY, and TRACES_LLM_MODEL; ask_standin cases 36; no real model is called; real-model behaviour stays unchecked
            item 12 proved gnatprove proof/item_12.out summary 2 flow 1 provers 1 unproved 0; unit ai_amplifier-audit_rule 2/2 checks 1; audit_test cases 13 spec item_12 pass asserts 11
            item 13 proved gnatprove proof/item_13.out summary 4 flow 2 provers 2 unproved 0; unit ai_amplifier-reward_rule 3/3 checks 2; proved for the accept/reject gate; reward_test cases 9 spec item_13 pass asserts 43; not proved: the two graders score float nets and are not proved
            item 14 tested harness_test cases 406 spec item_14 pass asserts 19; tested against a stand-in model: harness_cli --ask used HARNESS_LLM_URL, HARNESS_LLM_KEY, and HARNESS_LLM_MODEL; ask_standin cases 36; no real model is called; real-model behaviour stays unchecked; not proved: the harness schedule is not a proof target
            item 15 proved gnatprove proof/item_15.out summary 8 flow 4 provers 4 unproved 0; unit ai_amplifier-step_rule 5/5 checks 4; proved for the step-grade rule; steps_test cases 16 spec item_15 pass asserts 10; not proved: a step grade recomputes values and is not a proof
            item 16 proved gnatprove proof/item_16.out summary 11 flow 2 provers 9 unproved 0; unit ai_amplifier-lock_rule 3/3 checks 9; proved for the lock-compare rule; check-locked cases 17 spec item_16 pass asserts 14; not proved: a fingerprint detects an edit and does not prove the spec
            item 17 proved gnatprove proof/item_17.out summary 9 flow 2 provers 7 unproved 0; unit ai_amplifier-agree_rule 4/4 checks 7; proved for the agreement count; recheck_test agree 44 of 44, 22 of 22, 12 of 12 spec item_17 pass asserts 18; not proved: agreement of two checkers is not a proof of either
            item 18 proved gnatprove proof/item_18.out summary 6 flow 3 provers 3 unproved 0; unit ai_amplifier-label_rule 4/4 checks 3; proved for the label rule; spec item_18 asserts 57; not in this run: ai_amplifier-status; not proved: AI_Amplifier.Status is plain Ada and is not a proof target
            item 19 proved gnatprove proof/item_19.out summary 22 flow 7 provers 15 unproved 0; unit ai_amplifier-summary_rules 6/6 checks 15; summary_test cases 36 spec item_19 pass asserts 22; not in this run: ai_amplifier-summary
            summary proved 12 of 19, tested 7, unchecked 0

            Tested is not proved. A label covers the checks named in that row. A live model is not one of them. What a label does not show.

            On this page

            Backlog

            1. 1.Repo skeleton done
            2. 2.Splash and live page done
            3. 3.Core tensor and maths (plain Ada) done
            4. 4.Tiny trainable MLP, live in the browser done
            5. 5.Byte-level BPE tokenizer and one transformer attention block done
            6. 6.Contributor How-To docs done
            7. 7.SPARK proofs of the kernels done
            8. 8.Weight-space programming done
            9. 9.Recursive prompts with an Ada checker done
            10. 10.Training-speed harness done
            11. 11.Wrong-turn traces done
            12. 12.Benchmark audit done
            13. 13.Reward-hacking demo done
            14. 14.Same model, different harness done
            15. 15.Checked steps, not just answers done
            16. 16.Locked statements. Each finished item has a fixed spec. CI fails if its fingerprint changes without specs/LOCK, or if pragma Assume or pragma Annotate appear. Ideas inspired by the statement/proof split in formal-math (Apache-2.0). Independent reimplementation. No code was copied. done
            17. 17.Second, independent checker. A separately written Ada checker re-checks the verdicts of items 11, 12, and 15. CI fails on disagreement. Ideas inspired by the independent kernel check in formal-math (Apache-2.0). Independent reimplementation. No code was copied. done
            18. 18.Checking status on every item. This page and the README label items 1–19 proved, tested, or unchecked, with the numbers from this build. Ideas inspired by labelling results by verification stage in openai/math (Apache-2.0). Independent reimplementation. No code was copied. done
            19. 19.Reasoning summary vs checked steps. Eight written summaries beside the steps Ada checked one at a time. A summary that leaves out a failed step, claims a step that never happened, or tells a smoother story is marked. Ideas inspired by the reasoning summaries in openai/math (Apache-2.0). Independent reimplementation. No code was copied. done
            20. 20.README update after items 1–19. One line per item, with the label this build wrote in STATUS. done

            Proof status

            GNATprove level 2, on AI_Amplifier.Tensors. Silver is absence of run-time error. Gold is that, plus the component rule. Sigmoid, tanh, and softmax are Silver: each result lies in the range below, and the series is not proved equal to the real function. Nothing else in the library is proved.

            KernelStatus
            DotSilver
            Mat-vecSilver
            Mat-matSilver
            AddGold
            ScaleGold
            TransposeGold
            ReLUGold
            Leaky ReLUGold
            SigmoidSilver
            TanhSilver
            SoftmaxSilver
            Splashnot proved
            MLPnot proved
            Training speednot proved
            Tokenizernot proved
            Attentionnot proved
            Recursive promptsrule proved
            Wrong turnsrule proved
            Benchmark auditrule proved
            Reward hackingrule proved
            Harness comparisonnot proved
            Checked stepsrule proved
            Locked statementsrule proved
            Second checkerrule proved
            Checking statusrule proved
            Reasoning summaryrule proved

            Links

            ada-ai-amplifier

            Loading the Ada module…