Co-Founder & CTO at @gritworks_ai: secure data access for AI. PII/PHI redaction, document-to-JSON extraction and synthetic test documents for regulated teams.
Hi X, I'm Darshil, CTO at GritWorks (https://t.co/z4iADocXEp). We help banking, insurance, healthcare and legal teams use documents for AI without exposing sensitive data. Three products, one thread:
One of the first decisions in building a test/train set from sensitive documents is whether to clean the real ones or make new ones. The two answers fail in opposite ways.
Redaction keeps what is hard to fake: a doctor's handwriting, a crossed-out dose, an abbreviation only one clinic uses, a note squeezed into the margin. A U.S. health insurer we work with needed exactly that. They wanted clinical documents real enough to test an AI agent that reads them, without a single member identity reaching the test environment.
Generation keeps control. A U.S. housing-finance organisation needed complete loan files: note, deed of trust, credit report, title, appraisal. Testing needs the same borrower, property and loan amount on every document, and variations no production file happens to contain. A generator does that well. What it can't do on its own is know what a real file from that lender looks like.
So for them the answer was both, in order. Real documents were de-identified inside their own environment, the layouts kept as templates, and the templates filled with synthetic values that stay consistent across the whole file. The real document supplies fidelity, the generator supplies volume and control, and no real borrower data leaves.
The rough rule we've come to:
- Redact when the hard part is the content itself: handwriting, free text, corrections.
- Generate when the hard part is coverage: rare combinations, degraded copies, many related documents.
- Do both when you need production layouts at test-set scale.
Either way, check the output, not the process. A redacted page should be checked for what slipped through, and a generated one for what doesn't look real.
Redaction that fails: image overlay on a live text layer.
Redaction that works: strip the text layer, re-render as a flattened image.
This is not a niche edge case. It's the default output of most PDF redaction tools.
A judge just ordered the release of Ilhan Omar's search-warrant records because the redacted version wasn't actually redacted — black boxes drawn over text that was still selectable in the PDF.
One OCR test I’d run before shipping: score a clean page and a blurred copy against the same field values. In our small Docling run at GritWorks, EasyOCR’s result changed sharply when we lowered the confidence cutoff. Check which text gets dropped before switching engines.
@kumiko_rocks Makes sense. When you measure the 4B, ask it for per-field confidence rather than per-document, and log the raw token probabilities if the runtime exposes them. A model that only says 1.0 or 0.0 usually loosens up at field level, which gives you something to bucket.
@Taxsavvyjessica@bradncpa When you test them, include a scanned PDF. Many local tools only find text that's already selectable, so scans need OCR first. Also copy-paste from under each black box to confirm the text is really gone, and check that metadata and earlier versions aren't left in the file.
@finnvoorhees Hardcoded card regex holds up well if you add a Luhn check to cut false positives. The misses are usually format: odd spacing or dashes, numbers split across lines or chat turns, and OCR'd digits (O for 0, l for 1). A small test set of each shape shows quickly where it breaks.
@telnyx Audio redaction is only as good as the transcript under it. Worth testing card numbers read in chunks, with corrections ("four one, sorry, four two") or split across two turns, as one missed chunk is still exposure. And silencing PHI is a safeguard, not HIPAA de-identification.
@de2pressed Worth putting the sample size next to the 100%: 0 misses in 100 resumes still leaves a 95% upper bound of about 3% on the miss rate. Synthetic resumes also tend to put names in the same spots, so names in tables, headers and other languages make the harder test.
@JeffreyD3V@code_sagar Makes sense. When you split it, also tag misses by context: names inside tables and headers tend to fail differently from names in running text. A dozen two-line and table-cell cases would tell you quickly whether it's the model or the text extraction.
@tymofii@AbdouAziz666 Makes sense on cost and data residency. The catch is that the local redactor becomes the security boundary, so it's worth a recall test on your own messy inputs (tickets, OCR'd PDFs, mixed languages), not just the benchmark on the model card.
@preprintpigeon Incomplete labels bite hardest in eval: a model that finds an unlabeled name gets scored as a false positive, so precision looks worse than it is. Hand-check a sample of the false positives before trusting the numbers, and keep the corrected ones as a test split.
@joehachemx Nice size for CPU. Worth stating in the docs that span recall alone doesn't make output Safe Harbor de-identified: that also wants dates cut to the year, most ZIPs cut to 3 digits and ages over 89 grouped. That's a transform step after detection.
@JeffreyD3V@code_sagar Would be useful to see that 8.9% broken down by entity type. IDs are regex-friendly, so the residue tends to sit in names and addresses. Also worth a run on OCR'd scans, where line breaks split an entity across two lines and both approaches miss it.
@theironvale@AravSrinivas@OpenRouter Offsets are great until something normalizes the text in between (Unicode NFC, whitespace cleanup, OCR post-processing). Cheap guard: assert source[start:end] == span text for every entity before redacting, and fail the batch if any don't match.
@keanumonterde Also check the places nobody looks: exception messages, retry logs and tool-call arguments. Card numbers often leak there rather than in the main input/output. A Luhn check on candidates keeps the masking from eating order numbers.
DPDP Phase 2 started on 13 Nov: consent managers can now register with the Data Protection Board. Core duties land 13 May 2027. If your personal data lives in scanned KYC copies, salary slips and bank statements, here is a six-month checklist: https://t.co/mzslMYMy0V
DeepSeek's API now offers OCR. Before switching engines, test it on your worst captures: blurred phone photos, photocopies, skewed scans. Score each field you extract, not just character error rate. And check where your documents are processed before sending anything sensitive.