How to Effectively Use Prompt Engineering to Improve Your Use of Generative AI
An easy-to-implement method to make Generative AI work for you.
Don’t let the title of this article intimidate you. The process to which I’m referring is easy to implement but takes some patience and an upfront investment of time. Once done, however, it makes AI exceptionally more useful in your law practice.
Imagine you are hiring a recent law school graduate to work in your firm. Do you remember how much you needed to be taught before you became an effective attorney? Even with law schools’ emphasis on practical experience, there is a great deal of knowledge that goes into training a new associate. You need to teach the associate the format for pleadings; demonstrate the particular way you like to prepare your answers and motions, and explain the way you want a deposition summarized.
New associates are often tasked with doing legal research. Even then, they need guidance on how to present the research to you. Perhaps you only need a couple of case citations to strengthen your argument in a 12(b)(6) motion to dismiss. No worries -- you just ask for the citations. But perhaps you are drafting an in-depth opinion letter for a major client in an obscure or highly technical area of law. Or you are staring straight in the face of a great deal of discovery material that needs be reviewed and analyzed.
After a year or two, or even just a few months, your associate is trained and produces work that is nearly ready for filing. However, they may expect a higher salary or they leave for another firm. This leaves you with the choice of hiring and training a new associate or bringing in a lateral attorney, starting the training process all over again.
Now, imagine having an associate who keeps improving without leaving or asking for a raise. You train them once, and they instantly understand your preferences, matching your word choice and writing style. That's what I'm talking about in this article.
This is commonly referred to as "prompt engineering" or "prompt crafting."11 It involves carefully designing and refining the inputs (prompts) you give to AI language models (LLMs) to elicit more accurate, relevant, or useful responses. This process is essential for effectively interacting with LLMs, especially in specialized fields like law, where the precision and context of information can significantly impact the utility of the AI's output.
Before we dig in to the “how-to’s” of prompt engineering, note that you can you can purchase pre-crafted prompts. There are some that are specifically geared toward lawyers. You can either purchase them outside the generative AI model that you are using, or you can use the ones that come with the AI model you are using.
When I first started seeing these last year, I was skeptical. I did not think there were be a large enough market for pre-crafted prompts because of how easy and fairly intuitive the process is. I was wrong. There is something to be said for the easy and comfort in using something that another person, or system, or group of people, has already found to be adequate and appropriate for the task at hand. Prompt engineering is fairly easy and intuitive, and I like to have control over the process. However it does take time, patience, and the ability to describe what you want in order to get the best output. With some training and experience you can quickly become proficient at prompt engineering. If you choose to create your own prompts, there are several aspects of prompt engineering to keep in mind.
Key Aspects of Prompt Engineering:
1. Clarity and Specificity: It is important to be clear and specific about what you're asking the AI to do. This helps the model understand the context and the specific kind of information or output you're seeking. While it may be tempting to just start with broad instructions, being more specific and clear will yield the desired responses more quickly.
2. Providing Context: Including relevant background information or specifying the context within your prompt can significantly improve the relevance and accuracy of the AI's responses. Although it may seem counterintuitive to provide context when interacting with an AI, the more context you provide, the better the AI model can provide accurate and refined responses. Adjust your expectations accordingly when working with your electronic assistant.
3. Iterative Refinement: Experiment with different phrasings or structures of your prompt and observe how slight changes can affect the AI's output. This iterative process requires an investment of time but helps identify the most effective ways to communicate your request to the AI.
4. Utilizing Examples: Incorporate examples within your prompt or ask the AI to follow a given example to guide the model in generating the type of content you're looking for. Feed a template for how you want your depositions summarized, or your cases summarized into your AI model. Better yet, submit an actual deposition and a well-done summary, and the AI model will have a much better understanding of how to give you output that matches what you would like.
5. Instructional Prompts: Directly instruct the AI on the format, tone, or structure you want in the response. For instance, you can ask for an outline, specify that you want a professional tone, ask for a more aggressive tone, request a specific word count, or ask for bullet points.
6. Feedback Loops: Use the AI's responses to refine further and adjust your prompts, creating a feedback loop that incrementally improves the quality of interactions. This process is often referred to as “human-in-the-loop training.” The AI model received a great deal of information, training, and fine-tuning before you ever entered the picture. Nowyou get to mold this AI system into your ideal legal assistant.
7. Ask : If you are uncertain how the AI model accepts information or whether it can understand an example, don’t hesitate to ask a follow up question. Remember, this is an interactive process, so adjust your mindset accordingly.
8. Check for Understanding: Ask the AI to explain a term, concept, or task back to you. Check the response and give feedback to adjust the AI’s understanding.
A Practical Example
Let’s go through a practical example to show you what I mean. This is just a very simple example to illustrate the process. Remember, the only limit might be your imagination.
I asked ChatGPT to summarize an Iowa Supreme Court decision:
ME: Hi -- I need to switch gears to talk about a legal case. Could you summarize a court opinion for me?
ChatGPT: Of course, I'd be happy to help with that. Please provide me with the details of the court opinion you need summarized, including any specific aspects or elements of the case you're interested in.
ME: I'm the most interested in the following items:
ChatGPT: It seems like your message might have been cut off. Could you please provide the details of the court opinion you're interested in, including any specific items or aspects of the case you'd like to focus on?
(I like that it prompted me to include the case, which I had not done simply because I pressed “return” too quickly. But I was glad it didn’t just “make something up.”)
ME: (I attached the .pdf of the case)
1) a very brief (two or three sentences) summary of the facts of the case; 2) the standard of review; 3) the legal issues 4) the court's decision
ChatGPT: The case involves chiropractors alleging that Wellmark violated Iowa's Competition Law through agreements with employers, potentially affecting chiropractors' profits. The court reviewed the district court's denial of the plaintiffs' motion for class certification, focusing on whether individual issues predominated over common questions regarding antitrust injury. The Supreme Court of Iowa affirmed the district court's decision, emphasizing the plaintiffs' failure to prove antitrust injury on a classwide basis and applying judicial estoppel to prevent a change in the plaintiffs' theory of liability.
ME: What were the legal issues in the case
ChatGPT: The legal issues in the case centered around allegations of violations of Iowa's Competition Law by Wellmark, focusing on whether Wellmark's agreements with employers constituted anticompetitive practices that harmed chiropractors financially. The case also examined the plaintiffs' ability to prove antitrust injury on a classwide basis, crucial for class certification, and addressed the application of judicial estoppel to the plaintiffs' change in theory of liability.
ME: were there any specific laws that were cited?
ChatGPT: The case specifically cited Iowa's Competition Law as the primary legal framework for assessing the alleged anticompetitive practices. Additionally, principles related to antitrust injury and judicial estoppel were crucial to the court's analysis, although the document does not list specific statute numbers or external antitrust laws by name. These elements were key in determining the legal standing and the appropriateness of class certification for the plaintiffs.
ME: Thank you. Going forward, when I give you a legal case to summarize, would you put it into this format, which I've included below? The words that are in bold I would like you to leave in the document. The words that are in parentheses should be replaced with the actual information from the case I've asked you to summarize. (Name of the case) (Date the case was decided) (Court that decided the case) (Citation of the case)
Facts: (put in a brief summary of the facts of the case)
Legal Issues Involved in the Case: (put in a list of legal issues, specifically putting in any cases or laws cited)
Analysis of the Legal Issues: (summarize what the court said about each issue, including facts that applied to the law, and end with the court’s decision about each specific legal issue)
Court’s Decision: (add a brief conclusion of the overall decision of the court)
ChatGPT: Absolutely, I'll follow this format for summarizing legal cases going forward. If you have any more cases or any other requests, feel free to let me know!
ME: Great! I would also like you to summarize this case, in the format above. IN THE SUPREME COURT OF IOWA No. 22–0684 Submitted November 16, 2023—Filed January 5, 2024 LORRI HAGEN, Appellee, vs. SERTA/NATIONAL BEDDING CO., LLC, AND SAFETY NATIONAL CASUALTY CO., Appellants.
(I pasted in the entire text of this case. Some PDFs cannot be read by ChatGPT.)
ChatGPT:
LORRI HAGEN vs. SERTA/NATIONAL BEDDING CO., LLC, AND SAFETY NATIONAL CASUALTY CO. Date Decided: January 5, 2024 Court: Supreme Court of Iowa Citation: No. 22–0684
Facts: Lorri Hagen, injured at work, filed for workers’ compensation against Serta and its insurer. She failed to meet the evidentiary deadlines for her expert witnesses, leading to their exclusion by the workers' compensation commissioner. The district court reversed this, but the Supreme Court of Iowa reinstated the commissioner's decision, emphasizing the importance of adhering to procedural rules.
Legal Issues Involved in the Case:
Compliance with Iowa Administrative Code rule 876—4.19(3) for timely evidence submission in workers' compensation cases.
Whether the commissioner abused discretion by excluding untimely evidence.
Analysis of the Legal Issues: The Supreme Court of Iowa highlighted the commissioner's discretion in procedural matters, noting the importance of timely evidence submission under Iowa’s workers’ compensation laws. The court found no abuse of discretion in excluding untimely evidence, emphasizing procedural compliance over the merits of the evidence itself.
Court’s Decision: The decision of the court of appeals was vacated, the district court's judgment was reversed, and the case was remanded with instructions to affirm the commissioner's decision to exclude the untimely evidence, underscoring the deference given to procedural rules and the commissioner’s discretion.
ME: Wow--this is great! Thanks!
ChatGPT: You're welcome! If you have any more questions or need further assistance, feel free to ask.
Here I asked a simple question, but you can ask more detailed questions:
ME: Is it easier for you if I attach a case decision in a .pdf document, or if I cut and paste the entire text of the decision?
ChatGPT Both methods work well, but each has its advantages:
Attaching a PDF: This is convenient for longer decisions or when the formatting of the original document is important. It allows me to access the entire document in its original format, which can be particularly helpful for legal cases where detail and context matter.
Cutting and Pasting Text: This method is quicker for shorter texts or when you need a specific section analyzed or summarized. It allows for a more immediate response since it removes the step of opening and navigating through a PDF.
Ultimately, the best method depends on the length of the text and what you find easier. For detailed legal documents, PDFs are often better to preserve the original formatting and context. For more straightforward questions or shorter texts, pasting the text directly can be faster and more efficient.
In order to check on how it was summarizing cases, I asked ChatGPT to summarize a case that any 1L should recognize.
ME: Great -- makes sense. Here is the next case I would like you to summarize.
ChatGPT: MAPP v. OHIO Date Decided: June 19, 1961 Court: Supreme Court of the United States Citation: 367 U.S. 643
Facts: Dollree Mapp was convicted for possessing obscene materials found during an unlawful search of her home, despite doubts about the search warrant's existence. The Ohio Supreme Court upheld the conviction, stating evidence obtained unlawfully was admissible under Ohio law.
Legal Issues Involved in the Case:
The constitutionality of using evidence obtained from an unlawful search and seizure in state criminal prosecutions.
The applicability of the Fourth Amendment's protection against unreasonable searches and seizures at the state level through the Fourteenth Amendment.
Analysis of the Legal Issues: The Supreme Court overruled its prior decision in Wolf v. Colorado, holding that evidence obtained in violation of the Fourth Amendment is inadmissible in state courts, establishing the exclusionary rule as a constitutional right enforceable at both federal and state levels.
Court’s Decision: The judgment of the Ohio Supreme Court was reversed, and the case remanded. The Court established that the exclusionary rule, which prohibits the use of evidence obtained through unconstitutional searches and seizures, applies to state courts to ensure due process under the Fourteenth Amendment.
Yes, it used the format I gave it! But the summary wasn’t ideal, so I asked a follow up question:
ME: That analysis of legal issues seems very short. Could you please expand on that?
ChatGPT: In Mapp v. Ohio, the Supreme Court extensively deliberated on the fundamental principles underpinning the Fourth Amendment's protection against unreasonable searches and seizures, and the necessity of applying these principles universally across federal and state levels to safeguard individual rights. The Court emphasized that without the exclusionary rule's application in state courts, the constitutional guarantee against unreasonable searches and seizures would be essentially meaningless, as it would permit state and local authorities to disregard these protections. This decision marked a pivotal shift, ensuring that all evidence obtained in violation of the Fourth Amendment could not be used in any court in the United States, thereby reinforcing the principle that the Constitution protects individuals from overreach by all levels of government.
ME: If I give you my summary of Mapp v. Ohio, can you pattern your case summaries after it?
ChatGPT: Absolutely, I'd be glad to adapt my summaries to match the style and detail level you prefer. Please share your summary of Mapp v. Ohio, and I'll use that as a template for future case summaries.
ME: Excellent! Earlier, I gave you the text of the U.S. Supreme Court's decision in Mapp v. Ohio, and you provided a summary for me, in the format I had requested. I am attaching a summary of Mapp v. Ohio. Going forward, I would like your summaries of legal cases to match this style and level of detail, in the format I provided.
ChatGPT: Error reading documents
It appears there was an issue with accessing the detailed summary you provided for Mapp v. Ohio. Without being able to view the content of the document you mentioned, I can't directly pattern future summaries after it. However, if you can share key elements or specific aspects of the summary format you prefer based on your summary of Mapp v. Ohio—such as the level of detail, specific headings, or any unique structuring—I can certainly aim to match that style in future case summaries. Feel free to describe or list those preferences here!
ME: Here is the document reviewing the Mapp v. Ohio case. Mapp v. Ohio 37 U.S. 643 (1961)
And then I included a summary in the same format as I had instructed it to use earlier.2
ChatGPT: Thank you for providing your detailed summary. Going forward, I will use this structure and level of detail as a template for summarizing legal cases. If there's anything else you need or another case you'd like summarized, just let me know!
This next case is a test to see how well ChatGPT would pattern a case summary after the summary I had given it for Mapp v. Ohio. I again used a well-known 1L-friendly case:
ME: Great, thanks! I would like you to please summarize Griswold v. Connecticut. It is attached.
ChatGPT
Griswold v. Connecticut 381 U.S. 479 (1965)
Facts: Estelle Griswold, executive director of the Planned Parenthood League of Connecticut, and Dr. C. Lee Buxton were convicted under a Connecticut law criminalizing the provision of contraceptive advice and devices to married couples. They challenged their convictions, arguing the statute was unconstitutional.
Legal Issues Involved in the Case:
Whether the Connecticut statute infringing on the privacy of married couples to use contraceptives violates the Constitution.
The applicability of the right to privacy within marital relations under the Constitution.
Analysis of the Legal Issues: The Supreme Court held that the Connecticut statute was unconstitutional, as it violated the right to marital privacy. The Court found this right within the "penumbras" and "emanations" of other constitutional protections, specifically within the Bill of Rights, thereby establishing a basis for privacy rights in marital relations.
Court’s Decision: The Court reversed the convictions of Griswold and Buxton, establishing the principle that the Constitution protects the privacy of marital relations from state restrictions, laying the groundwork for later cases expanding privacy rights, including Roe v. Wade.
It Takes Some Time
This was a very brief example to give you an idea of how to make set up your prompts in order to get the results that you want. The more you give examples, suggestions and feedback to ChatGPT or other generative AI models, the better your results will be.
By now, you should have an understanding of prompt engineering and how it can improve your interactions with AI systems. With this knowledge, you're ready to start training your own preferred AI system. Prompt engineering is a skill that develops over time as you gain experience with how AI models interpret and respond to different types of input. This skill is particularly valuable in professional settings like legal research, where the accuracy and relevance of information are paramount. By mastering prompt engineering, you can unlock the full potential of AI tools, enhancing their efficiency and effectiveness in various tasks. Just remember to continuously verify that the information you receive aligns with your expectations and routinely spot-check to ensure accuracy.
It is also referred to as “human-in-the-loop training” or “interactive learning.” I prefer prompt engineering. Probably because it is the closest I will ever come to being an engineer.
I omitted my summary in this Article for the sake of reader convenience. If you would like to see the summary that I gave ChatGPT, and compare it to what ChatGPT gave me back, you can see my summary here.