Anchor LLM Evidence Quotes to Character Offsets in a Chart
Last updated: November 29, 2026
Quick Overview
An LLM returns findings with supporting quotes from a clinical note, but the quotes differ from the source in casing and whitespace. Write a function that maps each quote back to the start and end character offsets in the original note, or reports it as not found.
Charta Health
November 29, 20260
0
0 solved
An LLM returns findings with supporting quotes from a clinical note, but the quotes differ from the source in casing and whitespace. Write a function that maps each quote back to the start and end character offsets in the original note, or reports it as not found.
Charta Health's findings are only useful if a coder can click and see the exact sentence that justifies them, and a quote that does not exist in the chart is a hallucination signal. This problem checks string processing with an index map, careful offset arithmetic, and the instinct to reject unsupported evidence.
What the Interviewer Expects
- Normalizes both note and quote the same way
- Maintains a mapping from normalized index back to original offsets
- Returns None for quotes that do not appear, rather than a best guess
- Handles repeated occurrences sensibly
- Discusses complexity and when fuzzy matching would be needed
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you handle quotes where the model changed a word or fixed a typo?
- What should happen when the same quote appears in the note template and the real assessment?
- How would you scale this to long charts and many quotes?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: original note text and a list of quote strings. Output: one (start, end) per quote in original coordinates such that note[start:end] is the supporting text, or None. Normalization: lowerc...
High-Level Design
Build the normalized note once, and alongside it an array idx where idx[k] is the original position of normalized character k. Search each normalized quote in the normalized note, then translate...