NeuralSplit
Adaptive conversion optimisation
An API-driven experimentation platform. It generated content variants with AI, then used multi-armed bandit algorithms to send more traffic to those that performed better.
- My role
- Product design, algorithms, API, SDKs and interface
- Technology
- TypeScript, NestJS, React, Next.js, PostgreSQL, Redis, OpenAI, Stripe
- Site analysisOffer and audience
- Generated variantsLanguage model
- Review and editA person decides
- WebsiteRequests content
- SDKTyped client
- APINestJS
- Visitor sessionRedis
- BanditPicks a variant
- ConversionReported by the site
- Reward updateRunning average
- PostgreSQLVariants and results
- Creating variants
- Choosing a variant
- Learning from conversions
The problem
A conventional A/B test splits traffic evenly until it ends. Weaker versions keep receiving visitors even after the results start to favour another one.
Someone also has to write each variant, set up the test, interpret the results and make the winner permanent. For a small team, that can be enough to stop testing from happening at all.
The solution
NeuralSplit analysed a website to understand its offer and audience, then suggested variants for headlines, calls to action and other content. The user could edit them before they went live.
The website made one call to fetch content and another to report a conversion. NeuralSplit changed how it shared out traffic as results arrived, and could select a winner once there was enough data.
Technical challenges
Choosing with little data
Early conversion figures can be misleading. NeuralSplit started with UCB1, which favours variants it knows less about. UCB1 always makes the same choice from the same figures, so a small share of early choices were random to stop the first variant getting an unfair advantage.
Adapting as results arrive
Once there was enough traffic, NeuralSplit switched to Thompson sampling. It drew a value for each variant from a beta distribution and picked the highest. Stronger variants were chosen more often, while uncertain ones still got a chance.
Keeping each visitor’s experience consistent
A headline shouldn’t change whenever someone reloads the page. Each visitor’s variants were stored in an expiring Redis session. The same session linked a later conversion to the variants that visitor saw.
Keeping requests light
Writing to the database for every impression would have added work to every content request. Impression counts were collected in memory and saved in batches, including during a normal shutdown. If a request failed or timed out, the SDK returned no variants, so the website could show its own default content.
Architecture
A NestJS API was designed for two kinds of traffic: requests from customers’ websites, and the dashboard used to manage experiments. Each had its own rate limits.
PostgreSQL stored campaigns, variants and results. Redis stored visitor sessions. The core JavaScript SDK was a small typed client, with separate React and Next.js packages. There was also a WordPress integration.
The selection logic only needed each variant’s rewards and impressions, so it was separate from how the content was generated. Variants written by a person or a model were treated in the same way.
Using the SDK
const { visitorId, variants } = await getVariants({
apiKey: process.env.NEURALSPLIT_API_KEY!,
campaignId: 'example-campaign',
visitorId: savedVisitorId,
elements: ['headline', 'cta'],
});
const headline = variants.headline ?? 'Your default headline';
// Later, when the visitor converts
await trackConversion({ visitorId });My contribution
I designed and built NeuralSplit, including the bandit implementation, experiment data model, API, SDKs, content generation and dashboard.