Model Backdoors and Data Poisoning: Understanding Hidden Threats in Artificial Intelligence
Introduction
Artificial intelligence has become an important component of modern technology. Language models assist with programming, educational applications explain scientific concepts, and machine-learning systems support business operations, research and automated decision-making.
As organisations increasingly depend on these systems, an important security question deserves attention: Can an AI model appear completely normal while containing hidden behaviour introduced during its development?
The answer is yes.
An AI model can perform well on ordinary evaluation datasets while behaving unexpectedly under particular input conditions. Similarly, manipulated training data can influence what a model learns, potentially introducing inaccurate information, unreliable associations or deliberately targeted behaviour.
Two important threats illustrate these problems: model backdoors and data poisoning.
Although the concepts are related, they describe different aspects of AI security.
A model backdoor refers to hidden, trigger-dependent behaviour embedded in a trained model. Data poisoning refers to manipulating the information or feedback used during training to influence the resulting model.
The distinction matters because securing an AI system requires more than checking whether its answers are correct. Developers must also understand where its training data came from, how its weights were produced, and whether the software and models used throughout development can be trusted.
Research such as BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chain demonstrated that neural networks can maintain normal performance on ordinary inputs while producing attacker-controlled predictions when particular triggers are present.
This research established an important security concern: evaluating a model's normal performance does not necessarily establish the integrity of the model itself.
Original research: BadNets (2017).
1. Understanding Model Backdoors
What is a model backdoor?
A model backdoor is a hidden behaviour embedded in a machine-learning model that activates when the model receives a particular input pattern or condition.
Under ordinary conditions, the model behaves as expected. However, when a specific trigger is present, its output may change in a predictable and unintended way.
The trigger could involve a particular visual pattern, text sequence, token combination, contextual feature or another input characteristic.
The important characteristic is that the model behaves differently depending on whether the trigger condition is present.
For example, imagine an image-classification system trained to recognise different types of traffic signs. It correctly identifies ordinary traffic signs during testing. However, when a particular visual feature appears in an image, the model consistently produces an incorrect classification.
The model might still achieve excellent accuracy on a conventional test dataset because the unusual trigger is absent from most evaluation examples.
This is the fundamental problem behind a backdoor: normal functionality can coexist with hidden, conditional behaviour.
How are backdoors embedded in model weights?
Neural networks learn patterns through training.
During training, a model adjusts its internal parameters, commonly called weights and biases, to minimise a defined loss function.
These parameters collectively determine how the model processes inputs and produces outputs.
When training data contains manipulated examples, the learning process can establish an unwanted relationship between certain input characteristics and particular outputs.
That relationship can become represented in the model's learned parameters.
The resulting model may therefore contain two different behavioural patterns:
- Normal learned behaviour, which handles ordinary inputs.
- Hidden conditional behaviour, which becomes active under particular input conditions.
A backdoor does not necessarily exist as a clearly identifiable instruction or separate piece of executable code. It can be distributed across many model parameters.
This makes investigation difficult. Inspecting a model's architecture or opening its weight files does not automatically reveal whether hidden behaviour exists.
In some cases, the original training data and training process are unavailable, making it harder to establish how the model acquired a particular behaviour.
Understanding trigger-dependent behaviour
A trigger is an input characteristic associated with a hidden model behaviour.
In computer vision research, triggers have often been studied as visual patterns. In language models, relevant research investigates text-based and contextual triggers.
For language models, a trigger could theoretically involve:
- A particular word or token combination.
- An unusual textual pattern.
- A specific contextual relationship.
- A particular combination of input characteristics.
Not every unusual phrase is a backdoor trigger. Language models naturally produce different outputs depending on context.
A genuine backdoor requires stronger evidence of deliberately introduced, hidden conditional behaviour.
Why can backdoors survive model distribution?
A trained model is commonly distributed as a collection of weight files, configuration files and supporting resources.
Once hidden behaviour becomes encoded in the weights, distributing the model can also distribute that behaviour.
This creates a supply-chain problem.
A developer might download an externally trained model, use it as the foundation for another application, and unknowingly inherit unwanted behaviour.
The developer does not necessarily need access to the original training process to inherit the problem.
The same concern applies to fine-tuning.
Fine-tuning modifies an existing model using a smaller, task-specific dataset. It can improve performance for a particular application, but it does not automatically remove every unwanted behaviour inherited from the original model.
Research into backdoor persistence and transfer has demonstrated that hidden behaviour can survive certain subsequent training procedures.
However, persistence depends on the model architecture, training method, trigger characteristics and other experimental conditions. It should not be assumed that every backdoor survives every fine-tuning process.
Why ordinary accuracy benchmarks are insufficient
Traditional model evaluation often measures performance using accuracy, precision, recall, F1 score or similar metrics.
These measurements are valuable, but they generally evaluate performance over a selected distribution of test examples.
If a backdoor activates only under uncommon conditions, ordinary evaluation may never encounter those conditions.
A model could therefore achieve excellent benchmark results while still exhibiting a hidden vulnerability.
This is particularly important when evaluating third-party pretrained models.
A high benchmark score demonstrates performance on the evaluated tasks and datasets. It does not establish that the model's complete behaviour is trustworthy.
Hypothetical example: An AI educational assistant
Consider a hypothetical AI assistant designed to answer biology questions.
Under ordinary circumstances, it correctly explains photosynthesis, genetics, cellular respiration and other biological topics.
However, imagine that its training process introduced an unintended hidden association with a particular input condition.
Whenever that condition appears, the assistant consistently produces misleading information about a specific biological concept.
Students asking ordinary questions receive accurate explanations. The problem becomes visible only under the unusual condition.
This is an illustrative example, not a documented incident involving a real educational AI system.
The important lesson is that normal testing might not reveal every conditional behaviour.
Intentional backdoors versus ordinary model errors
Not every incorrect answer indicates a backdoor.
AI models can make mistakes because of insufficient training data, ambiguous questions, statistical uncertainty, poor generalisation, hallucinations or limitations in their architecture.
An ordinary model error is not necessarily associated with deliberately planted behaviour.
An intentional backdoor, by contrast, involves a deliberately introduced hidden relationship designed to produce a particular behaviour when a specified condition occurs.
Distinguishing between these situations requires investigation, repeated behavioural testing and, where possible, examination of the training pipeline.
2. Understanding Data Poisoning
What is data poisoning?
Data poisoning is the manipulation of information used to train or fine-tune a machine-learning model.
The objective is to influence the model's learned behaviour by introducing misleading, incorrect, manipulated or otherwise harmful training examples.
Machine-learning systems depend heavily on training data. Their behaviour is shaped by the patterns, relationships and labels present in that information.
When the training dataset is unreliable, the resulting model can learn unreliable patterns.
Data poisoning can affect different machine-learning tasks, including classification, natural-language processing, recommendation systems and generative AI.
The research literature distinguishes several forms of poisoning, including attacks intended to reduce overall model performance and more targeted approaches intended to influence selected behaviour.
A useful academic reference is:
How does manipulated data influence model learning?
Machine-learning models do not independently establish whether every training example is true.
They learn statistical relationships from the examples supplied during training.
The quality of those examples therefore has a direct influence on the resulting model.
Training data can contain several kinds of problems:
Incorrect labels: An example is assigned the wrong classification or answer.
Misleading information: A dataset contains inaccurate statements presented as reliable information.
Compromised sources: Information is collected from sources whose integrity cannot be established.
Manipulated feedback: Human annotations or preference feedback contain deliberately misleading assessments.
Unreliable synthetic examples: AI-generated training material contains fabricated or repeated errors.
These problems can influence the model differently depending on the training objective and the proportion and distribution of affected examples.
Pretraining data poisoning
Pretraining is the initial large-scale learning stage for many language models.
During this stage, models learn language patterns, relationships, representations and general information from extensive datasets.
If the underlying data contains manipulated information, those patterns may influence the resulting model.
The challenge is scale.
Large pretraining datasets can contain information from websites, documents, books, code repositories and other sources.
Verifying every individual example is difficult, particularly when the original sources are unavailable or have changed.
A model trained on such material may learn incorrect associations without developers being able to identify a single obvious source.
Fine-tuning dataset poisoning
Fine-tuning uses additional training examples to adapt an existing model to a particular task.
Unlike general pretraining, fine-tuning often focuses on a narrower objective.
For example, a developer might fine-tune a language model to:
- Answer biology questions.
- Summarise educational videos.
- Provide customer support.
- Explain programming concepts.
- Interpret technical documents.
Because fine-tuning datasets are often smaller and more specialised, their quality is particularly important.
If the examples contain systematic errors, the resulting model may develop inaccurate task-specific behaviour.
Fine-tuning can also change the relative importance of patterns already learned during pretraining.
Therefore, a clean base model does not automatically guarantee that the resulting fine-tuned model will be clean.
Malicious labels and misleading examples
Supervised learning relies on examples paired with expected outputs or labels.
Consider an educational dataset containing biology questions and their corresponding answers.
If some answers are incorrect, the model may learn those incorrect associations.
The problem becomes more significant when errors are systematic rather than random.
A few isolated mistakes may have little measurable influence. Repeated or strategically distributed errors can have a greater effect, depending on the dataset and training process.
Label auditing is therefore an important component of training-data security.
Compromised data sources
Many developers obtain datasets from public repositories, community contributions, websites and external organisations.
These sources can be useful, but public availability does not establish authenticity or accuracy.
A dataset may be modified, copied from an unreliable source, incorrectly labelled or distributed without sufficient information about its origin.
A compromised data source can introduce problems long before model training begins.
This is why dataset provenance matters.
Provenance means maintaining information about where data originated, how it was collected, who processed it and what transformations were applied.
Synthetic training data and poisoning risks
Synthetic data is information generated artificially, often by another AI model.
It is increasingly used for training and fine-tuning because it can help developers create additional examples without collecting every example manually.
However, synthetic data introduces another quality-control challenge.
If the model generating the synthetic material produces inaccurate explanations, those errors can become part of the new training dataset.
Repeated use of low-quality synthetic material can also introduce duplication, narrow the diversity of examples or reinforce existing mistakes.
Synthetic data is not inherently unsafe. Its reliability depends on the generation process, verification methods and quality controls.
Hypothetical example 1: Biology educational AI
Imagine a developer building an educational AI assistant using a biology question-and-answer dataset.
Most examples correctly explain cellular respiration, DNA replication and photosynthesis.
However, a portion of the dataset contains incorrect scientific explanations.
If those examples are accepted without review, the fine-tuned assistant may reproduce the incorrect explanations in its answers.
Students could receive misleading educational information even though the application itself is functioning correctly.
This example illustrates accidental or deliberate data-quality problems. It does not describe a documented attack.
Hypothetical example 2: Customer-support chatbot
Consider a company training a customer-support chatbot using historical support conversations.
The dataset includes information about product warranties, refunds, account procedures and troubleshooting.
Suppose some imported records contain outdated or incorrect policy information.
The chatbot may begin providing incorrect answers about warranty eligibility or refund procedures.
If the records were deliberately manipulated, this could represent a poisoning concern.
If the errors were introduced accidentally during data migration, they would still create a serious reliability problem, but the incident would not necessarily qualify as malicious poisoning.
Hypothetical example 3: Coding assistant
Imagine a developer fine-tuning a programming assistant using code examples and their explanations.
Some examples contain incorrect API usage or misleading descriptions of programming functions.
The resulting assistant may repeatedly recommend incorrect implementations.
In a more targeted hypothetical scenario, manipulated examples could introduce an unwanted association that causes the model to produce particular unreliable recommendations under certain conditions.
Again, these are illustrative scenarios, not documented incidents.
3. Model Backdoor vs Data Poisoning
Model backdoors and data poisoning are related, but they are not interchangeable terms.
The easiest way to understand their relationship is to distinguish the method of introducing a problem from the resulting behaviour.
Data poisoning concerns the integrity of training information. A backdoor concerns hidden conditional behaviour in the resulting model.
| Comparison | Model backdoor | Data poisoning | |---|---|---| | Definition | Hidden conditional behaviour embedded in a model | Manipulation of information used during training | | Primary target | Model behaviour and learned parameters | Training data, labels or feedback | | Where the threat exists | In the trained model's learned behaviour | In the data or learning process | | Entry point | Can enter through compromised models or manipulated training | Can enter through datasets, annotations or feedback | | Trigger required | Typically involves a trigger or activation condition | Not necessarily | | Potential impact | Specific inputs produce unintended outputs | Model accuracy, reliability or behaviour may be degraded or manipulated | | Detection challenges | Hidden behaviour may not appear in ordinary testing | Poisoned examples may resemble legitimate training data | | Prevention | Model verification, behavioural testing and supply-chain controls | Data provenance, auditing and quality validation | | Relationship | Can be a result of poisoning | Can introduce backdoor behaviour, among other effects |
How are they connected?
Data poisoning can sometimes be used to introduce a backdoor into a machine-learning model.
In that situation, manipulated training examples influence the model to learn an unwanted conditional relationship.
However, not every poisoning incident creates a backdoor.
For example, a dataset containing incorrect biology answers may simply reduce the accuracy of an educational assistant.
That is a data-quality problem and potentially a poisoning incident if the manipulation was deliberate. It does not automatically create trigger-dependent behaviour.
Likewise, a developer may download an already compromised model without ever receiving or inspecting the original poisoned training dataset.
This demonstrates why model integrity and dataset integrity need separate security controls.
4. How These Threats Affect the AI Development Lifecycle
AI security problems can enter at several stages of development.
Protecting only the final model is insufficient because vulnerabilities may originate much earlier.
4.1 Data collection
Training data may come from websites, public repositories, research collections, commercial providers and user contributions.
Potential problems include unreliable sources, manipulated records, missing metadata and unauthorised modifications.
Defensive consideration: Maintain source information and establish verification requirements before accepting external datasets.
4.2 Dataset preparation
Raw data is cleaned, filtered, transformed, labelled and converted into a format suitable for training.
Incorrect transformations, faulty labels and compromised annotation processes can introduce problems.
Defensive consideration: Maintain dataset versions, review annotation quality and document preprocessing procedures.
4.3 Pretraining
During pretraining, models learn general representations and patterns from large collections of data.
Unreliable information can influence the model's learned behaviour.
Defensive consideration: Establish dataset governance, maintain source records and use independent evaluation material.
4.4 Supervised fine-tuning
Supervised fine-tuning adapts a pretrained model using instruction-and-response examples.
A contaminated dataset may introduce incorrect responses or unwanted behavioural associations.
Defensive consideration: Review fine-tuning examples, preserve the original checkpoint and compare model behaviour before and after training.
4.5 Reinforcement learning
Reinforcement learning and preference-based optimisation can influence model behaviour through rewards, rankings or feedback.
If feedback is manipulated or systematically unreliable, the optimisation process may encourage undesirable behaviour.
This includes risks involving reward-model quality, human annotation and automated feedback systems.
Defensive consideration: Verify feedback sources, document reward criteria and independently evaluate the resulting model.
4.6 Model conversion and distribution
Models may be converted into different formats for deployment.
Developers might use checkpoint conversion, quantisation or other transformations.
Third-party repositories and distribution infrastructure introduce additional trust requirements.
Model files should be checked for unexpected modifications, and conversion procedures should be documented.
Defensive consideration: Verify file integrity, preserve trusted original checkpoints and record conversion details.
4.7 Deployment
A model that passed development testing may encounter different inputs in production.
Unexpected input patterns, retrieval content and application integrations can introduce additional risks.
Defensive consideration: Monitor behaviour, maintain application-level access controls and establish an incident-response process.
4.8 Updates and maintenance
AI applications frequently receive new datasets, model versions, dependencies and configuration changes.
A previously trusted system can become unreliable after an update.
Defensive consideration: Treat every significant model or dataset update as a new security review event.
5. Detection and Investigation
Detecting model backdoors and data poisoning is challenging because neither problem necessarily produces obvious signs.
A reliable investigation requires several complementary techniques.
No single method can guarantee that a model is completely free from hidden vulnerabilities.
5.1 Dataset auditing
Dataset auditing examines training examples for quality problems, inconsistencies, unusual patterns and suspicious records.
For example, a developer can inspect whether particular labels are disproportionately associated with unusual examples.
Tools such as Cleanlab help identify potentially incorrect labels, outliers, ambiguous examples and duplicate records.
However, unusual data is not automatically malicious.
Legitimate datasets can naturally contain rare examples and unusual distributions.
Automated detection should therefore support human review rather than replace it.
5.2 Data provenance and source verification
Provenance records where data originated and how it changed during processing.
A useful dataset record should include:
- Original source.
- Collection date.
- Dataset version.
- Licence and usage information.
- Processing history.
- Annotation methodology.
- Integrity information.
This makes it easier to investigate unexpected model behaviour and identify potentially compromised sources.
Provenance cannot establish that every original statement is true, but it provides accountability and traceability.
5.3 Duplicate and anomaly detection
Duplicate detection identifies repeated or near-identical examples.
Anomaly detection identifies examples that differ significantly from the expected dataset distribution.
These techniques can reveal accidental duplication, unusual data clusters and certain forms of manipulation.
However, a sophisticated poisoned example may look statistically normal.
Conversely, a legitimate but rare example may be incorrectly flagged.
Therefore, anomaly detection should not be treated as proof of malicious activity.
5.4 Label-quality checks
Incorrect labels can significantly influence supervised training.
Label auditing compares examples, labels and model predictions to identify potentially inconsistent annotations.
For text datasets, this can involve reviewing whether an answer actually addresses the associated question.
For classification datasets, it can involve checking whether the assigned category matches the example.
Human review remains important because automated systems can also misunderstand ambiguous examples.
5.5 Independent evaluation datasets
One important defensive practice is maintaining an evaluation dataset that is separate from the training dataset.
The evaluation material should be controlled independently and should represent the actual tasks the model is expected to perform.
For security-sensitive systems, evaluation should include:
- Ordinary inputs.
- Unusual but legitimate inputs.
- Ambiguous inputs.
- Adversarially constructed test cases.
- Inputs covering important application-specific edge cases.
A model should be evaluated before and after fine-tuning.
This makes it easier to identify unexpected behavioural changes.
5.6 Behavioural testing
Behavioural testing examines how a model responds to different input conditions.
For example, a developer can compare responses to semantically equivalent questions expressed in different ways.
If the model produces a highly unusual response under one specific condition, investigators can examine whether that behaviour is reproducible.
Repeated observations provide useful evidence, but they do not automatically establish a backdoor.
Language models are probabilistic systems, and ordinary variations in output are expected.
5.7 Comparing models before and after fine-tuning
Developers should preserve an original model checkpoint.
They can then compare the original and fine-tuned versions using the same evaluation dataset.
Important measurements include:
- Task accuracy.
- Response consistency.
- Instruction-following behaviour.
- Factual reliability.
- Unexpected output patterns.
- Performance on security-focused test cases.
This comparison helps identify behavioural changes introduced during fine-tuning.
It cannot independently establish the integrity of the original model.
5.8 Model-weight integrity verification
Model-weight integrity verification checks whether files have changed unexpectedly.
Cryptographic hashes such as SHA-256 can help establish whether a downloaded file matches a previously recorded version.
For example:
sha256sum model.safetensors
The resulting hash can be compared against a trusted, independently obtained reference.
An important limitation must be understood: a matching hash proves that a file matches the reference hash. It does not prove that the original model was trustworthy.
A malicious or compromised model can have a perfectly valid hash.
5.9 Production monitoring
After deployment, developers should monitor model outputs and relevant system behaviour.
Monitoring can help identify:
- Sudden changes in response patterns.
- Unexpected increases in incorrect answers.
- Repeated unusual output behaviour.
- Changes following model updates.
- Problems associated with particular input categories.
Monitoring should also respect user privacy and applicable data-protection requirements.
A production monitoring system cannot identify every hidden vulnerability, but it provides an additional opportunity to investigate unexpected behaviour.
6. Prevention and Security Best Practices
Preventing model backdoors and data poisoning requires a security process that covers the entire AI development pipeline.
Use trusted training datasets
Obtain datasets from sources with documented origins, maintenance practices and appropriate usage permissions.
Do not assume that a dataset is trustworthy simply because it is popular or publicly available.
Maintain dataset provenance
Keep records of the origin, version and processing history of every important dataset.
This is particularly useful when combining multiple external datasets.
Verify model downloads
Use trusted model repositories and verify downloaded files against independently obtained checksums or other authenticity information when available.
For Git-based repositories, review the source repository and relevant release information.
Review third-party model checkpoints
A pretrained model should be treated as an external software dependency.
Review its model card, repository history, configuration files, supported architecture and available provenance information.
Maintain independent evaluation datasets
Do not evaluate a model exclusively on examples used during training.
Independent evaluation helps identify overfitting, data leakage and certain unexpected behavioural changes.
Record training configurations
Maintain records of:
- Base model and revision.
- Dataset versions.
- Training software.
- Hyperparameters.
- Random seeds.
- Training duration.
- Model checkpoints.
- Evaluation results.
These records improve reproducibility and make investigations easier.
Preserve original checkpoints
Always retain an unchanged copy of the original model before fine-tuning.
This makes it possible to compare the original and modified models and investigate when unexpected behaviour appeared.
Audit software dependencies
AI development involves multiple software packages, libraries, model loaders and conversion tools.
A compromised dependency can undermine the security of an otherwise trustworthy model.
Use maintained packages, review dependency changes and maintain a software inventory.
Restrict unnecessary network access
Training and inference environments should have only the network access they actually require.
Separate model development from production infrastructure where practical.
Avoid granting unnecessary permissions to model-loading and training environments.
Monitor model outputs
Establish an evaluation and monitoring process that checks for unexpected behavioural changes.
Do not rely exclusively on benchmark performance.
Review third-party contributions
External datasets, training scripts, model adapters and configuration changes should undergo appropriate review before being accepted into production.
Establish an AI model security review process
Organisations should define clear security responsibilities throughout the model lifecycle.
A security review should cover the model, dataset, training configuration, dependencies, deployment environment and update procedures.
The NIST AI Risk Management Framework provides a useful foundation for organising AI risk-management activities.
6.1 Securing an open-weight model before fine-tuning
Open-weight models provide developers with access to pretrained parameters, making customisation and local deployment possible.
However, access to model weights does not automatically establish that a model is secure.
Before fine-tuning an externally obtained model, developers should establish a verification process.
Step 1: Verify the repository
Identify the official repository and confirm that the model name, publisher and repository information are consistent.
Avoid downloading important model files from unknown mirrors.
Step 2: Inspect model documentation
Read the model card and review the intended use, architecture, training information, known limitations and supported configurations.
Step 3: Verify the files
Record cryptographic hashes for the downloaded files.
Use trusted reference hashes where available.
Step 4: Review the loading process
Inspect the model-loading dependencies and avoid executing untrusted repository code without understanding its purpose.
Prefer standard, documented model formats and safe loading procedures.
Step 5: Evaluate the original model
Run an independent baseline evaluation before changing any weights.
Record representative responses and relevant performance measurements.
Step 6: Audit the fine-tuning dataset
Check for incorrect answers, duplicated examples, unreliable sources and inconsistent formatting.
Maintain a record of all dataset transformations.
Step 7: Preserve the original checkpoint
Keep the original model unchanged and store the fine-tuned version separately.
Step 8: Compare the results
Evaluate both versions using the same independent tests.
Investigate unexpected changes rather than assuming that fine-tuning improved every aspect of the model.
Step 9: Secure deployment
Use appropriate access controls, dependency management, monitoring and update procedures.
This approach reduces avoidable supply-chain risks, although it cannot guarantee that every hidden vulnerability will be detected.
7. Practical Case Study: Fine-Tuning an Open-Weight Model
Consider a hypothetical developer building a custom educational AI assistant using Qwen2.5-0.5B-Instruct.
The purpose is to answer educational questions, explain scientific concepts and summarise learning material.
The following example demonstrates a defensive development workflow.
It is not an allegation that the named model contains a backdoor or has experienced a confirmed data-poisoning incident.
Step 1: Obtain the original model
The developer begins with the official model repository:
Qwen2.5-0.5B-Instruct — Official Hugging Face Repository.
The repository provides model information, configuration files and downloadable model weights.
The developer checks that the repository is the expected publisher's repository and records the model revision used.
Step 2: Check model files and integrity
The downloaded files are inspected.
The developer records their names, sizes and SHA-256 hashes.
Where trusted reference hashes are available, the recorded values are compared.
The developer also reviews the model configuration and loading dependencies.
This establishes a baseline for future integrity checks.
Step 3: Audit the fine-tuning dataset
The educational assistant requires question-and-answer examples.
The developer collects material from suitable educational sources and prepares a structured dataset.
Each example is reviewed for:
- Scientific correctness.
- Relevant answers.
- Consistent formatting.
- Duplicate content.
- Unreliable source material.
- Inappropriate or unnecessary information.
A dataset-quality tool can help identify suspicious records, but important scientific claims should still receive appropriate human review.
Step 4: Maintain an independent evaluation dataset
The developer creates a separate evaluation dataset that is not included in training.
It contains questions covering biology, chemistry, physics and general educational knowledge.
The evaluation set also includes questions that test consistency, ambiguity handling and factual reliability.
This dataset remains unchanged throughout training.
Step 5: Compare original and fine-tuned behaviour
Before fine-tuning, the original model is evaluated.
After fine-tuning, the same evaluation is repeated.
The developer compares:
| Evaluation area | Original model | Fine-tuned model | |---|---|---| | Educational question answering | Baseline measurement | Compared with baseline | | Scientific accuracy | Baseline measurement | Compared with baseline | | Summarisation quality | Baseline measurement | Compared with baseline | | Instruction following | Baseline measurement | Compared with baseline | | Response consistency | Baseline measurement | Compared with baseline | | Unusual input behaviour | Baseline testing | Compared with baseline |
The purpose is to identify improvements and unexpected regressions.
A higher score in one category should not automatically be interpreted as an overall security improvement.
Step 6: Record training configurations and checkpoints
The developer preserves:
- Original model revision.
- Dataset version.
- Training configuration.
- Fine-tuning method.
- Software dependencies.
- Evaluation results.
- Original checkpoint.
- Fine-tuned checkpoint.
If the model uses QLoRA, the adapter configuration and adapter weights are also preserved.
This helps establish which changes occurred during the training process.
Step 7: Monitor the deployed assistant
After deployment, the developer continues evaluating the model.
Unexpected response patterns are investigated, especially when they appear following an update or configuration change.
New model versions are not automatically trusted simply because they originate from the same repository.
Each important update receives a fresh integrity and behavioural review.
Lessons from the case study
The most important lesson is that fine-tuning should be treated as a controlled software-development process rather than simply running a training script.
A trustworthy development process requires:
- A verified starting model.
- Reviewed training data.
- Independent evaluation.
- Reproducible training records.
- Model integrity checks.
- Continuous monitoring.
These practices are useful whether the model runs locally, in a cloud environment or as part of a larger AI application.
8. Tools and Research Resources for AI Security
Several research and development tools can help investigate dataset quality, model behaviour and application-level security.
They address different problems and should not be treated as interchangeable solutions.
8.1 Cleanlab
Official documentation: https://docs.cleanlab.ai/
GitHub: https://github.com/cleanlab/cleanlab
Cleanlab is an open-source toolkit for identifying problems in machine-learning datasets.
It helps detect potentially incorrect labels, ambiguous examples, outliers and duplicate records.
For developers preparing fine-tuning datasets, it can provide useful information about data quality before training begins.
Its capabilities are particularly relevant when working with labelled datasets.
Limitations: Cleanlab does not establish whether a model contains a backdoor. Identifying unusual examples also does not prove malicious manipulation. Its findings require interpretation and appropriate review.
8.2 BackdoorBench
Official project: https://backdoorbench.github.io/
GitHub: https://github.com/SCLBD/BackdoorBench
BackdoorBench is a research benchmark designed to support the study and evaluation of backdoor learning methods and defences.
It provides implementations and evaluation infrastructure for studying different backdoor-learning approaches.
Researchers can use it to compare defensive techniques under controlled experimental conditions.
It is particularly useful for academic investigations into model backdoors.
Limitations: It is a research benchmark, not a universal security scanner for every production language model. Results from supported benchmark settings cannot automatically be generalised to all architectures and applications.
8.3 NVIDIA NeMo Guardrails
Official documentation: https://docs.nvidia.com/nemo/guardrails/
GitHub: https://github.com/NVIDIA/NeMo-Guardrails
NeMo Guardrails is an open-source toolkit for adding programmable controls to language-model applications and agentic systems.
It supports controls involving conversational inputs, outputs, agent tool calls and retrieved information.
For example, an application can define which tools an AI agent is permitted to use and apply checks to certain types of interactions.
These controls are useful for reducing application-level risks.
Limitations: Guardrails do not establish that the underlying model weights are free from backdoors. Application-level restrictions cannot replace dataset verification or model-integrity checks.
8.4 Garak
Official documentation: https://docs.garak.ai/
GitHub: https://github.com/NVIDIA/garak
Garak is an open-source LLM vulnerability scanner.
It tests language models and LLM-based applications using different probes and detectors.
Its assessments cover areas such as prompt injection, information leakage, hallucination, misinformation and other unwanted behaviours.
Developers can use it as part of an AI security testing programme.
Limitations: Garak is not a universal model-backdoor detector. Its findings depend on available probes, detectors, model interfaces and testing coverage. A clean scan does not prove that a model is completely secure.
8.5 Additional research resources
The following resources are useful for understanding AI security from a broader perspective.
NIST AI Risk Management Framework
https://www.nist.gov/itl/ai-risk-management-framework
Provides a framework for identifying, assessing and managing AI-related risks across development and deployment.
MITRE ATLAS
https://atlas.mitre.org/
A knowledge base describing adversarial threats and techniques involving AI-enabled systems.
It includes entries concerning training-data poisoning, AI supply-chain compromise and other AI-related threats.
OWASP Top 10 for LLM Applications
https://owasp.org/projects/top-10-for-large-language-model-applications/
Provides security guidance for common risks affecting language-model applications, including training-data poisoning and supply-chain vulnerabilities.
Dataset Security for Machine Learning: Data Poisoning, Backdoor Attacks, and Defenses
https://doi.org/10.1109/TPAMI.2022.3162397
A research paper examining dataset vulnerabilities, poisoning threats and defensive approaches.
9. Important Misconceptions About AI Security
Several common assumptions can create a false sense of security.
Misconception 1: Open-source models are automatically safe
Open-weight models provide access to model parameters, but this does not establish the integrity of the training process.
A publicly available model may still have incomplete provenance information or unknown training-data limitations.
Developers must evaluate models independently.
Misconception 2: Large datasets cannot be poisoned
Dataset size does not guarantee dataset integrity.
A large dataset may contain unreliable sources, duplicated examples, incorrect labels or manipulated information.
Scale can make auditing more difficult rather than eliminating the problem.
Misconception 3: High benchmark scores prove that a model has no backdoor
Benchmark scores measure performance under selected evaluation conditions.
They do not establish that every possible input condition has been examined.
A model can perform well on ordinary tests while retaining hidden conditional behaviour.
Misconception 4: Fine-tuning always removes unwanted behaviour
Fine-tuning changes model parameters, but it does not guarantee that every unwanted association will disappear.
Some behaviours may persist, while others may be modified or introduced.
The outcome depends on the training procedure and model characteristics.
Misconception 5: Every unusual response is evidence of a backdoor
Language models can produce unexpected answers for many ordinary reasons.
Ambiguous questions, hallucinations, sampling variation and insufficient context can all influence outputs.
A backdoor investigation requires reproducible evidence of suspicious conditional behaviour, not simply one incorrect answer.
Misconception 6: Data poisoning and model backdoors are identical
Data poisoning concerns manipulated training information.
A model backdoor concerns hidden conditional behaviour in a model.
Poisoning can introduce a backdoor, but it can also produce other forms of model degradation or manipulation.
Misconception 7: Local AI models are automatically secure
Running a model locally can provide greater control over where data is processed.
However, local deployment does not automatically establish the integrity of the model files, training data, software dependencies or operating environment.
A compromised model remains potentially compromised even when it runs without an internet connection.
10. The Future of AI Supply-Chain Security
AI development increasingly depends on interconnected resources.
Developers use externally maintained models, datasets, software packages, training frameworks and evaluation tools.
This creates a complex supply chain in which trust must be established at multiple stages.
Several areas deserve particular attention.
Open-weight model distribution
Open-weight models make AI development more accessible.
However, developers need reliable ways to establish model identity, revision history, file integrity and provenance.
The ability to download model weights should not be confused with independent verification of the model's development history.
Third-party datasets
External datasets are essential to many machine-learning projects.
Future dataset-security practices will need to emphasise source verification, version management, documentation and independent quality assessment.
Model repositories
Model repositories are increasingly important parts of the AI ecosystem.
They need strong controls around publishing, maintaining and updating model artifacts.
Developers should be able to distinguish official releases from unofficial copies and understand the provenance of the files they download.
Synthetic training data
As synthetic data becomes more widely used, its quality and origin will become increasingly important.
Developers need ways to evaluate whether generated material is accurate, diverse and appropriate for its intended training objective.
Automated data collection
Automated collection systems can gather enormous amounts of information.
However, automation does not guarantee that collected material is trustworthy.
Future AI development practices will need stronger controls over source selection, data filtering and content verification.
AI model provenance
Model provenance concerns the history and origin of a model, including its training data, development process and modifications.
Improved provenance can help organisations understand where a model came from and what changes occurred before deployment.
It cannot independently prove that a model is free from vulnerabilities, but it makes security investigations more accountable.
Reproducible training
Reproducible training allows developers and researchers to document the conditions under which a model was produced.
This includes training datasets, configurations, dependencies and evaluation results.
Reproducibility helps investigators distinguish expected training behaviour from unexplained changes.
Independent security audits
Independent audits can provide an additional layer of confidence.
An audit may examine datasets, model files, training procedures, software dependencies and deployment controls.
However, even a well-conducted audit has a defined scope. It cannot guarantee the absence of every unknown vulnerability.
The broader direction is clear: AI security needs to become a standard part of model development rather than an activity performed only after deployment.
11. Conclusion
Artificial intelligence security is not simply a question of whether a model produces accurate answers.
A model can achieve strong benchmark results and still contain hidden behavioural vulnerabilities. Similarly, a model can be built using a sophisticated architecture but learn unreliable information from manipulated or poorly reviewed training data.
Model backdoors and data poisoning demonstrate two different weaknesses in the AI development process.
Data poisoning threatens the integrity of the information used to train models. Model backdoors threaten the integrity of the resulting model's behaviour.
Their relationship highlights why AI security must extend beyond the final application.
Developers need to understand the origin of their datasets, verify the models they download, preserve original checkpoints, audit dependencies and evaluate behavioural changes throughout training and deployment.
Open-weight models provide valuable opportunities for researchers, students and developers, but responsible use requires an understanding of the associated supply-chain risks.
Tools such as Cleanlab, BackdoorBench, Garak and NVIDIA NeMo Guardrails can contribute to a broader defensive strategy. None should be considered a complete solution on its own.
Ultimately, trustworthy AI depends on the integrity of the entire development process.
The most important lesson is this: Do not trust an AI model simply because it works correctly. Understand what it learned, verify where it came from, examine how it changes, and continue testing how it behaves.
References and Further Reading
The following publications and official resources provide the technical foundation for this article.
Academic research
- BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chain (2017)
Tianyu Gu, Brendan Dolan-Gavitt and Siddharth Garg.
https://arxiv.org/abs/1708.06733
- Threats to Training: A Survey of Poisoning Attacks and Defenses on Machine Learning Systems (2022)
Zhibo Wang et al.
https://doi.org/10.1145/3538707
- Dataset Security for Machine Learning: Data Poisoning, Backdoor Attacks, and Defenses (2023)
Micah Goldblum et al.
https://doi.org/10.1109/TPAMI.2022.3162397
- Backdoor Learning: A Survey (2024)
Yiming Li, Yong Jiang, Zhifeng Li and Shu-Tao Xia.
https://doi.org/10.1109/TNNLS.2022.3182979
Official security frameworks
- NIST AI Risk Management Framework
https://www.nist.gov/itl/ai-risk-management-framework
- MITRE ATLAS
https://atlas.mitre.org/
- OWASP Top 10 for LLM Applications
https://owasp.org/projects/top-10-for-large-language-model-applications/
Tools and documentation
- Cleanlab
https://github.com/cleanlab/cleanlab
- BackdoorBench
https://github.com/SCLBD/BackdoorBench
- NVIDIA NeMo Guardrails
https://github.com/NVIDIA/NeMo-Guardrails
- Garak
https://github.com/NVIDIA/garak
Model documentation
- Qwen2.5-0.5B-Instruct — Official Model Repository
https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct
Editorial note: The hypothetical examples in this article are educational illustrations. They should not be interpreted as reports of confirmed attacks against the named model or any specific organisation. Research findings and defensive capabilities should be interpreted within the experimental conditions and documented limitations of their respective sources.