Argilla: A Data Annotation Platform for Building High Quality AI Datasets

# Argilla: Platform Anotasi Data untuk Membangun Dataset AI Berkualitas Halo temen-temen, kali ini kita bahas sesuatu yang menurutku paling sering diabaikan padahal paling menentukan keberhasilan pro...

By Ruby Abdullah · · tutorial
argilladata-annotationdatasetllm-evaluationnlp

Argilla: A Data Annotation Platform for Building High Quality AI Datasets

Hey everyone, today we cover the thing most often neglected yet most decisive for AI project success: data quality. The tool is Argilla, an open source data annotation and curation platform built for modern NLP and LLM workflows.

I regularly meet teams who spend weeks tuning hyperparameters, trying bigger models, and rewriting prompts when the real problem is their dataset: inconsistent labels, ambiguous examples, skewed class distribution. You can have the best model in the world, but if the data is messy the results stay messy.

Argilla handles that boring but crucial part. It gives your team a web interface for annotation, supports multiple annotators with disagreement resolution, integrates cleanly with the HuggingFace ecosystem, and importantly, is designed for modern workflows such as LLM output evaluation and preference data collection.

Introduction

Why You Need a Dedicated Tool

Most people start with a spreadsheet. That is reasonable and fine for the first hundred examples. But problems appear as you scale.

You have no way to track who labeled what, so when inconsistencies appear you do not know whom to ask.

You have no mechanism to measure inter-annotator agreement. Yet if two experts cannot agree on an example's label, do not expect your model to learn it.

You have no easy way to prioritize which examples to annotate. Labeling a thousand random examples is far less efficient than labeling two hundred that confuse the model most.

And you have no version history. When accuracy drops, you cannot trace whether a data change caused it.

What Argilla Offers

Argilla provides customizable annotation interfaces for many task types: classification, span labeling, ranking, rating, and free text.

It supports multiple annotators per record, so you can measure agreement and resolve conflicts.

It supports suggestions, which are model predictions shown to annotators as pre-filled answers. This speeds annotation dramatically, because annotators correct rather than type from scratch.

And it integrates directly with HuggingFace Datasets, so your annotation output is immediately ready for training.

Installation

The easiest path is Docker.

docker run -d --name argilla \

-p 6900:6900 \

argilla/argilla-quickstart:latest

After a moment, open http://localhost:6900. The default credentials are typically argilla with password 12345678, but check your container logs to confirm.

Then install the Python client:

pip install argilla

For production you should run the Argilla server against a separate Elasticsearch or OpenSearch cluster and configure authentication properly. The quickstart image suits exploration and small teams.

Connecting and Workspaces

import argilla as rg

client = rg.Argilla(

apiurl="http://localhost:6900",

apikey="argilla.apikey",

)

Check the connection

print(client.me)

Create a workspace to separate projects

workspace = rg.Workspace(name="nlp-project").create()

print("workspace created:", workspace.name)

Workspaces separate projects and control who can access what. If your team runs several projects with different annotators, use them from the start.

A Simple Classification Dataset

Let us start with the most common case: sentiment classification.

import argilla as rg

client = rg.Argilla(apiurl="http://localhost:6900", apikey="argilla.apikey")

settings = rg.Settings(

guidelines=(

"Label the sentiment of each product review.\n\n"

"positive: the customer is satisfied overall\n"

"negative: the customer is disappointed overall\n"

"neutral: unclear or balanced between praise and complaint\n\n"

"If a review complains about shipping but praises the product, "

"label based on the judgment of the PRODUCT, not the shipping."

),

fields=[

rg.TextField(name="review", title="Customer Review"),

],

questions=[

rg.LabelQuestion(

name="sentiment",

title="What is the sentiment of this review?",

labels=["positive", "neutral", "negative"],

),

rg.TextQuestion(

name="notes",

title="Notes (optional)",

required=False,

),

],

metadata=[

rg.TermsMetadataProperty(name="productcategory"),

rg.IntegerMetadataProperty(name="starrating", min=1, max=5),

],

)

dataset = rg.Dataset(

name="review-sentiment",

workspace="nlp-project",

settings=settings,

).create()

print("dataset created")

Take the guidelines seriously. This is not a formality. Clear annotation guidelines are the single largest factor determining label consistency. Notice that I include a rule for the ambiguous case, because ambiguous cases are exactly where annotators diverge.

The rule of thumb I use: every time two annotators disagree, add a rule for that case to the guidelines. Your guidelines grow and your data quality rises over time.

Adding Records

import argilla as rg

dataset = client.datasets(name="review-sentiment", workspace="nlp-project")

records = [

rg.Record(

fields={"review": "Great product, exactly as described, and shipping was fast."},

metadata={"productcategory": "electronics", "starrating": 5},

),

rg.Record(

fields={"review": "The product is fine but the courier took a whole week."},

metadata={"productcategory": "fashion", "starrating": 3},

),

rg.Record(

fields={"review": "Disappointed, the color is nothing like the photo and a seam came apart."},

metadata={"productcategory": "fashion", "starrating": 1},

),

]

dataset.records.log(records)

print("records added")

Metadata is very useful because you can filter and sort by it in the interface. For example, you can prioritize annotating three-star reviews, since those are typically the most ambiguous.

Suggestions: Speeding Up Annotation

This is the biggest time saver in my experience. You run a model to produce initial predictions and annotators simply correct them.

import argilla as rg

from transformers import pipeline

classifier = pipeline("sentiment-analysis",

model="cardiffnlp/twitter-xlm-roberta-base-sentiment")

reviews = [

"Great product, exactly as described.",

"The product is fine but the courier took a whole week.",

"Disappointed, the color is nothing like the photo.",

]

records = []

for text in reviews:

prediction = classifier(text)[0]

records.append(

rg.Record(

fields={"review": text},

suggestions=[

rg.Suggestion(

questionname="sentiment",

value=prediction["label"].lower(),

score=prediction["score"],

agent="xlm-roberta-sentiment",

)

],

)

)

dataset.records.log(records)

In the interface annotators see a pre-filled label with its confidence score. If it is right, they just submit. If wrong, they correct it. In my experience this speeds annotation by two to three times.

An added bonus: by recording the agent, you can measure how often your model was right. That is free model evaluation as a side effect of annotation.

Multi-Annotator Workflows

For important data, one annotator is not enough.

settings = rg.Settings(

guidelines="...",

fields=[rg.TextField(name="text")],

questions=[

rg.LabelQuestion(name="label", labels=["a", "b", "c"]),

],

distribution=rg.TaskDistribution(minsubmitted=3),

)

With minsubmitted=3, every record must be annotated by three different people before it counts as complete. Argilla distributes work across available annotators automatically.

To measure agreement:

from collections import Counter

dataset = client.datasets(name="review-sentiment", workspace="nlp-project")

agreed = 0

disagreed = 0

hardcases = []

for record in dataset.records(withresponses=True):

answers = [r.value for r in record.responses["sentiment"]]

if len(answers) < 2:

continue

counts = Counter(answers)

majority, count = counts.mostcommon(1)[0]

if count == len(answers):

agreed += 1

else:

disagreed += 1

hardcases.append({

"text": record.fields["review"],

"answers": answers,

})

total = agreed + disagreed

print(f"full agreement: {agreed}/{total} ({agreed/total:.1%})")

print("\ncontested examples:")

for h in hardcases[:5]:

print(f" {h['answers']} {h['text'][:70]}")

That agreement number is your project health metric. Below 80 percent, do not proceed to model training. Fix the guidelines first, because your model will never be more consistent than its data.

And the list of contested cases is gold. Read it, find the pattern, then add rules to the guidelines.

Evaluating LLM Output

This is the modern use case that makes Argilla especially relevant today. You want to judge answer quality from your RAG system or chatbot.

import argilla as rg

settings = rg.Settings(

guidelines=(

"Rate the quality of the AI assistant's answer given the retrieved context.\n\n"

"Accuracy: is the answer factual and supported by the context?\n"

"Completeness: are all parts of the question answered?\n"

"Hallucination: flag any claim NOT present in the context."

),

fields=[

rg.TextField(name="question", title="User Question"),

rg.TextField(name="context", title="Retrieved Context"),

rg.TextField(name="answer", title="AI Answer"),

],

questions=[

rg.RatingQuestion(

name="accuracy",

title="How accurate is the answer?",

values=[1, 2, 3, 4, 5],

),

rg.LabelQuestion(

name="hallucination",

title="Any hallucination?",

labels=["none", "minor", "severe"],

),

rg.TextQuestion(

name="correctedanswer",

title="If wrong, write the correct answer",

required=False,

),

],

)

evaldataset = rg.Dataset(

name="rag-evaluation",

workspace="nlp-project",

settings=settings,

).create()

The workflow goes like this. Every week, sample from your RAG system's production logs, load them into this dataset, have the team rate them, then analyze the results. The corrected answers annotators write can even become training data for later fine-tuning.

This is far more valuable than relying on automated metrics alone, because humans catch problems metrics miss.

Collecting Preference Data

For fine-tuning with DPO or other preference methods, you need comparison data.

settings = rg.Settings(

guidelines="Choose the better answer for the user's question.",

fields=[

rg.TextField(name="question"),

rg.TextField(name="answera"),

rg.TextField(name="answerb"),

],

questions=[

rg.LabelQuestion(

name="preference",

title="Which is better?",

labels=["A much better", "A slightly better",

"tie", "B slightly better", "B much better"],

),

rg.TextQuestion(name="reason", title="Why?", required=False),

],

)

Note I use a five point scale rather than a plain A or B. This yields a richer signal and lets you filter out pairs whose difference is too subtle to be useful training data.

Exporting for Training

dataset = client.datasets(name="review-sentiment", workspace="nlp-project")

Export to a HuggingFace Dataset

hfdataset = dataset.records.todatasets()

print(hfdataset)

Export to a list of dicts for custom processing

data = dataset.records.tolist(flatten=True)

Keep only completed annotations

clean = [

{"text": d["review"], "label": d["sentiment.responses"][0]}

for d in data

if d.get("sentiment.responses")

]

print(f"{len(clean)} examples ready for training")

Push to the HuggingFace Hub if desired

hfdataset.pushto_hub("username/sentiment-dataset")

Because the output is already a HuggingFace Dataset, you can feed it straight into a training pipeline with no manual conversion.

The Workflow I Recommend

Based on experience, this sequence is the most efficient.

Start by annotating fifty examples yourself with no formal guidelines. The goal is not to produce data but to discover the hard cases and ambiguities you had not considered.

Write guidelines based on those findings, including examples for ambiguous cases.

Train an initial model on that small set even if accuracy is poor. This model exists to generate suggestions.

Annotate the next batch with suggestions enabled. It goes much faster.

Measure inter-annotator agreement every batch. If it falls, go back and fix the guidelines.

Prioritize annotating the examples that confuse the model most, meaning low confidence predictions or frequently wrong ones. This is the active learning principle, and its effect dwarfs annotating random examples.

Repeat. Each cycle your data gets better and your model gets better.

Tips and Best Practices

Annotation guidelines are a living document. Update them whenever disagreement appears, and notify all annotators when they change.

Always use at least two annotators for evaluation data. For large volumes of training data, one annotator with good suggestions is usually enough.

Do not annotate random examples. Prioritize by model uncertainty or by segments that matter to your business.

Store as much metadata as you can: data source, date, customer segment, the model version that produced the suggestion. You will thank yourself later.

Keep annotation sessions short. Quality drops sharply after one to two hours. Four one-hour sessions beat one four-hour session.

Back up your datasets regularly by exporting to the HuggingFace Hub or elsewhere. Annotated data is the most expensive asset in your project, far more valuable than the model.

Conclusion

Argilla fills the most neglected yet most decisive part of the AI workflow. The summary:

Data quality sets the ceiling on model performance, and no clever architecture rescues inconsistent labels.

Clear annotation guidelines, especially for ambiguous cases, are the highest return investment in any data project.

Model suggestions speed annotation by two to three times while giving you free model evaluation.

Inter-annotator agreement is your project health metric. If humans disagree, the model cannot learn.

Argilla supports modern workflows such as LLM output evaluation and preference data collection, not just classic classification.

HuggingFace Datasets integration makes annotation output immediately usable for training.

Start with one real problem: take a hundred outputs from an AI system you currently run, load them into Argilla, and have two colleagues rate their quality. The resulting number is usually more honest than every automated metric you have been watching, and it tells you exactly what to fix. Happy annotating.

Related Articles

Semantic Router Tutorial: Smart Routing for LLM Applications

Tutorial Semantic Router: Routing Cerdas untuk Aplikasi LLM Semantic Router adalah library Python yang memungkinkan Anda...

Presidio Tutorial: Detect and Anonymize PII Data with Python

Tutorial Presidio: Deteksi dan Anonimisasi Data Pribadi (PII) dengan Python Dalam era AI dan big data, perlindungan data...

Distilabel Tutorial: Synthetic Data Generation Framework for LLM Fine-Tuning

Tutorial Distilabel: Framework Generasi Data Sintetis untuk Fine-Tuning LLM Dalam dunia pengembangan Large Language Mode...

Giskard: Testing and Evaluating ML Models plus LLM/RAG Apps So Nothing Leaks in Production

Giskard: Testing dan Evaluasi Model ML plus Aplikasi LLM/RAG Biar Nggak Bocor di Produksi Halo temen-temen, ketemu lagi ...