QuestionQ109

Context Management & Reliability

You are developing a structured data-extraction system with Claude. The system pulls information from unstructured documents, validates its output with JavaScript Object Notation (JSON) schemas, and preserves high accuracy. It must gracefully manage edge cases and integrate with downstream systems.

Your extraction system uses tool_use with a JSON schema that has 12 fields and detailed descriptions, totaling about 2,500 tokens for the full tool definition. Processing documents below 150K tokens achieves 98% accuracy. For documents from 175–190K tokens, accuracy falls to 71%, and information in the final third is consistently missed. The model has a 200K-token context window.

What is the most likely cause?

Explanation

Tool definitions—including names, descriptions, and schemas—are input tokens, and Claude also adds tool-use system-prompt tokens. Those tokens, together with system instructions, document content, and generated output, consume the model’s finite context capacity. A long document can therefore approach the 200K-token limit even when its document tokens alone appear below that threshold, making late-document information disproportionately likely to be lost or truncated.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!