Sarvam AI

Introducing Sarvam Extract

Introducing Sarvam Extract
·11 min read

Today we are introducing Sarvam Extract, our API for extracting structured data from documents. On ExtractBench, a public document extraction benchmark, Extract sits on the accuracy-cost Pareto frontier, delivering the highest accuracy for the cost among the evaluated systems.

Extract is available in two modes, Basic and Advanced. Basic extracts fields from individual pages, while Advanced adds a second pass over the full document to recheck values where the two readings disagree. Both modes support documents of up to 500 pages and return structured JSON with a source page, bounding box and confidence score for each value.

  • Accuracy: Sarvam Extract's Advanced mode scores 95.4 out of 100 on ExtractBench at ₹2.50 per page ($25 per 1,000 pages), while its Basic mode scores 94.4 at ₹1 per page ($10 per 1,000 pages). Both sit on the accuracy-cost Pareto frontier, delivering accuracy on par with evaluated systems at a lower cost.
  • Long documents: Extract supports documents of up to 500 pages. On test documents longer than 50 pages, it scores 93 out of 100, compared with 28 for Gemini 3.8 Flash single call.
  • Tables and lists: On benchmark documents with lists of 100 or more rows, Extract Advanced returns about 98% of all rows. When we send the whole document to Gemini 3.8 Flash in a single API call, it returns only about 10% of the rows.
  • Page-first design: Extract identifies the relevant page for each field before extraction, reducing the context required and allowing a smaller model to achieve high accuracy. On documents over 50 pages, Extract Advanced scores 64.6 points higher than sending the whole document to Gemini 3.8 Flash in one call.
  • Source grounding: Every extracted value comes with a confidence score and a reference to where it appears in the document, including the page number and bounding box. When Extract correctly reads a field containing a single value, it also cites the correct page in 98% of cases.
  • Languages and deployment: Extract, powered by our latest model Sarvam Vision 2.1, supports English and 22 Indian languages, preserving values in their original scripts. It is available to users in India and the US, with on-premises deployment for enterprises. Only successfully processed pages are billed.

Performance: Accuracy and cost

ExtractBench score against price per page

Sarvam ExtractOther systemsFrontier of the other systems
Up and to the left is better. The grey line is the frontier of the other systems: none of them is both cheaper and higher scoring than a point on it. Gemini setups run Gemini 3.8 Flash; OCR is Google Document AI. Scores and prices come from the ExtractBench leaderboard of 6 November 2026 and our own runs, with dollar prices converted at ₹95. Off the chart: DeepSeek V4.1 Flash, 87.1 at ₹0.30 per page, and LlamaExtract Agentic Plus (Max Effort), 96.2 at ₹18.20 per page.

ExtractBench score against price per page. Sarvam Extract Basic: 94.4 at ₹1.00 per page. Sarvam Extract Advanced: 95.4 at ₹2.50 per page. LlamaExtract Cost-Effective: 94.2 at ₹1.12 per page. LlamaExtract Agentic: 95.7 at ₹2.96 per page. Reducto Deep Extract: 96.1 at ₹6.03 per page. LlamaExtract Agentic Plus: 96.2 at ₹7.12 per page. Pulse (Effort): 96.1 at ₹9.97 per page. Codex (GPT-6.1 Sol): 95.3 at ₹6.77 per page. Codex (GPT-6 Luna): 91.0 at ₹1.14 per page. Gemini 3.8 Flash, page by page: 89.9 at ₹1.67 per page. Gemini 3.8 Flash, one call: 86.6 at ₹0.78 per page. Google OCR + Gemini: 85.6 at ₹0.96 per page. Datalab: 85.7 at ₹3.33 per page.

ExtractBench score against price per page
SystemExtractBench scorePrice per page (₹)
Sarvam Extract Basic94.41.00
Sarvam Extract Advanced95.42.50
LlamaExtract Cost-Effective94.21.12
LlamaExtract Agentic95.72.96
Reducto Deep Extract96.16.03
LlamaExtract Agentic Plus96.27.12
Pulse (Effort)96.19.97
Codex (GPT-6.1 Sol)95.36.77
Codex (GPT-6 Luna)91.01.14
Gemini 3.8 Flash, page by page89.91.67
Gemini 3.8 Flash, one call86.60.78
Google OCR + Gemini85.60.96
Datalab85.73.33

Sarvam Extract Advanced scores 95.4 on ExtractBench at ₹2.50 per page, compared with 96.2 at ₹7.12 for LlamaExtract Agentic Plus and 96.1 at ₹6.03 for Reducto Deep Extract. Basic scores 94.4 at ₹1 per page.

We also evaluated Extract on Datalab's OmniExtractBench, which contains 620 documents across four test sets. Sarvam Extract Advanced scores 91.2, ahead of Extend and LlamaExtract in this evaluation.

ExtractBench is an open benchmark from LlamaIndex covering 370 documents, primarily real-world documents from the US. They range from single-page tax forms to a 192-page sanctions list. Each document has a reference answer key and receives a score out of 100 from a deterministic scorer, which deducts points for missing or incorrect values. The overall score is the average across documents.

We evaluated Sarvam Extract using the same benchmark scorer from ExtractBench, with a small adjustment for missing groups of fields. When all fields within an object are empty (for example, if both the name and address in a person details object are empty), the original scorer expects the entire object to be marked as empty or null. Extract, however, keeps the object intact with empty fields inside it. Our adjustment treats both representations as equivalent. With this adjustment, Advanced scores 95.4 and Basic scores 94.4. With the unmodified scorer, they score 95.33 and 94.36, respectively. These results come from our own evaluation runs.

Extract performance across document workloads

We tested Gemini 3.8 Flash on 370 documents, first sending each document in full, then processing its pages separately. We also tested an OCR-based workflow, using Google's OCR (Document AI) to convert the document into text for Gemini to extract from. We compared all results with Sarvam Extract using the same scorer.

ExtractBench score by document length

DocumentsSarvam Extract Basic₹1 / pageGemini 3.8 Flash, one call₹0.78 / pageGemini 3.8 Flash, page by page₹1.67 / pageGoogle OCR + Gemini 3.8 Flash₹0.96 / pageCodex (GPT-6 Luna)₹1.14 / page
All (370)94.486.689.985.691.0
Short, up to 10 pages (252)95.394.194.092.293.1
Medium, 11 to 50 pages (98)92.679.478.580.587.7
Long, over 50 pages (20)93.028.292.627.280.9
Scroll
Scroll

Short documents run up to 10 pages, medium ones 11 to 50, long ones over 50. Costs use published list prices and the leaderboard's calculation method. Single-call and OCR-first extraction sometimes ends before all values are returned on long documents, reducing the reported cost.

Single calls lose accuracy on longer documents. While single-call Gemini 3.8 Flash extraction achieves a 94.1 score on shorter files, performance drops sharply to 28.2 on long documents. In 8 out of 20 long documents, the system generated valid JSON output despite missing nearly all requested fields. For instance, it extracted only 8 names from a sanctions list of 1,238. Additionally, across 58 documents featuring lists with 100+ rows, it missed more than half the entries in 22 cases. Sarvam Extract Advanced showed no such loss for any of the documents.

Page-by-page extraction can introduce reconciliation errors. Processing pages separately improves accuracy on long documents, but the final output still needs to resolve values found on different pages. In more than 150 fields, Gemini 3.8 Flash selected an incorrect value even though an individual page's response contained the correct answer. Veralto's earnings deck illustrates the problem. Slide 27 reports fourth-quarter results, while slide 29 reports full-year results in the same table format. Asked for annual operating profit, the page-by-page approach returned the quarterly figure of 316 instead of 1,277. It also returned 20 business segments instead of two, scoring 25.5 on the deck. Sarvam Extract returned 1,277 for annual operating profit, cited slide 29 and scored 95.0.

In the Google OCR + Gemini setup, OCR preserves text, but the model still misses values. Running OCR first does not fix the problem on long documents. In a long holdings filing, Google Cloud's OCR captured almost all of the text, but when Gemini was given that text, it returned only a small fraction of the holdings. When the PDF was sent directly, Gemini's response hit its maximum output token limit and was cut off mid-list, leaving incomplete JSON. Sending Gemini one page at a time and joining the answers in code does recover the full list. Sarvam Extract also returns the full list, at a lower price per page.

Extract's accuracy advantage comes from tables and long lists. Single-call extraction performs well on short, simple documents, but misses entries when tables span multiple pages or contain thousands of rows. Pages without repeated column headers also require context from earlier in the document.

The table below breaks down Extract's benchmark results across tables spanning multiple pages, tables with thousands of rows and tables whose headers do not repeat on each page.

ExtractBench score by document type

Documents with this label (count)Sarvam Extract Basic₹1 / pageSarvam Extract Advanced₹2.50 / pageGemini 3.8 Flash, one call₹0.78 / pageGemini 3.8 Flash, page by page₹1.67 / pageGoogle OCR + Gemini 3.8 Flash₹0.96 / page
Table header not at the top (42)91.293.564.164.862.9
Table headers spanning columns (35)92.093.269.081.473.1
Table that crosses pages (91)94.595.373.083.872.8
Rotated or image-only pages (38)94.696.185.184.685.0
Long list to return in full (154)93.794.875.784.175.1
Handwriting (55)94.194.993.893.589.2
Scanned pages (134)94.395.395.291.892.2
Table over 1,000 rows (12)95.795.72.596.31.6
Scroll
Scroll

A document can carry more than one label.

Extract Advanced also scores 94.9 on pages containing handwriting and 96.1 on rotated or image-only pages.

How Sarvam Extract works

Sarvam Extract is powered by Sarvam Vision 2.1 and models hosted on Sarvam Token Factory. Extract first identifies the pages containing each requested field and table, then reads the values from those pages. When a field appears in several places, it selects the relevant page before extraction. This limits each page-level request to the information that page contains.

  • Parse. Sarvam Vision 2.1, our latest OCR model, reads scanned pages in all supported languages. For digital PDFs, Extract uses the embedded text and word coordinates directly.
  • Locate. Extract identifies the source pages for each requested field and table. It tracks tables across pages, including those without repeated column headers, and distinguishes the requested table from others with similar layouts.
  • Read. Each extraction call receives one page and its assigned fields. Fields that could not be located are included in calls to the remaining pages. Extract combines table rows in page order and removes duplicated blocks of rows. If a table exceeds the response length limit, extraction continues from the last complete row in a follow-up call.
  • Check. Code-based checks verify that amounts written in words match their numeric values, GST numbers contain the business's PAN, and IDs follow the required format. Advanced also checks that line items add up to the total. Values that fail these checks receive lower confidence scores and are flagged for review.

Basic and Advanced also handle fields that require context from elsewhere in the document.

  • Interpret codes. When a form uses codes defined in a legend, Extract reads those definitions and returns the corresponding descriptions. For example, it converts a numerical severity code to "mild" or "moderate" using the document's legend.
  • Extract document-wide counts. Some counts, such as the total number of patients in a study, require information from multiple pages. Extract reads the full document text in a single pass to determine these values.

Advanced adds a second reading of the document

Advanced combines Basic's page-level extraction with a second read of the full document, split into sections for longer files. Page-level reads capture individual fields and long lists. The second read provides context for interpreting those values, such as whether a financial figure refers to a quarter or a full year. When the two reads disagree, Advanced returns to the source page to check the value. This additional pass raises the ExtractBench score from 94.4 to 95.4 and the OmniExtractBench score from 88.1 to 91.2.

Basic is suited to high-volume forms, ID verification, invoices and documents in Indian scripts. Advanced is suited to financial statements, regulatory filings, slide decks and large record sets where interpreting a field requires context from other pages.

How Extract keeps costs low

Extract Basic scores 94.4 on ExtractBench at ₹1 per page, compared with 89.9 at ₹1.67 for the best-performing page-by-page Gemini 3.8 Flash configuration. Extract identifies the source page for each field before reading its value. This limits the context and output required for each request, allowing a smaller model to handle the extraction accurately. If a table exceeds the response limit, extraction continues from the last complete row.

Running the same requests through our pipeline with Gemini 3.8 Flash in place of our models, at its listed rates, would cost approximately ₹3.50 per page for Basic and ₹7.20 for Advanced, compared with Extract's prices of ₹1 and ₹2.50. Additional model calls are used only when values need another visual read.

Using Extract

Extract runs asynchronously. The client uploads a document and the fields to extract, polls the job's status, then retrieves the result. In production, where most documents are a few pages long, a typical job completes in about seven seconds. A complete Python example is included at the end of this post.

Fields are defined in JSON Schema, with a name, data type and optional description that guides extraction. The schema also supports lists, such as invoice line items. Field descriptions can be written in English even when the document is in Hindi or Tamil.

Each returned value includes a confidence score and source reference. The example below shows part of Extract's response for an Indian GST invoice.

json
{  "result": {    "invoice_number": "SL4396/24-25",    "seller_gstin": "08YQLFS6004M2Z8",    "buyer_name": "Shree Pharma Distributors",    "place_of_supply": "Madhya Pradesh (23)",    "igst_amount": 19147.67,    "grand_total": 125524  },  "annotations": {    "grand_total": {      "confidence": 1,      "sources": [{ "page_num": 1, "bbox_norm": [0.855, 0.505, 0.935, 0.517] }]    }  }}
  • Confidence scores range from 0 to 1.
  • Each source reference includes a page number and bbox_norm, which gives the bounding box's left, top, right and bottom edges as fractions of the page's width and height.

Extract also returns a standard form of amounts and dates, in normalized_value. An amount printed as ₹ 1,25,524.00 comes back as {amount: 125524, currency: INR}, and a date printed as 14 Oct 2024 comes back as 2024-10-14. This applies only when the format is clear: amounts need a currency symbol or code, and dates need the month in words or the year first, so 05/06/2025 is left as printed.

Every value points to its place on the page

TAX INVOICE(ORIGINAL FOR RECIPIENT)SellerSahyadri LogisticsShop No. 2, Ring RoadJodhpur - 342011, RajasthanGSTIN/UIN: 08YQLFS6004M2Z8State Name: Rajasthan, Code: 08Ph: +91 84151 93982 E-mail: [email protected]Buyer (Bill to)Shree Pharma DistributorsSurvey No. 58/6, Ashram RoadIndore - 452054, Madhya PradeshGSTIN/UIN: 23KUXFS2502C2Z0State Name: Madhya Pradesh, Code: 23Consignee (Ship to)Shree Plant II (Bhopal)Shop No. 2, Tilak RoadBhopal - 462002, Madhya PradeshGSTIN/UIN: 23STJFS7479B2ZGState Name: Madhya Pradesh, Code: 23Invoice No.SL4396/24-25Dated14-10-2024Delivery NoteDN-484Mode/Terms of Payment15 Days CreditBuyer's Order No.PO/8368Dated07-10-2024e-Way Bill No.908594145298Vehicle No.RA44 FF 5945Place of Supply:Madhya Pradesh (23)SlDescription of GoodsHSN/SACQuantityRateperAmount1LED Batten 20W 4 ft940520 Nos304.00Nos6,080.002MCB 32A Double Pole85368 Nos408.47Nos3,267.763FR PVC Wire 1.5 sq mm (90 m coil)854460 Coil1,494.92Coil89,695.204LED Panel Light 18W Round94054 Nos382.86Nos1,531.445Distribution Board 8 Way85375 Nos1,160.30Nos5,801.50Output IGST19,147.67Round Off0.43Total97₹ 1,25,524.00Amount Chargeable (in words)One Lakh Twenty Five Thousand Five Hundred Twenty Four Rupees Only

page 1 · bbox_norm [0.855, 0.505, 0.935, 0.517]

A made-up GST invoice. Values, confidence scores and boxes exactly as Extract returned them.

Values receive lower confidence scores when they fail validation or a second read produces a different result, helping teams route them for human review. The source reference directs reviewers to the exact words in a digital PDF or the area read from a scanned page.

Where Extract can improve

Our next round of improvements targets specific errors in reading and verification. These include adding or dropping words within a value, selecting a neighbouring item's value, missing rows in long tables and leaving cells empty. We're also improving how Advanced resolves disagreements between its two readings.

Availability

Extract is available through the Sarvam API for users in India and the US. You can also upload documents to Sarvam Document AI and run extraction in your browser without writing code.

Basic and Advanced accept the same schema and return the same response format. Switch between them by setting mode to basic or advanced in your request. Advanced's second reading of the whole document runs on documents of up to 200 pages, in Latin, Greek and Cyrillic scripts.

New accounts receive free credits, and you're charged only for pages processed successfully. For volume pricing, on-premises deployment or a dedicated setup, talk to our team.

A full Python call for an English invoice follows. English documents set language to en-IN; documents in Indian languages leave it out.

python
import json, time, requestsAPI = "https://api.sarvam.ai/doc-ai/v1/job"headers = {"api-subscription-key": "SARVAM_API_KEY"}schema = {"type": "object", "properties": {    "invoice_number": {"type": "string", "description": "Invoice number as printed"},    "grand_total": {"type": "number", "description": "Total payable, including tax"}}}with open("invoice.pdf", "rb") as f:    job = requests.post(f"{API}/extract", headers=headers,                        files={"file": ("invoice.pdf", f, "application/pdf")},                        data={"schema": json.dumps(schema), "mode": "basic", "language": "en-IN"}).json()while True:    status = requests.get(f"{API}/{job['job_id']}/status", headers=headers).json()["status"]    if status in ("completed", "partially_completed", "failed", "rejected"):        break    time.sleep(5)if status in ("completed", "partially_completed"):    print(requests.get(f"{API}/{job['job_id']}/results", headers=headers).json()["result"])else:    print("Job ended:", status)

Read More

Curious what else we're building? Explore our APIs and start creating.