Apply to my task
arXiv:2507.05517 ★ 77 Jul 7, 2025

Schema + examples: how to pull structure out of any text with no wasted words

Key result

One good example in a prompt works better than a paragraph of instructions, and that's not an opinion but a documented fact from clinical systems where mistakes are costly. The method lets you extract precise structured data (JSON, a table) from any unstructured text: conversation transcripts, emails, reviews, meetings. The trick: instead of explaining to the model what to look for, show it what a correct answer should look like. The model stops “thinking” and starts following the pattern, and extraction accuracy jumps.

Empowering Healthcare Practitioners withLanguageModels: Structuring Speech Transcripts in Two Real-World Clinical Applications

Key Aspects of the Research:

The paper shows how to use large language models (LLMs) to automatically extract structured information (for example, to fill in tables) from unstructured text: transcripts of what doctors and nurses dictate. The authors demonstrate that LLMs can successfully pull out clinical observations and medical orders, cutting the time spent on routine documentation significantly.

Key Result: giving the model a clear output structure (a schema) plus a few examples (few-shot) dramatically improves data extraction accuracy.


The Core of the Method, Explained:

The idea is to make the LLM work not as a conversation partner but as a precise data processor that fills in a predefined form. Instead of asking the model to “find something in the text,” you give it clear instructions on what the result should look like and show it how to do it with examples.

For the user, the technique comes down to four steps:

  1. Define the structure (Schema): Decide exactly what data you want to extract and come up with field names for it. For example, if you're analyzing reviews, the fields might be product_name, sentiment (positive/negative) and key_issue.
  2. Set the output format: State clearly in the prompt that the answer must be in a strictly defined format, such as JSON. That's the most reliable way to get machine-readable output.
  3. Provide examples (Few-Shot Learning): This is the most important step. Show the model 1-2 examples where you take a snippet of text (similar to what you'll be analyzing) and pair it with the ideal JSON answer it should produce. The model “learns” from these examples right inside the prompt.
  4. State the task: After the instructions and examples, feed in your new text and ask the model to process it according to the template.

For very long texts, the paper suggests an extra step: first ask the model to split the text into logical blocks of meaning (segments), then apply the main method to each block separately.


Practical Applicability Analysis:

  • Direct applicability: Completely direct. You can take the prompt structure from the paper (especially from Appendix A.1), swap the medical schema and examples for your own and get a working solution right away. For instance, to extract contacts from emails, order details from correspondence or key requirements from a job posting.

  • Conceptual value: Huge. The paper clearly proves several key ideas:

    • An LLM isn't a “black box” but a system you can and should steer.
    • Structure in produces structure out. A clearly defined request format (a JSON schema) is the key to a clear answer.
    • Examples beat long instructions. One good example (few-shot) often works better than a paragraph describing what needs to be done.
    • Models can slip up on basics (for example, generating invalid JSON), and you need to be ready for that.
  • Adaptation potential: Very high. The adaptation is simple:

    1. Define your task (for example, “analyzing hotel reviews”).
    2. Create your own JSON schema: {"feature": "room cleanliness", "sentiment": "negative", "quote": "there was dust in the corners"}.
    3. Find 1-2 typical reviews and write reference JSON answers for them by hand.
    4. Assemble the prompt using the paper's template, plugging in your schema and examples. Done.

A Practical Example:

You are an experienced marketing analyst who specializes in analyzing customer reviews. Your task is to extract structured information from written reviews of home appliances.

You must return your answer STRICTLY as a JSON array. Each object in the array represents one mention of a specific product aspect in the review.

Each JSON object must contain the following fields:
- `feature`: the product aspect being discussed (for example, "noise level", "build quality", "design", "battery life").
- `sentiment`: the customer's assessment of that aspect. Allowed values: "positive", "negative", "neutral".
- `summary`: a short summary of the customer's opinion on that aspect in 1-5 words.

---
**EXAMPLE 1:**

**Review text:** "Bought the new BlendPro-3000 blender. It looks gorgeous, very stylish, great in the kitchen. But it's as loud as a jet taking off, you can't make a smoothie in the morning without waking everyone up. On the bright side, it's easy to clean."

**JSON:**
json

[ { "feature": "design", "sentiment": "positive", "summary": "Stylish, looks great" }, { "feature": "noise level", "sentiment": "negative", "summary": "Very loud" }, { "feature": "ease of cleaning", "sentiment": "positive", "summary": "Easy to clean" } ]

---
**EXAMPLE 2:**

**Review text:** "The Dyson V12 vacuum is a beast! More than enough power, picks up all the cat hair. The battery lasts for the whole apartment, runs about 40 minutes. The price stings, sure, but it's worth it."

**JSON:**
```json
[
  {
    "feature": "suction power",
    "sentiment": "positive",
    "summary": "Very powerful, picks up hair"
  },
  {
    "feature": "battery life",
    "sentiment": "positive",
    "summary": "Lasts 40 minutes"
  },
  {
    "feature": "price",
    "sentiment": "negative",
    "summary": "High price"
  }
]

NOW ANALYZE THE FOLLOWING REVIEW:

Review text: "The DeLonghi espresso machine was a letdown. The coffee comes out barely warm, and the milk frother broke after a week. The only plus is the compact size; it fit in my small kitchen with no trouble."

JSON:



# 5.2 Why It Works:
This prompt is effective thanks to a combination of techniques described in the paper:

1.  **Setting the role and context:** The phrase "You are an experienced marketing analyst" tunes the model in and activates knowledge related to analyzing customer opinion.
2.  **A clear format spec (JSON Schema):** The instruction to "return your answer STRICTLY as a JSON array" and the detailed field descriptions (`feature`, `sentiment`, `summary`) leave the model no room for "creativity". It has to follow the given structure, which ensures a predictable, machine-readable result.
3.  **Learning from examples (Few-Shot Learning):** The two examples are the key element. They show the model not only JSON syntax but the meaning of the task: how to extract the structured essence (`"feature": "noise level", "sentiment": "negative"`) from informal text ("as loud as a jet"). The model learns to generalize and apply this pattern to new text.

---
# 6.1 Another Practical Example
<div class="example-block markdown-block">
<button class="copy-btn">Copy</button>
<pre><code class="language-markdown">You are an executive assistant, and your job is to prepare short summaries of work meetings based on their transcripts.

You need to extract the key information and present it as a strict JSON object with the following fields:
- `main_topic`: the main topic of the meeting in 2-4 words.
- `key_decisions`: an array of strings, where each string is one decision that was made.
- `action_items`: an array of objects, where each object describes a specific task and contains the fields `task` (task description) and `responsible` (name of the owner).
- `deadline`: the overall date or deadline, if one was mentioned for the key tasks. Use the format "YYYY-MM-DD" or "N/A".

---
**EXAMPLE:**

**Transcript text:** "Team, today we're discussing the launch of the new 'Pro' plan. Marketing is ready, but engineering says they need more time for testing. Here's the plan: Mike, your team needs to finish testing by the end of next week. Emma, please put together the email announcement. Decided: we launch the plan on October 25. Thanks, everyone."

**JSON:**</code></pre>
</div>json
{
  "main_topic": "Launch of the 'Pro' plan",
  "key_decisions": [
    "The launch date for the new 'Pro' plan is set for October 25"
  ],
  "action_items": [
    {
      "task": "Finish testing the new plan",
      "responsible": "Mike"
    },
    {
      "task": "Prepare the email announcement",
      "responsible": "Emma"
    }
  ],
  "deadline": "2024-10-25"
}

NOW ANALYZE THE FOLLOWING TRANSCRIPT:

Transcript text: "Okay, on the quarterly report. The sales numbers look good, but support is slipping. Tom, we need to hire two more people for the support team by December 1. Rachel, please analyze the main reasons people contacted us over the past month. We agreed that next quarter's focus is improving service quality."

JSON:


```

Why This Example Works.

This example runs on the same fundamental principles as the previous one, which shows how universal the paper's method is:

  1. Contextualization through role: The “executive assistant” role helps the model grasp the practical goal of the task: extract the most important business information and cut the fluff.
  2. A complex nested structure: This example uses a more complex JSON schema with nested objects and arrays (action_items). The example shows the model how to build this complex structure correctly, something that would be very hard to explain in words alone.
  3. Recognizing entities and relationships: The example teaches the model not just to find keywords but to recognize entities (“Tom,” “Rachel”) and their connection to actions (“hire specialists,” “analyze the reasons”). That's a key aspect of information extraction, and a few-shot example conveys it effectively.

Usefulness Score: 85

02

Main Evaluation Criteria

  • A. Relevance to prompting techniques: Yes, the paper directly demonstrates how effective prompts with a clear structure and examples (few-shot) are. The appendix includes prompt templates.
  • B. Better conversational answers: Yes, the paper shows a significant improvement (higher F1-score) in structured data extraction accuracy with few-shot prompting compared with zero-shot.
  • C. Direct practical applicability: Yes, users can immediately apply the methodology (define an output schema + provide examples) to their own data extraction tasks, with no code at all.
  • D. Conceptual value: Very high. The paper clearly illustrates that an LLM isn't just a “conversation partner” but a powerful tool for structuring unformatted data. It explains why providing a clear “target structure” (a schema) and examples dramatically improves results.
  • E. New useful practice (clustering): The work falls into several key clusters at once:
    • 1. Prompt-writing techniques: Few-shot prompting is used heavily and its effectiveness is measured.
    • 3. Prompt structure optimization: The whole work is about building structured prompts to get structured output (JSON).
    • 5. Extraction and structuring: This is the core of the paper.
    • 6. Context and memory: The “lost-in-the-middle” problem is mentioned, with text segmentation proposed as the fix.
  • Practicality checklist: Provides ready-made constructions (+15 points).
03

Numerical Usefulness Score

The score of 85 reflects the fact that the paper is a near-perfect guide to one of the most useful prompt engineering techniques: structured data extraction.

Arguments FOR: 1. A universal methodology: Although the domain is highly specialized (medicine), the approach described (role + task + output schema + examples) is completely universal and applies to any data extraction task, from analyzing customer reviews to parsing resumes. 2. Concrete evidence: The paper doesn't just claim; it shows clearly (in metric tables) how much adding just 1-2 examples to the prompt (few-shot) outperforms the no-example approach (zero-shot). That's a powerful argument for always trying to include examples. 3. Practical tips: The paper mentions real problems users run into, such as JSON parsing errors and handling long texts (segmentation is proposed), which keeps its findings grounded and useful.

Counterarguments (why not 95+): 1. Adaptation required: Users have to mentally “translate” the examples from the medical field into their own. That takes a little effort, unlike papers whose examples are already framed as general business tasks. 2. Focus on comparing models: Part of the paper compares different LLMs (GPT-4o, Phi-3.5 and so on), which is less interesting to an ordinary user who usually works with whatever one model is available to them.

All in all, this is an extremely useful paper that teaches a fundamental and powerful prompting method. It gives you not just a “trick” but a whole methodology that will immediately raise the quality of your results on data extraction tasks.


Research digest

Key result

One good example in a prompt works better than a paragraph of instructions, and that's not an opinion but a documented fact from clinical systems where mistakes are costly. The method lets you extract precise structured data (JSON, a table) from any unstructured text: conversation transcripts, emails, reviews, meetings. The trick: instead of explaining to the model what to look for, show it what a correct answer should look like. The model stops “thinking” and starts following the pattern, and extraction accuracy jumps.

Principle

The standard approach: write a long assignment, get whatever comes out. The approach that works: provide a JSON schema plus 1-2 “text → finished JSON” examples, and the model becomes a predictable data processor. Here's the principle: first define the schema fields (exactly what needs to be extracted), then show a filled-in schema for a similar text, then hand over the new text. The model doesn't improvise; it copies the structure. For long texts, add a step zero: first split the text into blocks of meaning, then apply the method to each block separately.

Why it works

Models are good at recognizing patterns and generalizing. When you give one an example of “here's messy text, here's clean JSON,” it doesn't memorize facts. It picks out the structure of the task and applies it to new text. The key point: one labeled example conveys more information than five sentences of description, because the example shows the syntax, the meaning and the right level of detail all at once. Without an example, the model guesses what the user meant. With one, it simply repeats the logic.

When to apply

Anywhere you have unstructured text and need a table or database as output. Specifically: analyzing reviews (product → sentiment → quote), meeting transcripts (decisions → tasks → owners), incoming emails (request type → urgency → contact), resumes (skills → experience → salary expectations). It works especially well when the text is lively and informal: spoken language, dictation, chat threads. NOT a fit if the text is so short and simple that a plain request will do; the overhead of a schema won't pay off.

Mini recipe

1. Define the fields: Decide exactly what you need to extract. Write down the field names, for example `topic`, `sentiment`, `key_quote`. The more specific the names, the more precise the result. 2. Set the format firmly: Tell the model the answer must be strictly in JSON. Not “try to return JSON,” but “return your answer STRICTLY as a JSON array.” 3. Make 1-2 examples by hand: Take a chunk of similar text. Fill in the JSON according to your schema yourself. This is the most important step: these examples are what will “train” the model right inside the prompt. 4. Assemble the prompt in order: The model's role → schema description → Example 1 (text + JSON) → Example 2 (optional) → the new text to process. 5. For long texts: First, in a separate request, ask the model to split the text into blocks of meaning. Then apply the schema to each block separately.

Examples

[BAD]: `Find mentions of products in this text and write what customers think of them` [GOOD]: `You are a review analyst. Extract the data STRICTLY as a JSON array. Each object contains the fields: product (product name), sentiment (positive/negative/neutral), summary (the opinion in 3-5 words). EXAMPLE: Text: “The Sony headphones are great, but charging takes forever, you wait two hours.” JSON: [{"product": "Sony headphones", "sentiment": "positive", "summary": "good sound quality"}, {"product": "Sony headphone charging", "sentiment": "negative", "summary": "slow to charge"}] NOW PROCESS: Text: [your text]`

In plain words

Here's the gist: modern language models aren't just chatbots; they're powerful engines for structuring chaos. In medicine or business, tons of useful information drowns in call transcripts and rambling, but an LLM can fish hard facts out of that mess. It doesn't work off keywords; it uses semantic extraction: it understands that the phrase "as loud as a jet" isn't about aviation but is a negative review of the product's noise. In effect, we turn a stream of consciousness into a machine-readable database where everything is neatly sorted.

It's like bringing a professional court stenographer to a loud party, someone who, amid the shouting, music and toasts, manages to write down only the actual agreements. While everyone else hears noise, they're noting who owes whom and how much. On the surface it's a circus, but you walk away with a clear to-do list. The model cuts the extras and keeps only a structured skeleton you can rely on at work.

For this magic to work, you need three levers: a firm role, a strict format and reference examples. First we put an expert mask on the model so it stops showing off and works in context. Then we rein it in by demanding a JSON array: handcuffs that keep the AI from launching into long-winded musings. And most important of all, Few-Shot Learning: we give a couple of "before and after" examples. Once it sees a junk phrase turn into a clean tag, the model instantly picks up the pattern and starts stamping out results without errors.

The research was done on medical data, but this universal pattern applies anywhere there's text. Customer complaints, Zoom stand-ups or deposition transcripts: the principle is the same. You take unstructured junk and run it through a sieve of role and examples. GEO and SEO take a back seat when direct meaning extraction enters the game. It's the foundation for any automated analysis, saving hundreds of hours of manual post-mortems.

Bottom line: stop asking the model to "just retell" a text; make it turn the text into data. Use strict schemas and examples so you get a ready-made report instead of an essay on the topic. If you don't learn to structure the model's output now, you'll keep drowning in endless walls of text while competitors pull pure value out of them. Whoever owns the structure owns the process; everyone else is just burning tokens.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on Schema + examples: how to pull structure out of any text with no wasted words arXiv:2507.05517

Sign in to apply this study New accounts get 50 free credits.

Get the week’s best papers by email

One email on Sundays with the highest-rated new techniques. Unsubscribe with one click.