Stuart Farmer
Evolutionary algorithms, adaptive systems, and tools for quantitative research.
Selected projects
8 projects2026
Hacking the Economy with AgentsEvolving agentic swarms to simulate income and economic inequality and pen-test organizational incentives and social exploitsGitHub, Demo Video - Ongoing
Project Description
-
It's no secret that the world is a bit of a tough place right now. One of those reasons, arguably, is that the system is not working for everyone. However, divising or measuring a new economic or social system has to take in a myriad of factors that are all intertwined and dependent on one another.
-
Luckily, agents offer a potential solution. They can model complex thinking patterns and cover a broader behavioral space than traditional explicit agent-based modelling solutions where each type of player must be explicitly determined prior. We therefore can propose new social and economic systems, encoded into a blockchain where value and 'businesses' in the form of smart contracts can be created, and then measure the economic factors for things like wealth inequality and link that back to the initial conditions and designs of the system.
The standard workflow the agentic swarm and researchers follow when interacting with a blockchain or other standardized environment. -
I am currently leading a team and developing the core technology for this type of system. We've demonstrated agentic swarms in a Runescape virtual economy specializing and improving as a group over time. They explore, create their own skills, and come up with novel strategies to making money.
-
We can change the fitness function to success rate in security testing and have a 'red team versus blue team' product designed for organizations. Phishing, impersonation, and leveraging organizational exploits do more economic damage to companies than explicit technical penetrations which can be patched more easily.
- Skills used
- Multi-agent systems, evolutionary computation, fitness function design, fitness-proportionate selection, agent-based economic modeling, experimental validation, project management, experiment design
- Technology
- TypeScript, Node.js, Bun, SQLite, Docker Compose, RuneBench
Informed Program SearchProviding a larger, and more informed, search space for self-improving agents by using existing corpuses and hierarchical generation - Ongoing
Project Description
-
Based on my previous research of hierarchical concept generation, and a new hypothesis of using an existing corpus of relevant text to provide better steering for the program-generation process in program search, I proposed a new self-improving agent to supercede my earlier EliteTable design.
-
The new agent creates a corpus of ideas to pull from. These are either generated guided by a 2-level concept taxonomy, or pulled from a provided corpus of text that is relevant to the task at hand. The corpus is extracted into concept notes, validated for novelty to prevent repetition of similar ideas, and then provided into the idea bank. The same process occurs if using the 2-level concept taxonomy, except naturally the extraction step is replaced by generation.
A program can win its archive cell even if none of its sampled ideas earns credit. The task score ranks the program. The judge checks which ideas the code actually uses. -
Candidates are proposed from scratch, the product of crossover, or edit operations on an existing candidate. After evaluation on the task, 2-stage judge screens the solution for the recognizable mechanism and requires code evidence of a concept being used before credit is assigned and fed back into the Thompson sampler for the next generation.
-
For parent selection, MAP-Elites was used to prevent similiar elites using the same concepts from dominating the population. Behavior was measured using text embedding vectors of the proposed solution's code
-
In a Bitcoin trading study, 3,906 concepts from a technical-indicator book were used as an idea corpus. I tested whether the source material changed scheduling decisions under a hidden repetition penalty. Across eight cases and 32 priority seeds, the mean ratio of optimal to achieved cost rose from 0.458 without context to 0.843 with reviewed notes and fell to 0.386 with prose from the wrong scheduling world.
-
The work still needs to be formalized into a proper research paper and submitted for review.
- Skills used
- Evolutionary computation, program synthesis, credit assignment, quality-diversity optimization, experimental design, LLM chunking, actor-critic agent design
- Technology
- Python, RSIKit, LangExtract, SQLite, YAML, hierarchical Thompson sampling, MAP-Elites
EliteTableApplying a leaderboard-like self-improving agentic strategy to classic control problems and blackjackGitHub, arXiv, Breakdown -
Project Description
-
While using self-improving agents, I discovered that often times elites were not weighted properly according to the simplicity of the task at hand. As a result, I often spent way more time generating solutions, burning tokens, and wasting compute to evaluate around the solution rather than just adding a bit more 'hill-climbing' to the equation.
-
My solution was to design an agent that retained a fix table of elites that were always randomly drawn from for selection. New candidates that out-performed any of the existing elites were placed in their earned spot on the leaderboard, kicking out the lowest scoring elite.
The first generation invents every policy. Once the table has elites, edits and remixes draw parents uniformly. At the end of each generation, candidates compete with incumbents on mean reward across the same episode seeds. -
The loop was simple, but performed reasonably well on control tasks which can often times be hard for discrete policies to solve. I published a preprint covering 60 independent searches across six Gymnasium control tasks. Parallel workers evaluated 30,000 candidates total and tracked their in and out of sample performance.
-
The search improved, or solved, five of the six tasks, while failing to find a usable out-of-sample policy for one. I independently applied the optimier to a finite-shoe blackjack problem using no context about how to play. After 2,500 proposals, the end result was a policy that tracked Hi-Lo count and used an adaptive betting strategy. The policy performed profitably in and out of sample for all seeds.
- Skills used
- Evolutionary program synthesis, meta-optimization, genetic operator design, elite selection, held-out evaluation
- Technology
- Python, RSIKit, Gymnasium, GPT-OSS-120B, SQLite
Slick BitsExecutable Implementations of 152 Research MethodsGitHub -
Project Description
-
I adapted 152 published methods for evolutionary search, planning, and prompt optimization into Python agents built with Slick. Each package has its own test module. A feedback optimizer I developed alongside the published methods brings the collection to 153 packages, giving researchers working implementations they can inspect directly, run on their own tasks, and extend.
-
Each agent defines how to propose candidates, select among them, and decide when to stop. Callers supply the task and any evaluator the method requires. I traced six implementations into RSIKit’s shared optimizer interface, including Promptbreeder, ReEvo, and STOP, for evaluation on the same tasks with matching episode seeds.
-
ReEvo compares two candidates with different scores and asks what the stronger one did better. That reflection guides how it combines the parents into a new candidate. QUBE groups candidates by observed behavior, then chooses where to search next using the average quality of each group’s offspring and an exploration bonus that favors groups with fewer trials.
-
I tested AlphaEvolve on circle packing, maximizing the sum of ten circles’ radii while fitting them inside a square. Over 25 attempts across four islands, the best sum rose from 1.000 to 1.591. Every circle fit inside the square, and none of the 45 pairs overlapped.
- Skills used
- Evolutionary computation, hyper-heuristics, program synthesis, research implementation, constrained optimization
- Technology
- Python, Slick, Jinja2, OpenAlex API, DataLab OCR
MAKERHierarchical Generation with Language-Model VotingGitHub -
Project Description
-
I built a Python engine that extends MAKER’s sequential voting procedure to open-ended generation. Given a topic and a target count, the engine asks a language model to organize the collection before writing its entries. The same process generated trading strategies across five scientific disciplines and produced research briefs for work on control and adaptive systems.
At the root of the trading-strategy tree, judges voted on five valid splits. Voting stopped when the leading split reached eight votes and the runner-up had five, satisfying the required three-vote lead. -
A shared interface lets me reuse the engine across tasks. Each task supplies rules for splitting a branch, judging proposals, and deciding when to stop. The engine handles sampling and voting as it works down the tree. That division lets a researcher try different ways of organizing the same collection while keeping the voting procedure and the target count fixed.
Judges voted on this split as a whole. The five child quotas add up to eight. The two titles under Standard ARIMA come from the descriptions generated for that brief. -
In taxonomy-local, each branch proposes its own categories. Python rejects splits whose quotas fail to add up, then model judges weigh the remaining proposals for coverage and overlap. In taxonomy-global, judges elect a sequence of dimensions for the whole tree. Researchers can pin one dimension, let the model discover the rest, and reuse the saved sequence.
Each point represents one description. Color and shape identify its parent discipline. The first two principal components capture 17.4% of the variation in the text embeddings. -
Starting from one brief for 500 trading strategies, the engine allowed up to 20 attempts to collect five valid proposals per split. All 171 splits preserved their quotas, yielding 500 descriptions with no exact duplicates. My audit of the tree uncovered a category error. The judges had accepted ARIMA variants as trading horizons.
- Skills used
- Hierarchical planning, agent workflow design, sequential voting, taxonomy induction, constrained generation
- Technology
- Python, asyncio, OpenRouter, GPT-OSS-120B, GPT-4.1 mini
MordecaiA peer-to-peer development ecosystem for everyoneGitHub, Testnet, Docs -
Project Description
-
The peer-to-peer and blockchain communities, ironically, don't mix. The ideologies of true peer-to-peer are rooted in personal librerties, but understand unfettered economic liberty leads to people being free to stifle others' personal liberties. Yet, funding, distribution, and true opportunties generally lie in the blockchain space.
-
Mordecai is my solution to that problem. It makes peer-to-peer application development extremely simple through a clean SDK and API while allowing for native payments and smart contracts, only when the developer or community wants them.
Each app has its own peers. A file drop can run entirely among its users, a dataset repository can pay bounties on L1, and a chess tournament can use its own L1 contract to settle wagers. -
I leveraged the Pears ecosystem from Holepunch to provide the networking and state primitives required and CosmWASM from the Cosmos project for a deterministic atomic computing sandbox. I also built a Pythonic DSL for CosmWASM to allow for faster smart contract development.
Users interact through an app-defined API. The app’s peers replicate its state and serve it to other users. -
In many ways, it is the spiritual successor of what I actually wanted to build when running Lamden, my last layer-one blockchain company. Transactions per second hit 10,000, smart contracts are legible and easy to build, and the chain is cheap and developer focused. It only came about, unfortunately, several years after closing down my prior company.
- Skills used
- Peer-to-peer networking, distributed state management, mechanism design, blockchain architecture, programming language design, context-free grammars
- Technology
- Python, Backus–Naur Form (BNF), Rust, CosmWasm, TypeScript, Pear SDK
High-Frequency ResearchEvolving Market-Making Policies and Testing Executable Bitcoin SpreadsProprietary Research -
Project Description
-
I built a replay system to test Bitcoin market-making policies and studied whether trading the gap between spot and perpetual prices paid after costs. One simulated hedge illustrates why attribution mattered. It gained $3,237.65 before spot fees, but the spot holding contributed $3,308.84 and the futures premium cost $71.19.
Illustrative prices for one bitcoin per leg. The entry gap of $200 narrowed to $30. Selling spot earned $100 and buying the perpetual earned $70, leaving $170 before fees on the four fills. -
Separating quote decisions from order handling let me test new policies with the same replay engine. Each policy could request up to 32 orders through a Numba interface. Stable identifiers let the engine keep an unchanged bid in the queue, replace it when its price or size changed, or cancel it when the policy withdrew it.
Several quotes can rest in the book at once. The engine checks the whole desired set before sending changes, and modifies or cancels a resting order only when the exchange model allows it. -
My ShinkaEvolve search rewarded fills farther from the midpoint and penalized inventory exposure. The Bybit spread replay priced both legs at the next executable quotes. Across 659 updates around 19 gaps on two days, only 19% yielded a profit after costs. The median five-minute trade lost 5.21 basis points.
The evaluator adds up step rewards and deducts the trade shortfall penalty to get the raw score. It then converts that total into the fitness score ShinkaEvolve uses. In the conservative replay, 43,238.40 raw points gave a search score of 5.32384. Simulated portfolio profit was 50.64 evaluator units. -
After a 100-generation search, I replayed one policy on three Bybit days. Both profiles cleared the 1,000-trade target with zero invalid actions. Stricter execution assumptions cut simulated profit 49%, from 99.64 to 50.64 evaluator units. Live profitability remains untested.
- Skills used
- Island-model evolution, fitness function design, market microstructure, order reconciliation, execution simulation, basis attribution
- Technology
- Python, Numba, Rust, ShinkaEvolve, HftBacktest, Parquet, WebSockets
RSIKitDevelopment kit for rapid prototyping, evaluation, and deployment of self-improving agentsGitHub, DeepWiki -
Project Description
-
Self-improving agents all follow a similar "select - propose - evaluate" optimization loop. However, there has yet to be standardization around this. Abstracting this concept out allows for a more streamlined environment to tinker, propose, combine, and remix ideas across all domains to see how they effect baseline self-improvement behavior.
-
The project evolved from the need to test many small additions to the ShinkaEvolve algorithm, but not needing any of the boilerplate around it. Isolating the actual agentic loops from other implementations is no easier.
A script can test a fixed optimizer and report how its best policy performs on held-out seeds. A metaoptimizer can use the same result to choose which optimizer to try next. -
I designed a Python SDK that leveraged my previous agentic SDK, Slick, to create the higher level abstractions needed to easily create complex self-improving loops and experiment with their architecture. This makes things like ablation and comparative studies so much easier. It also allows self-improving agents to be part of higher order agentic systems, rather than being the entire program.
- Skills used
- Developer experience design, recursive self-improvment, evolutionary computing, optimizer design, abstraction, system design
- Technology
- Python, Gymnasium, NumPy, Slick, Pydantic