Using text embedding models as text classifiers with medical data
Rishabh Goel
TL;DR
The paper addresses the need for accurate medical text classification without training large medical LLMs. It evaluates a pipeline that uses text embeddings and a vector database as a knowledge base to classify clinician notes, with ground-truth vectors generated by LLMs and queries produced by multiple LLMs. Across 8 ailments and 18 robustness permutations, higher embedding dimensionality and richer knowledge generally improve classification, achieving macro F1 scores up to 0.96 when queries are concise and knowledge is detailed; however, ground-truth quality and the choice of LLMs significantly impact results. The work demonstrates a cost-effective, scalable approach for medical text classification that could support clinicians without deploying new large-domain models, while highlighting factors that influence performance and avenues for scaling and validation ($3 \times 2 \times 3 = 18$ permutations).
Abstract
The advent of Large Language Models (LLMs) is promising and LLMs have been applied to numerous fields. However, it is not trivial to implement LLMs in the medical field, due to the high standards for precision and accuracy. Currently, the diagnosis of medical ailments must be done by hand, as it is costly to build a sufficiently broad LLM that can diagnose a wide range of diseases. Here, we explore the use of vector databases and embedding models as a means of encoding and classifying text with medical text data without the need to train a new model altogether. We used various LLMs to generate the medical data, then encoded the data with a text embedding model and stored it in a vector database. We hypothesized that higher embedding dimensions coupled with descriptive data in the vector database would lead to better classifications and designed a robustness test to test our hypothesis. By using vector databases and text embedding models to classify a clinician's notes on a patient presenting with a certain ailment, we showed that these tools can be successful at classifying medical text data. We found that a higher embedding dimension did indeed yield better results, however, querying with simple data in the database was optimal for performance. We have shown in this study the applicability of text embedding models and vector databases on a small scale, and our work lays the groundwork for applying these tools on a larger scale.
