LLMs, NER and Regular Expressions for Resume Parsing

Valeria Elpatyevskaya25 May 2024

Problem

HR specialists at the speaker's company copy fields from each resume into a web form by hand: workplaces, name, city, education. The speaker's manual annotation took 20–30 minutes per resume. The team wanted a "fill from file" button. Three constraints made it hard: resume layouts differ (hh.ru, Habr Career, custom templates), the form should respond in about 3 seconds (10 at worst), and resumes hold personal data, so OpenAI was ruled out.

Example from the article: the best local LLM, Vikhr-7B-instruct, needed 37.8 seconds per resume and invented values, such as an email built from a name plus "@mail.ru".

Solution in brief

Five prompt iterations with local LLMs stayed slow and kept inventing values. The team switched to a Russian NER model plus heuristics: dates are paired by proximity, and an organization is typed by the resume block it sits in. Fields with a closed value list use full-text search. The parser takes 6.4 seconds and cut manual work from 20–30 minutes to at most 5.

Questions this case answers
  • How to extract structured fields from documents of arbitrary layout into a form without the model inventing values for missing fields
  • How to choose between a generative LLM and NER with heuristics for field extraction under a strict latency limit and a data-privacy constraint
  • How to extract structured fields from resumes of arbitrary layout to pre-fill a form
  • How to choose between an LLM and NER with heuristics for document field extraction under a latency limit

Tools and methods

  • Vikhr-7B-instruct — best local LLM tried (also Mistral-7B, Saiga2 70B, Mixtral 8x7B); the baseline
  • Natasha — rule-based extractors for dates, names and money
  • Hugging Face Russian NER model — person, email, location, date, organisation tags
  • Heuristics and full-text search — map tags to form fields; match closed-list values
Continue reading — it's free

Google or a one-time email code. No password.