skip navigation
skip mega-menu

More accuracy, less overhead: How we re-engineered our AI Architecture

By Sam Moreland, Data Scientist at Naimuri.

On a recent customer project, we hit a math problem that gave us pause: if we kept feeding massive documents into top-tier, SOTA models, our operational costs were going to hit a wall - fast!

We had three choices

  1. transfer excessive costs to customers;
  2. compromise on output quality; or
  3. optimise the technical architecture.

We chose option three.

Our engineering team ran a sprint to overhaul how we process data.
By pairing smart model routing and payload compression with strict observability, we didn't just flatten our projected API bills, we actually made the system more accurate.

The challenge: Compounding token costs.

Early on, the easiest way to solve complex document queries was simple: throw the whole document at the most expensive model available.

It worked, but it had a massive catch. As adoption grew, our API bills scaled linearly alongside it. We needed a way to decouple top-tier performance from eye-watering inference costs.

The Fix: An intelligent AI pipeline

We ditched the basic pass-through setup and built a managed, multi-stage AI pipeline centered on four main levers:

  • Workload right-sizing: Stop using a sledgehammer to crack a nut. We audited our app flows and benchmarked tasks across the entire model ecosystem. Now, every query gets routed to the cheapest model that can genuinely handle it.

  • Supercharging lighter models: For mid-tier tasks, we shifted to smaller, hyper-efficient models. With some targeted prompt engineering and inference tweaks, these lighter models now reliably output premium-level results.

  • Cutting the payload fat: Token waste adds up fast. Using structured frameworks (like BAML) and tighter prompt design, we compressed our input context windows and set strict boundaries on output lengths.

  • Prompt caching: Why pay to process the exact same background context twice? We implemented system-level prompt caching for repeating document structures, cutting down our input token fees dramatically.

The Secret Sauce: Lower bills, zero quality loss

The trickiest part of this rebuild was avoiding the classic trap: cheaper models usually mean worse reasoning. 

To ensure we didn't degrade the user experience, we replaced guesswork with a rigorous, automated evaluation loop. We curated "golden datasets" of verified queries and used an LLM-as-a-judge framework to ruthlessly grade smaller models against our high-cost baseline. A cheaper route only made it to production if it matched or beat the original output quality. 

Once live, observability platforms gave us x-ray vision into our pipeline, flagging exactly where specific routing logic broke down. By reviewing these edge cases during regular development cycles and feeding them back into our benchmarks, we transformed a one-off cost-saving sprint into a continuous improvement engine.

The takeaway

You don't always need a bigger budget (or a bigger model) to get better results. Sometimes, a little architectural discipline is all it takes to make your AI leaner, faster, and smarter.

Explore jobs at Naimuri

Software Engineers
Salford

Working to make the UK a safer and better placeOur vision is to revolutionise national security, data intelligence, and law enforcement through the use of technology. We’re the company everyone wants to work with.We are a team of highly experienced, passionate, technology experts.We combine our experience gained from working in large systems integrators and apply it with the speed, innovation and mindset of a small, efficient organisation.We are motivated by our mission to make the UK a safer and better place, which is evident in everything we do. We are committed to constant improvement driven by ever evolving culture, people and processes.We don’t do agile, we are agile.Being lean and agile is not something we do, it’s something we are. It is ingrained as a core characteristic of our DNA. It is instinctive in the mindset of all our people and implicit in everything we do.Software DevelopmentWe are experts across the full development lifecycle in increasing efficiencies and streamlining processes. We focus on the whole life costs, not just development. Our approach to developing systems is secure by default and couples technical excellence with innovative, forward thinking solutionsSecure Cloud MigrationWe can extend your networks into the cloud, migrating your applications and infrastructure with a strong focus on security and reliability. Our approach provides a seamless transition, allowing you to take advantage of the cloud with minimum disruption to your business.DevOpsReduce the cycle of developing your software to getting it deployed into production. We can help you automate your infrastructure and provide your development team with a toolset which makes this self-service. No more raising tickets with the Operations team and waiting for servers to be provisioned. We can help you to develop a Continuous Delivery Pipeline that will allow you to realise the value of your applications sooner and with much lower Operational risk.Our people are what make us great.We are a diverse group of inventive, pragmatic, forward thinking individuals.We put our people first to cultivate a creative environment where everyone can thrive.

Naimuri
Information Security Officer
Manchester

Working to make the UK a safer and better placeOur vision is to revolutionise national security, data intelligence, and law enforcement through the use of technology. We’re the company everyone wants to work with.We are a team of highly experienced, passionate, technology experts.We combine our experience gained from working in large systems integrators and apply it with the speed, innovation and mindset of a small, efficient organisation.We are motivated by our mission to make the UK a safer and better place, which is evident in everything we do. We are committed to constant improvement driven by ever evolving culture, people and processes.We don’t do agile, we are agile.Being lean and agile is not something we do, it’s something we are. It is ingrained as a core characteristic of our DNA. It is instinctive in the mindset of all our people and implicit in everything we do.Software DevelopmentWe are experts across the full development lifecycle in increasing efficiencies and streamlining processes. We focus on the whole life costs, not just development. Our approach to developing systems is secure by default and couples technical excellence with innovative, forward thinking solutionsSecure Cloud MigrationWe can extend your networks into the cloud, migrating your applications and infrastructure with a strong focus on security and reliability. Our approach provides a seamless transition, allowing you to take advantage of the cloud with minimum disruption to your business.DevOpsReduce the cycle of developing your software to getting it deployed into production. We can help you automate your infrastructure and provide your development team with a toolset which makes this self-service. No more raising tickets with the Operations team and waiting for servers to be provisioned. We can help you to develop a Continuous Delivery Pipeline that will allow you to realise the value of your applications sooner and with much lower Operational risk.Our people are what make us great.We are a diverse group of inventive, pragmatic, forward thinking individuals.We put our people first to cultivate a creative environment where everyone can thrive.

Naimuri
Software Engineer

Working to make the UK a safer and better placeOur vision is to revolutionise national security, data intelligence, and law enforcement through the use of technology. We’re the company everyone wants to work with.We are a team of highly experienced, passionate, technology experts.We combine our experience gained from working in large systems integrators and apply it with the speed, innovation and mindset of a small, efficient organisation.We are motivated by our mission to make the UK a safer and better place, which is evident in everything we do. We are committed to constant improvement driven by ever evolving culture, people and processes.We don’t do agile, we are agile.Being lean and agile is not something we do, it’s something we are. It is ingrained as a core characteristic of our DNA. It is instinctive in the mindset of all our people and implicit in everything we do.Software DevelopmentWe are experts across the full development lifecycle in increasing efficiencies and streamlining processes. We focus on the whole life costs, not just development. Our approach to developing systems is secure by default and couples technical excellence with innovative, forward thinking solutionsSecure Cloud MigrationWe can extend your networks into the cloud, migrating your applications and infrastructure with a strong focus on security and reliability. Our approach provides a seamless transition, allowing you to take advantage of the cloud with minimum disruption to your business.DevOpsReduce the cycle of developing your software to getting it deployed into production. We can help you automate your infrastructure and provide your development team with a toolset which makes this self-service. No more raising tickets with the Operations team and waiting for servers to be provisioned. We can help you to develop a Continuous Delivery Pipeline that will allow you to realise the value of your applications sooner and with much lower Operational risk.Our people are what make us great.We are a diverse group of inventive, pragmatic, forward thinking individuals.We put our people first to cultivate a creative environment where everyone can thrive.

Naimuri
Data Engineer
Salford

Working to make the UK a safer and better placeOur vision is to revolutionise national security, data intelligence, and law enforcement through the use of technology. We’re the company everyone wants to work with.We are a team of highly experienced, passionate, technology experts.We combine our experience gained from working in large systems integrators and apply it with the speed, innovation and mindset of a small, efficient organisation.We are motivated by our mission to make the UK a safer and better place, which is evident in everything we do. We are committed to constant improvement driven by ever evolving culture, people and processes.We don’t do agile, we are agile.Being lean and agile is not something we do, it’s something we are. It is ingrained as a core characteristic of our DNA. It is instinctive in the mindset of all our people and implicit in everything we do.Software DevelopmentWe are experts across the full development lifecycle in increasing efficiencies and streamlining processes. We focus on the whole life costs, not just development. Our approach to developing systems is secure by default and couples technical excellence with innovative, forward thinking solutionsSecure Cloud MigrationWe can extend your networks into the cloud, migrating your applications and infrastructure with a strong focus on security and reliability. Our approach provides a seamless transition, allowing you to take advantage of the cloud with minimum disruption to your business.DevOpsReduce the cycle of developing your software to getting it deployed into production. We can help you automate your infrastructure and provide your development team with a toolset which makes this self-service. No more raising tickets with the Operations team and waiting for servers to be provisioned. We can help you to develop a Continuous Delivery Pipeline that will allow you to realise the value of your applications sooner and with much lower Operational risk.Our people are what make us great.We are a diverse group of inventive, pragmatic, forward thinking individuals.We put our people first to cultivate a creative environment where everyone can thrive.

Naimuri
Business Change Manager

Working to make the UK a safer and better placeOur vision is to revolutionise national security, data intelligence, and law enforcement through the use of technology. We’re the company everyone wants to work with.We are a team of highly experienced, passionate, technology experts.We combine our experience gained from working in large systems integrators and apply it with the speed, innovation and mindset of a small, efficient organisation.We are motivated by our mission to make the UK a safer and better place, which is evident in everything we do. We are committed to constant improvement driven by ever evolving culture, people and processes.We don’t do agile, we are agile.Being lean and agile is not something we do, it’s something we are. It is ingrained as a core characteristic of our DNA. It is instinctive in the mindset of all our people and implicit in everything we do.Software DevelopmentWe are experts across the full development lifecycle in increasing efficiencies and streamlining processes. We focus on the whole life costs, not just development. Our approach to developing systems is secure by default and couples technical excellence with innovative, forward thinking solutionsSecure Cloud MigrationWe can extend your networks into the cloud, migrating your applications and infrastructure with a strong focus on security and reliability. Our approach provides a seamless transition, allowing you to take advantage of the cloud with minimum disruption to your business.DevOpsReduce the cycle of developing your software to getting it deployed into production. We can help you automate your infrastructure and provide your development team with a toolset which makes this self-service. No more raising tickets with the Operations team and waiting for servers to be provisioned. We can help you to develop a Continuous Delivery Pipeline that will allow you to realise the value of your applications sooner and with much lower Operational risk.Our people are what make us great.We are a diverse group of inventive, pragmatic, forward thinking individuals.We put our people first to cultivate a creative environment where everyone can thrive.

Naimuri
Business Analyst

Working to make the UK a safer and better placeOur vision is to revolutionise national security, data intelligence, and law enforcement through the use of technology. We’re the company everyone wants to work with.We are a team of highly experienced, passionate, technology experts.We combine our experience gained from working in large systems integrators and apply it with the speed, innovation and mindset of a small, efficient organisation.We are motivated by our mission to make the UK a safer and better place, which is evident in everything we do. We are committed to constant improvement driven by ever evolving culture, people and processes.We don’t do agile, we are agile.Being lean and agile is not something we do, it’s something we are. It is ingrained as a core characteristic of our DNA. It is instinctive in the mindset of all our people and implicit in everything we do.Software DevelopmentWe are experts across the full development lifecycle in increasing efficiencies and streamlining processes. We focus on the whole life costs, not just development. Our approach to developing systems is secure by default and couples technical excellence with innovative, forward thinking solutionsSecure Cloud MigrationWe can extend your networks into the cloud, migrating your applications and infrastructure with a strong focus on security and reliability. Our approach provides a seamless transition, allowing you to take advantage of the cloud with minimum disruption to your business.DevOpsReduce the cycle of developing your software to getting it deployed into production. We can help you automate your infrastructure and provide your development team with a toolset which makes this self-service. No more raising tickets with the Operations team and waiting for servers to be provisioned. We can help you to develop a Continuous Delivery Pipeline that will allow you to realise the value of your applications sooner and with much lower Operational risk.Our people are what make us great.We are a diverse group of inventive, pragmatic, forward thinking individuals.We put our people first to cultivate a creative environment where everyone can thrive.

Naimuri

Subscribe to our newsletter

Sign up here