Transformers troubleshooting
Resolve common tokenization, memory, and inference issues with biomedical NLP models.
transformerstroubleshooting
Common issues and fixes
The Transformers tool uses Hugging Face models for biomedical NLP. Understanding common issues helps you prepare text inputs correctly and interpret extraction results appropriately.
Text truncation or missing entities at document edges
- Input text longer than 512 tokens is automatically chunked with 50-token overlap. Entities spanning a chunk boundary may be missed or partially extracted.
- If critical entities are near the end of a long document, try submitting the relevant paragraph separately.
- For very long documents, split manually at sentence boundaries to ensure clean chunking.
Low entity recall (missing known entities)
- There is no
confidence_thresholdparameter to lower — the pipeline returns whatever the model scores. Try a differentmodel_nameinstead (microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract-fulltextfor PubMed abstracts,seyonec/ChemBERTa-zinc-base-v1for chemical text). - Abbreviations defined only once in a document may not be recognized in subsequent mentions if the definition is in a different chunk.
- Novel entities (newly published gene names, investigational drug names) may not be in the model's training vocabulary.
High false positive rate (too many spurious entities)
- There is no confidence or entity-type filter to apply on the platform side — post-filter the returned entity list in your own code by score or type.
- Check that the input text is biomedical in nature; non-scientific text produces unreliable results.
- Common English words that happen to be gene names (e.g., "WAS", "IMPACT", "LARGE") may be falsely extracted as Gene entities.
Entity type misclassification
- Gene/protein ambiguity is common (e.g., "EGFR" can be classified as Gene or Protein depending on context). This is a known limitation of NER models.
- Drug vs. Chemical distinction can be blurred for molecules used in both therapeutic and research contexts.
- If entity types are critical for your analysis, consider post-processing with a normalization step that maps entities to standardized databases (UniProt for genes, PubChem for chemicals).
There is no relation-extraction task
task accepts embeddings, ner, classification, qa, summarization, or zero_shot only — there is no relation_extraction value. Infer relationships from entities that co-occur in the same ner result, or ask a targeted question with qa (e.g., "does this text say gefitinib inhibits EGFR?").
Memory errors on large batches
- Reduce the number of documents per batch. For BERT-sized models, batches of 32 documents work well; for BioGPT (1.5B parameters), reduce to 8-16.
- Long documents consume more memory per batch element. If documents are consistently long, reduce batch size further.
Slow processing times
- BioGPT (1.5B parameters) is significantly slower than BERT-based models (110M parameters). Use BERT-based models for throughput-sensitive tasks.
- Batch processing is more efficient than sequential single-document submissions.
- Check cluster capacity and retry during lower-traffic periods if queue times are long.
Encoding or character errors
- Ensure input text is UTF-8 encoded. Non-ASCII characters (Greek letters, special symbols) are generally handled but may affect tokenization.
- HTML entities (e.g.,
&,<) should be decoded before submission. - Remove embedded images, tables, or formatting markup from text before processing.
Still stuck?
- Provide the job ID, model name, task type, and any error messages.
- Include the approximate length of the input text and the number of documents.
- Note whether the issue is with entity extraction quality, processing speed, or system errors.
- Share a small excerpt of problematic text for reproducing the issue.
Read next
Was this page helpful?