ContextGuard cell-repair model (Gemma 4 E4B, fine-tuned)
A fine-tuned Gemma 4 E4B-it that looks at one suspicious cell of a table, together with its row, a profile of its column, dependency evidence and similar rows, and answers whether the cell is an error, what kind, and what the repair should be. It is one stage of the ContextGuard pipeline for cleaning tabular data.
Licence: CC BY-NC 4.0 for our changes, free to use, share and adapt with credit, not for commercial use. Google's original Gemma 4 E4B-it stays under Apache-2.0, see LICENSE, LICENSE-APACHE-2.0 and NOTICE. This is an open-weights, non-commercial release; it is not an OSI "open source" licence.
Model
| Base model | Gemma 4 E4B-it by Google DeepMind (Apache-2.0; 7.9 B parameters loaded, 4.5 B effective) |
| Fine-tuning | LoRA, rank 16, alpha 32, dropout 0.05, on the attention and MLP projections (34.9 M trainable parameters, 0.44%); adapters merged into the weights, bfloat16 |
| These weights | Equal average of three fine-tuned versions: the M4 model, retrain A and retrain B |
| Input | One prompt per candidate cell, built from the dirty table only: the row with the cell marked, a column profile, dependency evidence and similar rows |
| Output | JSON {"is_error", "error_type", "evidence", "repair"}; P(error) is read from the first answer token, and the repair gets the minimum token probability of its value |
| Decoding | Greedy, so a run repeats exactly. The answer is forced to start with {"is_error": so the first generated token is the decision |
| Resources | Peak GPU memory 16.8 GiB; about 0.23 s per model call |
The model is meant to sit inside a pipeline. Detectors choose which cells it sees, a gate decides what its answer may do (flag at P(error) 0.5, repair at 0.8 with the repair's weakest token at least 0.9), and a rule-based validator labels each repair verified, not verified or needs review. It is not meant to be run on every cell of a table without that pipeline.
Training data
- M4 model: one epoch on 55,091 instruction examples built from five benchmark tables (Hospital, Flights, Beers, Rayyan, Movies), external tables (Tax, Inpatient, Facilities) and synthetic errors (20% of the training set), with entity-aware 70 / 15 / 15 splits and 29 leakage checks.
- Retrain A: two epochs, adding four error families injected only into clean training splits: realistic typos, abbreviations and initials, scrambled categorical values, and high-rate empty cells in repeating columns.
- Retrain B: as A, plus extra context lines for empty cells (20,722 examples).
- No validation, test or unseen table was used for training.
The benchmark tables come with research-use terms (several have no licence file), which is one reason this release is non-commercial. Sources and attributions are listed in the project repository.
Evaluation
| Setting | Result |
|---|---|
| Validation, five core tables (29,200 cells) | F1 0.932, precision 0.950, ECE 0.014 |
| Unseen tables, final pipeline | mean F1 0.507 (Raha and Baran with 20 labelled rows 0.454, dBoost 0.262, HoloClean 0.229) |
| Unseen tables, per table | Soccer 0.807, German 0.780, Billionaire 0.766, Marketing 0.177, Restaurant 0.006 |
| Repairs applied without a human, unseen tables | wrong 1.5% (German) to 13.4% (Marketing); 98.3% on Restaurant |
Intended use
Finding and repairing cell-level errors in tabular data (typos, wrong formats, rule breaks, empty values that should be filled) where a person reviews the result.
Where it should not be relied on
- Tables with very few errors. On Restaurant (0.5% of cells wrong) false flags outnumber the errors and almost every applied repair is wrong.
- Errors that look valid on their own, such as a real category value in the wrong row: the detectors do not send them to the model.
- Empty cells under another labelling policy. The model may flag blanks that a table treats as normal.
- Values with no reference. Where no rule or other row gives the right value, a repair is a guess.
- High-stakes decisions without review. A verified repair is consistent with the rules, not proven correct.
Credit
If you use the model, please credit Sidhaarth Shree and Google DeepMind for the base model.