Stanley Ngugi
I build RL environments for model post training.
I'm Stanley. I'm 20, self taught, and an independent AI researcher working on reinforcement learning and post training. Much of my work so far has focused on mathematical reasoning and coding, particularly building RL environments and designing rewards for these tasks.
Selected writing
An RL Environment Where C Code Has to Be Proved, Not Just Tested
RL, formal methods · 20 min
An RL environment where models write C functions and reward comes from
proving that the code satisfies a fixed specification, rather than from
passing a test suite. The public release includes 64 tasks and an isolated Frama-C judge.
Grading Mathematical Answers Without Answer Keys
RL, formal methods · 23 min
A math RL environment for bounded integer problems that does not store
expected answers. Models return an integer or a complete finite certificate,
and reward comes from checking that submission against the full encoded problem.
Building a Lean-Backed Verifier for Bounded Mathematical Answers
formal methods · 16 min
A verification engine for bounded integer problems. It turns a problem
specification and candidate answer into executable Lean code, checks the
entire finite domain, and gives a definitive result without requiring a proof from the model.
How a Grammar Changes AI-Generated Mathematical Proof Steps
formal methods · 26 min
A study of how grammar masking keeps language-model generations inside the shape of Lean tactics, preventing malformed proof steps without confusing valid syntax with proof correctness.
Building a Grammar for AI-Generated Mathematical Proof Steps
formal methods · 19 min
A practical study of Lean's tactic language: extracting tactic forms from real proofs, designing a grammar around them, and stress-testing what the grammar accepts and rejects.
Taming Incidental Polysemanticity in Toy Models
interpretability · 25 min
How training choices shape feature entanglement in overcomplete toy networks,
using sparse autoencoders to compare the representations learned across
different configurations and random seeds.
Earlier research
Unlearn, Then Learn: A Circuit-Informed Knowledge-Editing Experiment
preprint
An early experiment in changing one factual association in Phi-3-mini:
first locate and suppress the original association, then train a replacement.
The complete experimental pipeline is public.
Targeted Lexical Injection: Early-Layer LoRA for Swahili–English Alignment
preprint
An early experiment using small adapters to strengthen Swahili–English word
alignment already present inside Lugha-Llama, evaluated on training pairs
and a separate set of unseen words.