Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon What techniques does Claude use to identify relevant quotes in long documents
    Claude quote identification long documents prompt engineering XML tags few-shot examples document parsing context-aware responses


What techniques does Claude use to identify relevant quotes in long documents


Here are some key techniques Claude uses to identify relevant quotes in long documents:

1. Placing the longform data at the top of the prompt, above the specific query or instructions, ensures Claude has the full context before attempting to identify relevant quotes[1][2].

2. Structuring the document content and metadata using XML tags like ``, ``, and `` provides clarity on the different sources and types of information Claude is working with[2].

3. Instructing Claude to first quote the most relevant parts of the documents before providing its final answer helps it focus on the pertinent information rather than getting distracted by extraneous details[1][2].

4. Including a few example questions and answers about other sections of the document in a "few-shot" approach can guide Claude to better understand the type of information that is most relevant[1].

5. Positioning the specific query or instructions at the end of the prompt can improve Claude's recall of the key task it needs to perform, like identifying relevant quotes[1][2].

By structuring prompts in this way, developers can help Claude parse long, complex documents, identify the most salient information, and deliver focused, context-aware responses. The extended 200,000 token context window gives Claude powerful capabilities to handle large inputs, but effective prompt engineering is crucial to get the most out of this feature.

Citations:
[1] https://www.anthropic.com/news/prompting-long-context
[2] https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/long-context-tips
[3] https://news.ycombinator.com/item?id=38550675
[4] https://www.linkedin.com/pulse/prompt-engineering-claude-3-muratcan-koylan-uiync
[5] https://www.youtube.com/watch?v=Wtt9tuO8UPY