← Back to Research

Reinforcement Learning

We Trained a Small Model to Detect Sensitive Data – Without Sending That Data Anywhere

Most privacy tools work by sending your sensitive data to a cloud API. We thought that was backwards. So we trained a compact open-source model – using reinforcement learning, no human feedback – that matches GPT-4o's accuracy at 11× lower cost, running entirely on your infrastructure.

Nablon ResearchMarch 30, 20268 min read
83.4%
F1 score – matching GPT-4o exactly
11×
cheaper than GPT-4o per million tokens
58
PII entity types across fin, health & legal

01 – Problem

The Core Contradiction in Enterprise PII Compliance

When a company wants to find and redact sensitive information – names, social security numbers, medical records – the go-to solution is a large language model. And almost every capable LLM is accessed through an external cloud API.

So to protect your data, you first have to send it somewhere else.

For organizations operating under GDPR, HIPAA, or any data residency regulation, that's not just inconvenient – it's a genuine compliance problem. You're exposing the exact information you're trying to protect, on infrastructure you don't control, in exchange for a result you can't fully audit.

The older alternatives weren't great either. Regex-based pattern matching is fast and cheap, but it has no sense of context. Named entity recognition models fall apart when PII shows up in unusual forms. Something had to change.

02 – Motivating RLVR

Verifiable-Output Tasks and the Case for Automated Reward Signals

Most language tasks are hard to evaluate automatically. Is this summary accurate? Is this translation natural? You need a human to judge – and that's exactly what makes training LLMs slow and expensive.

PII detection is different. When a model redacts a piece of text, you can check its work programmatically: Did it catch the name? Did it label the entity type correctly? Did it wipe out non-sensitive content it should've left alone? These are objective, checkable questions.

When you can objectively measure correctness, you can automate the entire training signal. No human in the loop required – just a simulator that gives you a perfect scorecard after every attempt.

GRPO Training Architecture – Group Relative Policy Optimization

For each input, the Llama 3.1 8B policy generates a group of candidate redactions. A programmatic reward function scores every candidate; the policy learns from how they rank against each other – no human in the loop.

03 – Architecture

GRPO-Tuned Llama 3.1 8B: Training an 8B Policy on Two Consumer GPUs

We applied this to Llama 3.1 8B – an open-weight model about 25× smaller than GPT-4 class models. Using a training method called Group Relative Policy Optimization (GRPO), we taught it to detect and redact PII across 58 entity types, drawn from financial, healthcare, and legal documents.

GRPO generates several different redaction attempts for the same input and compares them against each other. The model learns from which of its own outputs scored better, and why – self-improvement through structured competition. It cuts memory usage roughly in half compared to traditional RL setups, which is why training an 8B model on two consumer GPUs in ~120 hours is feasible.

04 – Reward Design

Multi-Signal Reward Structure: Five Orthogonal Evaluation Axes

The reward design is the most interesting part of this work conceptually. We used five distinct reward signals, each measuring a different dimension of quality:

  1. 01
    Span AccuracyDid you find the right text and label it correctly? This is the primary signal. Remove it, and performance drops by over 7 percentage points.
  2. 02
    PreservationDid you leave non-sensitive content alone? Without this, models learn a shortcut: redact everything, and recall looks great.
  3. 03
    Entity CountIs the number of detected entities in the right ballpark? Prevents both under- and over-detection at the macro level.
  4. 04
    Format ConsistencyAre outputs structured reliably? Ensures downstream parsers can always consume the model output without brittle regex fallbacks.
  5. 05
    Output StructureDoes the result stay close to the expected schema? Together with signals 3–4, this prevents the model from developing weird habits that would make it unreliable in production.

05 – Results

Benchmarking Against Frontier Models: 1,500-Example Held-Out Evaluation

We benchmarked against GPT-4o, GPT-4.1, GPT-4o-mini, and several reasoning-focused OpenAI models, using 1,500 held-out examples from the ai4privacy dataset.

F1 Score Comparison – PII Detection Accuracy
Nablon 8B
83.4%on-prem ✓
GPT-4o
83.4%cloud only
GPT-4.1
81.2%
GPT-4o-mini
77.9%
MS Presidio
27.8%
083.4%
Cost Comparison – $ per Million Tokens
Nablon 8B
$0.36
GPT-4o
$4.00
GPT-4.1
$4.80
o3
$24.00
024

Managed cloud pricing. Self-hosted Nablon 8B reduces cost further with no per-token API charges.

The most important thing is where the computation happens. Your data never leaves your infrastructure. The privacy risk this whole project was designed to solve simply does not exist.

06 – Implications

Generalizing the RLVR Pattern to Verifiable-Output Enterprise NLP

There is a class of NLP tasks that share a common structure: they require genuine language understanding, but their outputs are programmatically verifiable. PII masking is one. Compliance classification is another. So is schema tagging, legal document redaction, and PHI detection under HIPAA.

For all of these, the assumption that state-of-the-art performance requires frontier-scale models – and therefore external cloud APIs – is no longer necessarily true. If the output is verifiable, a smaller model with the right reward structure can close the gap.

That's a meaningful shift for enterprise NLP. And it's a principle that generalizes well beyond any single application.

Keep reading

Sentinel: A Continuous Evaluation Service for Production Agentic Pipelines

Read the paper →

Partners

  • OpenAI
  • Anthropic
  • Microsoft
  • Databricks
  • AWS
  • ElevenLabs
  • OpenAI
  • Anthropic
  • Microsoft
  • Databricks
  • AWS
  • ElevenLabs

Investors

  • Nexus Venture Partners