2.1.2. Classification

LLMs are good at performing classification tasks, assigning a class or category to text. You provide the AI model with a list of categories to choose from (or the model can generate its own categories) and the content you want analyzed. Text classification serves various applications, including fraud detection, sentiment analysis, and content monitoring, among others, thereby proving to be advantageous for legal professionals.

Example: Personal Injury Cases

We work with several firms specializing in personal injury which spend countless hours producing medical chronology reports and medical summaries. Let's imagine we want craft a prompt that is able to identify a client's diagnosis from the discharge notes found within a client's health records from their visit to the ER following the accident. This is a pretty simple classification problem. Let's see how we might be able to achieve this with the following prompt template:

Prompt:



Summary: Mr. Doe presented in the ER following a rear-end collision while he was 
stationary at a red light. He reports immediate onset of neck pain and stiffness, 
worsening  over the subsequent hours. Physical examination showed a decreased range 
of motion in the neck.
Diagnosis: Whiplash

Summary: Mr. White presented to the clinic several months following a violent mugging. 
He reports recurring nightmares, flashbacks, and increased anxiety, especially 
in crowded places. Psychiatric evaluation confirmed the diagnosis. 
Diagnosis: Post-traumatic stress disorder.

Summary Ms. Smith was brought into the ER after falling off a ladder at home. 
She reports headache, confusion, and some memory loss regarding the incident. 
Neurological examination revealed mild disorientation.
Diagnosis:

You can see that we've used what we learned earlier in this guide to create a prompt that has three different sections. We start our prompt by including an instruction – identify the patient's diagnosis. We then embed two examples demonstrating the type of medical summary the AI model can expect. The last section is our input, which consists of the medical summary and the output delimiter – "Diagnosis." Inputting this prompt into ChatGPT correctly returns the result: "Concussion" as been seen here.

Last updated