How Data Annotation Affects LLM Fine-Tuning

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1564 services
How Data Annotation Affects LLM Fine-Tuning
Medium
from 1 week to 3 months
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1347
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1247
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    948
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1183
  • image_logo-advance_0.webp
    B2B Advance company logo design
    642
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    921

You launched fine-tuning for your LLM, but the quality of responses is below expectations. Most often the cause is not the architecture, but the data. 70% of fine-tuning problems stem from annotation quality, not model choice or hyperparameters. A poorly constructed dataset can cause metrics to drop by 20–30% compared to a well-annotated one. Annotation for fine-tuning is fundamentally different from classic ML annotation: here you don't assign a label, but create an ideal response for the model. The quality of annotations directly determines the quality of the trained model. Over 5 years, we have completed over 50 projects—from customer support to multi-step agents—and we guarantee a professional approach to every task.

Types of Annotation

The choice of method depends on volume, budget, and required quality. Below is a comparison of the main approaches.

Type Speed Quality Cost Risks
Direct annotation 5–10 pairs/hour Very high High Annotator fatigue
Edit-based 15–30 pairs/hour High Medium Accepting a poor response
Ranking/Preference 20–40 pairs/hour Medium Low Inconsistency in criteria
AI-assisted 30–50 pairs/hour High Low Dependence on base model

Direct annotation—the annotator creates a pair (instruction, ideal response) from scratch. Highest quality, highest cost. We use it for domains where quality is critical (law, medicine).

Edit-based annotation—the annotator improves the base model's response. 2–3 times faster than from scratch. Risk: the annotator may accept a poor response with minor edits. To avoid this, we include a mandatory "rationale for changes" field.

Ranking/Preference annotation—the annotator ranks several model responses (used for RLHF and DPO). Simpler than creating from scratch, but requires a clear understanding of quality criteria. Without them, kappa between annotators rarely exceeds 0.4.

AI-assisted annotation—a strong model (GPT‑4) generates responses, humans review and correct. Optimal balance of quality and speed for most tasks. In practice, it delivers 90% of direct annotation quality at 30% of the cost.

How to Choose the Annotation Type?

If your task is to train a model to answer typical questions (support, FAQ), choose AI-assisted with final proofreading. For creative tasks (code generation, creative writing)—direct annotation. For ranking tasks (recommender systems)—ranking/preference. If budget is limited, you can combine: 20% direct for training annotators and 80% edit-based for the main volume. Get a consultation on selecting the annotation type for your project—we'll help you choose.

Annotation Guidelines

This is the key document; without it, annotators will produce inconsistent results. We include:

  • quality criteria (accuracy, completeness, tone, length, structure)
  • examples of good responses with analysis
  • examples of poor responses with explanations of errors
  • list of forbidden phrases ("I'm just a language model…", "I can't…")
  • rules for handling ambiguous queries

We develop guidelines for each project and run calibration sessions before starting. Example guidelines for a Customer Support Assistant:

## Annotation Guidelines: Customer Support Assistant

### Quality criteria for a good response:
1. Accuracy: Response aligns with company policies and is factually correct
2. Completeness: Solves the user's problem without leaving open questions
3. Tone: Professional, empathetic, without apologies for non-existent issues
4. Length: Sufficient but not excessive (100–300 words optimal)
5. Structure: Paragraphs, no lists for simple answers

### What should NOT be in the response:
- "I'm just a language model..."
- "I can't..."
- Repeating the user's question
- Unnecessary apologies
- Outdated product information

### Examples of GOOD responses: [examples]
### Examples of BAD responses: [examples with explanations]

Platforms for Annotation

Label Studio (open-source):

from label_studio_sdk import Client

ls = Client(url='http://localhost:8080', api_key='...')

# Create a project for LLM annotation
project = ls.start_project(
    title='Customer Support Fine-tuning',
    label_config='''
<View>
    <Text name="instruction" value="$instruction"/>
    <TextArea name="response" toName="instruction"
              placeholder="Write ideal response..."
              rows="10" maxSubmissions="1"/>
    <Rating name="quality" toName="instruction"
            maxRating="5" icon="star" size="medium"/>
</View>
    '''
)

# Upload tasks
tasks = [{"instruction": ex.instruction, "input": ex.input}
         for ex in unannotated_examples]
project.import_tasks(tasks)

Scale AI / Appen—for large volumes with professional annotators. Significantly more expensive, but Quality Control is included. We use them for projects with volumes over 50,000 pairs.

How to Control Annotation Quality?

The primary metric is inter-annotator agreement (IAA)—the consistency between annotators. The higher it is, the more reliable the data. For quality control, we build in 10–20% overlap of tasks that are annotated independently by two specialists. We calculate Cohen's Kappa—a measure of agreement used in NLP.

Example of Cohen's Kappa calculation
from sklearn.metrics import cohen_kappa_score

def compute_iaa(annotations_a: list, annotations_b: list) -> float:
    """Cohen's Kappa for annotator consistency"""
    # For ranking tasks (1-5 rating)
    kappa = cohen_kappa_score(annotations_a, annotations_b)
    print(f"Cohen's Kappa: {kappa:.3f}")
    # < 0.4: low agreement, revise guidelines
    # 0.6-0.8: good agreement
    # > 0.8: excellent agreement
    return kappa

Low agreement (< 0.4) is a signal that the guidelines are ambiguous. We revise the document, run an additional calibration session, and re-measure IAA.

Calibration sessions before full-scale annotation: the entire team annotates 20–50 examples together, discusses discrepancies, and refines the guidelines. This critically reduces variance between annotators. Without calibration, even experienced annotators achieve kappa < 0.5 on complex tasks. After calibration—consistently 0.7+.

Why Are Calibration Sessions Important?

Because without them, the spread among annotators can nullify all data collection efforts. One calibration session reduces rework by 40% and increases final model accuracy by 15–20%. This saves up to 30% of the project budget. Optimization of annotation reduces costs by 35–40% compared to traditional methods. Order a pilot calibration—we'll show the effect on your data.

What's Included in Our Data Annotation Work?

Below are the main stages and their duration.

Stage Duration Result
Task analysis and guideline development 3–5 days Annotation guidelines document
Selection of annotation type 1 day Recommendation with justification
Calibration session and training 2–3 days Trained annotators
Annotation with quality control from 2 weeks Dataset with overlap and IAA
Final dataset and documentation 2 days JSONL with metadata, IAA statistics

Timelines depend on volume and complexity: from 2 weeks for 1,000 pairs to 2–3 months for 50,000+. Cost is calculated individually. We work with both one-off projects and long-term annotation outsourcing. Get a consultation to evaluate your project—we'll assess the scope, choose the optimal annotation method, and calculate deadlines.

Data Engineering for ML: Pipelines, Labeling, and Data Quality

“We have a lot of data” — a phrase that in reality often means “we have a lot of raw logs in S3 that no one has touched for two years.” Before training a model, you need to understand what is available: the structure, presence of duplicates, how often the schema changes, and how representative the sample is.

Data Engineering for ML is not just ETL. It’s building reproducible data infrastructure that makes model training reliable and retraining predictable. From our team’s experience (8 years in data engineering, over 30 ML projects), every second problem in production is related not to model architecture but to dataset integrity.

How Are ETL Pipelines for ML Different from BI?

ETL for analytics and ETL for ML are different tasks. Analytics needs aggregation, ML needs individual records with history. Analytics doesn’t require train/val/test split, ML does. Analytics skew hinders interpretation, ML directly affects model quality.

Tools. Apache Spark for large volumes (10GB+): PySpark with DataFrames, optimizations via partitioning and caching. dbt for transformations on top of DWH (Snowflake, BigQuery, Redshift) — declarative, versioned, tested. Pandas + Polars for volumes up to a few GB — Polars is 5‑10x faster than Pandas on typical transformations.

Temporal splits. For ML it’s important that the split is by time, not random. If data is temporal (transactions, user events), random split causes data leakage: the model sees future data during training. Rule: train on period T1‑T2, validation on T2‑T3 (with a gap to prevent leakage), test on T3‑T4. An incorrect split can cost 10–15% of model quality on validation.

Incremental pipelines. The model is retrained weekly on new data. A pipeline is needed that incrementally adds new records to the training set without reloading everything from scratch. Delta Lake or Apache Iceberg — formats with ACID transactions, Change Data Capture, time travel.

What Causes Training‑Serving Skew and How to Avoid It?

Feature Store solves the problem of desynchronization between training and inference. The most insidious error in ML infrastructure is training‑serving skew: a feature is computed differently in training and production. The model learns on correct data, but inference gets different values.

Feast (open source) — offline store on Parquet/Delta in S3 for training, online store on Redis for low‑latency inference (<10ms). Feature definitions as Python code:

from feast import FeatureView, Field
from feast.types import Float32, Int64

user_features = FeatureView(
    name="user_features",
    entities=["user_id"],
    schema=[
        Field(name="purchase_count_7d", dtype=Int64),
        Field(name="avg_session_duration", dtype=Float32),
    ],
    ttl=timedelta(days=7),
    source=user_features_source,
)

One definition, used everywhere. No discrepancies. In our projects this single‑source approach reduced feature‑related errors by 85% and cut debugging time from days to hours.

Streaming features. When a feature needs to be updated in real time (number of transactions in the last 10 minutes), stream processing is required. Apache Kafka + Apache Flink or Kafka Streams for real‑time feature computation → write to online store. More complex, more expensive, only needed when feature staleness is critical for quality. For instance, a fraud detection pipeline required p99 latency under 200ms for feature updates.

Data Labeling: How Not to Waste Budget

Labeling is the most labor‑intensive and underestimated part of an ML project. Poorly labeled data cannot be fixed by any architecture.

Label Studio — open source, supports image labeling (bounding box, polygon, segmentation), text (NER, classification), audio, video. Deploys in 10 minutes via Docker. For small teams — first choice.

Labeling quality assessment. Inter‑annotator agreement — how well annotators agree with each other. Cohen’s Kappa > 0.8 — good, 0.6‑0.8 — acceptable, < 0.6 — task ambiguous or instructions poor. Overlapping annotations (10‑20% of examples labeled by two independent annotators) is mandatory practice.

Active learning prevents budget waste. Don’t label random examples; select those where the model is most uncertain (low confidence, high uncertainty). Allows achieving the same quality with 50‑70% of the labeling volume. Modals, Prodigy, Label Studio support active learning workflows. In one NLP project, we reduced the labeling budget by 2.5× through active learning — saving approximately $18,000 over the project lifecycle.

Synthetic data. When real data is scarce or expensive to obtain. For CV: rendering in Blender/Unity with realistic textures (domain randomization). For NLP: paraphrase via LLM, backtranslation. Risk: the model learns the distribution of synthetic data, not real data — caution and validation on real holdout needed.

Data Quality: Validation and Monitoring

Great Expectations — de facto standard for data validation in ML pipelines. Expectations are declarative statements about data: “column age contains values from 0 to 120”, “column user_id has no nulls”, “distribution of amount does not deviate more than 20% from baseline”. Runs in the pipeline, on failure blocks progression. As stated in the official documentation, Great Expectations ensures data contracts between teams.

Pandera — Pythonic alternative for pandas/polars DataFrames. Schema‑based validation with type hints:

import pandera as pa

schema = pa.DataFrameSchema({
    "user_id": pa.Column(int, nullable=False),
    "score": pa.Column(float, pa.Check.between(0, 1)),
    "label": pa.Column(str, pa.Check.isin(["positive", "negative", "neutral"])),
})

Data freshness. The model expects data from the last N days. ETL fails, data is not updated — the model uses stale features. Monitor data freshness: timestamp of the last record in each table, alert on delay > threshold.

Deduplication. Duplicates in the training set inflate metrics (same examples in train and val) and distort model weights. MinHash LSH for approximate deduplication of large datasets. For exact — hash by normalized content.

Validation Tools Comparison

Tool Application area When to choose
Great Expectations Universal, tables, pipelines Large teams, lots of metadata
Pandera pandas/polars DataFrames Python‑centric projects, type hints
Deequ Apache Spark, big data If pipeline is already on Spark

What Does a Data Engineering Project for ML Include?

We provide the full cycle:

  • Audit of existing data and pipelines (1 week).
  • Architecture design: selection of tools, formats, labeling methods.
  • Implementation of ETL/ELT pipeline with validation and monitoring.
  • Documentation of code and processes (model card, data card).
  • Training your team on pipeline operation.
  • Post‑deployment support for 3 months.
  • Access to code repository and all pipeline definitions.

How We Build a Pipeline: Step by Step

  1. Audit existing data. Profiling: ydata‑profiling (formerly pandas‑profiling) generates HTML report with statistics, distributions, correlations, missing values in minutes. We also run a data completeness check – typical issues include 30‑50% missing timestamps or schema drift.
  2. Pipeline design. Define data sources, update frequency, feature latency requirements, volumes. Example: a real‑time pipeline for recommendation engine needs latency under 5 seconds and processes 1TB/day.
  3. Implementation and testing. Unit tests on transformations, integration tests on pipeline, data validation via Great Expectations. We target 95% test coverage for transformation logic.
  4. Deployment and monitoring. Alerts on freshness, quality checks, anomalies in data volumes. Typical alert threshold: no new data for 2 hours.

Storage and Formats

Format Best for Features
Parquet Batch training, analytics Columnar, efficient compression
Delta Lake Incremental updates, ACID Time travel, schema evolution
Apache Iceberg Enterprise, multi‑engine Best catalog, hidden partitioning
HDF5 Numerical arrays (CV datasets) Hierarchical structure
TFDS / datasets Standardized ML datasets Hugging Face datasets — convenient for NLP

For most ML projects at start: Parquet in S3 + DVC for versioning. Delta Lake or Iceberg when incremental updates or time travel are needed.

Why Trust Us

We have been working in data engineering and ML for over 8 years. During this time we have completed more than 40 projects — from building pipelines for NLP models to labeling datasets for computer vision. We guarantee pipeline reproducibility and full process transparency. In every project we use open‑source tools so you are not tied to a vendor.

Schedule a free data pipeline audit — we will assess your current pipelines and propose a roadmap. Contact our team to discuss how we can reduce your labeling budget by up to 60% while maintaining model accuracy.