AI Workflow: Optimizing Resume Parsing with LLM Agents A developer improved resume parsing accuracy from 65% to 94% by shifting date arithmetic from an LLM prompt to a Python post-processing script, using a two-step chain that first extracts raw date ranges into JSON and then calculates total experience programmatically. The fix addressed a common hallucination where the LLM incorrectly summed disparate roles instead of computing the actual timeline. AI Workflow: Optimizing Resume Parsing with LLM Agents The core issue was the prompt engineering—I was asking the model to "extract years of experience," which led it to sum up every date it saw on the page. The Debugging Process I started by dumping the raw text output of my PDF parser using PyMuPDF into a log file. I noticed that the text extraction was interleaving columns, meaning a date from the right column was appearing in the middle of a sentence from the left column. The Error Pattern: Input: 2021-2023 Senior Dev Company A Jan 2018-2020 Junior Dev Company B LLM Output: Total Experience: 5 years Incorrectly summing disparate roles instead of calculating the timeline . To fix this, I shifted from a simple extraction prompt to a structured AI workflow that forces the model to first map the timeline chronologically before calculating the total. The Fix: Implementation Logic I implemented a two-step chain. First, the agent must output a JSON array of every single date range found, paired with the job title. Second, a Python function calculates the delta between the earliest and latest dates, ignoring overlaps. Here is the specific system prompt and the validation logic I used to stop the hallucinations: { "system prompt": "You are a precise data extractor. Extract all employment history into a JSON list. Each object must contain 'start date', 'end date', and 'role'. If a date is listed as 'Present', use the current date 2024-05-20. Do not summarize or calculate totals; only extract raw dates.", "extraction schema": { "role": "string", "start date": "YYYY-MM-DD", "end date": "YYYY-MM-DD" } } Then, I used this Python snippet to handle the actual calculation, which is far more reliable than letting the LLM do math: python from datetime import datetime def calculate total experience experience list : if not experience list: return 0 Sort by start date to handle overlaps sorted exp = sorted experience list, key=lambda x: x 'start date' total days = 0 last end date = datetime.strptime sorted exp 0 'start date' , '%Y-%m-%d' for exp in sorted exp: start = datetime.strptime exp 'start date' , '%Y-%m-%d' end = datetime.strptime exp 'end date' , '%Y-%m-%d' if start last end date: last end date = start if end last end date: total days += end - last end date .days last end date = end return total days / 365.25 Final Results By moving the "math" out of the prompt and into a post-processing script, the accuracy of the experience extraction jumped from roughly 65% to 94% across a test set of 100 diverse resume formats. For anyone building a similar LLM agent for HR tech, the lesson is clear: use the LLM for unstructured-to-structured transformation, but never trust it with date arithmetic or summation. For more refined prompt structures, you can check out the resources at promptcube3.com. Next Re-entry cost is the hidden tax of solo development → /en/threads/2843/