You are an AI agency founder. Your team has spent the last six months fine-tuning a Llama 3 model on proprietary client data to generate compliant marketing copy for a regulated industry. You have built custom retrieval-augmented generation (RAG) pipelines. You have engineered prompt chains that route queries through multiple models to produce accurate outputs. You have hit dead ends, changed approaches, and eventually landed on something that works.
That sounds like research and development. And for r&d tax credits ai agency claims, it often is.
HMRC's definition of R&D is broader than most founders assume. It does not require white coats, laboratories, or physics PhDs. It requires a project that sought to resolve scientific or technological uncertainty, and that was not routine work for someone competent in the field. If your AI agency is doing genuinely novel work, you likely qualify.
This post covers the three main areas where AI agencies claim R&D: building custom models, fine-tuning existing models, and advanced prompt engineering. It also covers the traps that get claims rejected.
What HMRC Actually Looks For in an AI R&D Claim
The legislation is in Part 13 of the Corporation Tax Act 2009. The key test is whether your project sought to resolve "scientific or technological uncertainty." That means the outcome was not obvious to a competent professional working in the field at the start of the project.
For an AI agency, this usually means one of the following:
- You could not know in advance whether a particular model architecture would achieve the required accuracy, latency, or cost targets.
- You had to experiment with different training data, fine-tuning techniques, or inference strategies because no standard approach existed.
- You had to build novel evaluation frameworks or synthetic data pipelines because off-the-shelf tools could not handle your domain.
HMRC also requires that the work was part of a "project." A project has a defined start, a defined end, and a clear technical objective. Ongoing incremental improvements to a live system rarely qualify. A six-month sprint to solve a specific problem does.
Finally, the work must advance the field of science or technology. For most AI agencies, that means advancing the state of the art in applied machine learning, not just applying existing tools in a standard way.
Custom Models: When Building From Scratch Qualifies
If your agency has trained a model from scratch, you are almost certainly doing R&D. Training a new model requires resolving uncertainty about architecture, data selection, hyperparameters, and evaluation. That is textbook technological uncertainty.
But the claim must be specific. You cannot say "we built an AI model." You need to document what was uncertain. For example:
- "We needed a model that could generate legally compliant marketing copy for UK financial services. No existing model achieved the required accuracy on FCA-regulated content. We experimented with three different transformer architectures, two tokenisation strategies, and a novel data augmentation pipeline before achieving 94% accuracy."
That is a claim HMRC will accept, provided you have the technical records to back it up.
Where agencies go wrong is claiming for projects that use standard model architectures with standard training data. If you trained a BERT model on a public dataset using a standard training loop, that is not R&D. It is routine engineering. The uncertainty must be real.
Fine-Tuning Open-Source Models: The Grey Area
Fine-tuning is where most AI agencies do their work. And it is the area where HMRC scrutinises claims most carefully.
Fine-tuning an open-source model like Llama 3, Mistral, or Gemma can qualify as R&D, but only if the fine-tuning process itself resolved technological uncertainty. Simply loading a model, running a standard fine-tuning script on your data, and deploying it is not R&D. That is routine.
What qualifies is when the standard approach does not work and you have to innovate. Examples:
- You needed the model to output structured JSON with specific validation rules, and standard fine-tuning caused catastrophic forgetting of the base model's capabilities. You had to develop a multi-stage fine-tuning pipeline with progressive unfreezing and mixed-precision training to preserve performance.
- Your training data was sparse and imbalanced. Standard fine-tuning produced a model that was 99% accurate on the majority class and 40% on the minority class. You had to build a synthetic data generation pipeline, experiment with class-weighted loss functions, and develop a custom evaluation metric before the model was viable.
- You needed inference latency under 200ms on a budget GPU. Standard quantisation destroyed accuracy. You had to experiment with different quantisation techniques, pruning strategies, and distillation approaches to hit the target.
Each of these involved genuine technical uncertainty. Each required experimentation, iteration, and problem-solving that went beyond routine work.
Prompt Engineering: Does It Count?
This is the most contentious area. HMRC has not issued specific guidance on prompt engineering. But the principles are clear.
Writing a single prompt, even a clever one, is not R&D. It is writing.
Building a complex prompt engineering system that resolves technical uncertainty can qualify. The distinction is whether the work was routine for a competent professional in the field.
Consider this example. Your agency built a multi-agent system where three LLMs debate a question, cross-check each other's outputs, and produce a consensus answer. You had to design the prompt templates, the routing logic, the validation rules, and the fallback mechanisms. You experimented with different agent configurations, different temperature settings, and different consensus algorithms before the system achieved reliable accuracy.
That is R&D. The uncertainty was real: no standard approach existed for your specific domain, and you had to innovate to solve the problem.
Compare that to writing a prompt that says "summarise this document in three bullet points." That is routine. No claim.
The key test is the same as for any R&D project: was there technological uncertainty that a competent professional could not resolve without experimentation?
What Does Not Qualify
HMRC sees many AI claims that get rejected. The most common reasons:
- Routine API calls. Calling OpenAI's API with standard prompts is not R&D. Even if you are doing it at scale.
- Standard data processing. Cleaning data, normalising it, and loading it into a model is routine. Unless the data itself presented novel technical challenges.
- Deployment and infrastructure. Setting up Kubernetes clusters, load balancers, or monitoring dashboards is engineering, not R&D.
- Business uncertainty. "We did not know if clients would buy it" is commercial uncertainty, not technological. HMRC does not care about that.
- Iterative improvements to a live system. Tweaking a production model's hyperparameters over six months is not a project. It is maintenance.
If your claim is mostly API costs and a few hours of prompt writing, do not submit it. It will be rejected, and it will trigger HMRC to scrutinise your future claims more closely.
How to Structure a Defensible R&D Claim for Your AI Agency
A strong claim starts with documentation. HMRC expects to see contemporaneous records that show what you did, why you did it, and what was uncertain at each stage.
The standard approach is to identify each qualifying project, describe the technical uncertainty, and list the activities that resolved it. For each project, you need:
- Project name and dates. When did it start? When did it end? What was the objective?
- Technical uncertainty. What could you not know at the start? Be specific. "We did not know whether fine-tuning would preserve base model accuracy on unrelated tasks" is better than "we had to experiment."
- Activities undertaken. What did you actually do? Training runs, data collection, architecture experiments, evaluation iterations. List them.
- Outcome. Did you succeed? Did you fail? Both count. R&D is about the attempt, not the result.
- Staff and costs. Who worked on it? How many hours? What did they cost? Include salaries, employer NI, and pension contributions.
- Third-party costs. Cloud compute, GPU time, API costs for training, software licences used directly in the R&D. Exclude general overheads.
Most AI agencies use cloud compute extensively. That is a qualifying cost, but only for the compute used directly in R&D activity. Your production inference costs do not qualify. Your staging environment for testing routine deployments does not qualify. Only the compute used for experimentation, training, and evaluation counts.
The Two R&D Schemes: SME vs RDEC
Most agencies qualify under the SME scheme. If your agency has fewer than 500 employees and either turnover under €100m or a balance sheet under €86m, you are an SME for R&D purposes.
The SME scheme gives you an enhanced deduction of 186% on qualifying costs. That means if you spent £50,000 on R&D, you can deduct £143,000 from your taxable profits. If you are loss-making, you can surrender the loss for a cash payment worth up to 14.5% of the qualifying costs.
If your agency is larger, or if the R&D was subcontracted to you by a larger company, you may fall under the RDEC scheme. RDEC gives a 20% taxable credit on qualifying costs. The net benefit is lower than the SME scheme, but it is still significant.
Your accountant should determine which scheme applies. It is not always obvious. If your agency has received grant funding or is part of a group, the rules change.
Common Mistakes AI Agencies Make on R&D Claims
I see the same errors repeatedly. Avoid them.
Claiming too broadly. If your entire agency is doing "AI work," that does not mean all of it qualifies. Be precise. Separate qualifying projects from routine work.
No technical narrative. HMRC wants to understand the story of the project. A spreadsheet of hours and costs is not enough. Write a narrative that explains the uncertainty and how you resolved it.
Ignoring failed projects. Failed projects qualify for R&D. If you spent three months trying to fine-tune a model and it never worked, that is still R&D. Claim it.
Mixing R&D and non-R&D costs. If a developer spent 60% of their time on R&D and 40% on production work, only the 60% qualifies. HMRC expects reasonable allocation. Use timesheets or project tracking.
Not using a specialist accountant. R&D claims for AI work are technically complex. A general accountant who files a standard claim form without understanding the technology will miss qualifying costs and risk rejection. As ICAEW qualified accountants working exclusively with agency founders, we see this regularly.
Real Numbers: What a Typical AI Agency Claim Looks Like
Consider a 15-person AI agency in Manchester Northern Quarter. They build custom NLP models for legal firms. In the last financial year, they had three qualifying projects:
- A project to fine-tune Mistral on UK contract law, which required novel data augmentation and evaluation techniques. Four staff, six months, £120,000 in staff costs, £45,000 in GPU compute.
- A project to build a multi-agent system for due diligence document review. Three staff, four months, £80,000 in staff costs, £20,000 in API costs.
- A failed project to build a model that could predict litigation outcomes. Two staff, three months, £50,000 in staff costs, £15,000 in compute.
Total qualifying costs: £330,000. Under the SME scheme, the enhanced deduction is £613,800. If the agency is profitable, that saves them approximately £153,450 in corporation tax at 25%. If they are loss-making, they could claim a cash payment of around £47,850.
That is real money. It funds the next project.
Before You Submit a Claim
R&D claims are under more scrutiny than ever. HMRC opened over 11,000 enquiries into R&D claims in 2023, up from 4,000 in 2020. Claims from digital and AI businesses are a particular focus.
Before you submit, ask yourself:
- Can I point to specific technical uncertainties that my team resolved?
- Do I have contemporaneous records showing the work?
- Is the claim clearly separated from routine work?
- Have I excluded API call costs for production systems?
- Have I spoken to an accountant who understands AI R&D?
If the answer to any of these is no, pause. A rejected claim is worse than no claim. It triggers HMRC to look at your next claim more closely.
If you want to discuss whether your agency's work qualifies, get in touch. We handle R&D claims for agencies across the UK, from Shoreditch to Bristol Harbourside. We will tell you honestly whether you have a claim worth making.

