Anonymizer icon indicating copy to clipboard operation
Anonymizer copied to clipboard

GLiNER detection fails when response text contains HTML comments

Open maxpaulus43 opened this issue 2 months ago • 2 comments

Priority Level

Medium (Annoying but has workaround)

Describe the bug

During ATIF scrubbing, _raw_detected_entities fails with:

Non-retryable failure on _raw_detected_entities[rg=0, row=32]:
sequence item 3: expected str instance, _cython_3_2_9.cython_function_or_method found

We reproduced the exact exception locally with a synthetic GLiNER-style JSON response containing an HTML comment. The original failing response from the Spark run has not been captured, so that specific trigger remains unconfirmed.

Steps/Code to reproduce bug

from data_designer.engine.models.recipes.response_recipes import TextResponseRecipe

TextResponseRecipe().parse('{"entities": [{"text": "<!-- Alice -->"}]}')

Relevant traceback:

response_recipes.py:49, in <lambda>
    return lambda x: parser.parse(x).response
parser.py:221, in parse
    parsed_block = self.lookup_parser(element)(element)
parser.py:161, in lookup_parser
    tag_path = ".".join(lineage)
TypeError: sequence item 3: expected str instance, _cython_3_2_9.cython_function_or_method found

Expected behavior

Detector responses should preserve entity text containing HTML comments without failing.

Additional context

Locally reproduced with:

  • NeMo Anonymizer 0.4.0
  • Data Designer Engine 0.9.3
  • lxml 6.1.3

Anonymizer defines _raw_detected_entities as an LLMTextColumnConfig, which uses Data Designer's TextResponseRecipe. That recipe parses the response as Markdown/HTML even though it ultimately returns the original response. An lxml comment node has a function-valued .tag, causing the string join to fail.

Could the text recipe pass the raw response through without HTML parsing, or could the detector path bypass that parsing? This appears to originate in the Data Designer dependency, but surfaces during Anonymizer detection.

maxpaulus43 avatar Sep 25 '26 02:09 maxpaulus43

cc @NVIDIA-NeMo/data_designer_maintainers

lipikaramaswamy avatar Sep 30 '26 16:09 lipikaramaswamy

I reproduced this with the parser modules from DataDesigner main at c8aa954be492ddfd68ec853af9b619c6b6423f54. Ordinary JSON text parses successfully; adding <!-- Alice --> reproduces the reported TypeError. No model call is needed.

TextResponseRecipe still parses the response before returning its original text. Would you prefer a focused fix that makes this text recipe pass responses through, or handling non-string lxml tags in the general parser? I can take the agreed scope with regression tests. Should the implementation be tracked in a triaged DataDesigner issue?

ting-hong-shieh avatar Oct 17 '26 22:10 ting-hong-shieh