I am using the below prompt to compare two names obtained from two different sources,…
- User
I am using the below prompt to compare two names obtained from two different sources, using an LLM. I need your help to optimize this prompt. It is generating too many false positives and too many false negatives.
You are a comparison tool. You only output JSON object. Plain English output will cause errors downstream. Use logical processing and direct matching without inference or interpretation beyond the data provided. Follow those rules. You will be provided with two names, each obtained from a different source. The names will be in the format [firstname] [middlename] [lastname], where the middle name is optional. Your task is to compare the first name, middle name, and last name of the two inputs and score them based on whether they are a match or a mismatch. For the first name comparison: If the first names are an exact match or if one name is a common nickname of the other (e.g., Will for William), assign a score of 1. If the first names do not match or are not recognized nicknames, assign a score of 0. No partial scores For the middle name comparison: If the middle names are an exact match, assign a score of 1. If the middle names do not match or if either name does not have a middle name, assign a score of 0. No partial scores For the last name comparison. If the last names are an exact match, assign a score of 1. If the last names do not match, assign a score of 0. No partial scores. Output: If comparison scores for ALL components (first name, middle name, and last name) are 1, then set "RESULT" to "MATCH". If the comparison score for any one component is 0, then set "RESULT" to "MISMATCH". In the "REASON" field, provide a brief explanation of the match or mismatch. You must format your output as a JSON value that adheres to a given "JSON Schema" instance. "JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match exactly. The JSON output that you generate will have two aspects, "RESULT" which can have values "MATCH" or "MISMATCH", and second "REASON", where you can print any additional text. Are the following objects a match? Value 1: {application_value} Value 2: {credit_report_value} Output:
- Assistant
- User
The model is still not very accurate. Can you do something to improve the accuracy of the model please?
- Assistant
- User
The problem is that, the model is checking for matches step by step, and if it sees that the first name is a match, it kind of avoids checking the middle name and last name in the comparison, and just says whether it is a match or not. I want to make sure that the model tests all the components of the name when generating the output and I do not want it to ignore anything.
- Assistant
- User
Below is the prompt I am using to compare names obtained from two sources. The model produces a few false positives and false negatives. Can you improve the prompt to improve these?
You are a comparison tool. You only output JSON object. Plain English output will cause errors downstream. Use logical processing and direct matching without inference or interpretation beyond the data provided. Follow those rules. Name: When comparing all names, stay case insensitive. Assume that any null values in the dataset are not relevant to the analysis. Please provide insights without considering any missing data. Compare the name components as follows: First Name: Score 1 for a match while accounting for common nicknames and initials, else score 0. No partial scores. Middle Name: Compare the initials (first character) to determine if the middle names match. Ignore periods and other elements. If both names have a middle initial, score 1 if they match, else score 0. If only one name has a middle initial, consider it a match (score 1). No partial scores. Last Name: Score 1 for an exact match, else score 0. No partial scores. In any of the comparisons, do no account for letter cases or any periods or other syntax. Only compare the letters of each name. Input Format: The names will be provided in the format "First [Middle] Last", where each part is separated by a space. Middle name is optional. Output: If comparison scores for ALL components (first name, middle name, and last name) are 1, then set "RESULT" to "MATCH". If the comparison score for any one component is 0, then set "RESULT" to "MISMATCH". In the "REASON" field, provide a brief explanation of the match or mismatch. You must format your output as a JSON value that adheres to a given "JSON Schema" instance. "JSON Schema" is a declarative language that allows you to annotate and validate JSON documents. Your output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match exactly. The JSON output that you generate will have two aspects, "RESULT" which can have values "MATCH" or "MISMATCH", and second "REASON", where you can print any additional text. Are the following objects a match? Value 1: {application_value} Value 2: {credit_report_value} Output:
- Assistant
- User
I want to introduce one more condition when calculating the match or mismatch score. When defining the input format for the model, I would also like to specify that, if the input name has 3 fields, they are [first name] [middle name] [last name]. However, if the name input only has 2 fields, then the name fields are [first name] [last name]. If middle name is missing in any of the two inputs, then do not factor in middle name during the comparison.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.