Datasheets run to hundreds of pages. Finding one timing value or pin limit means a lot of scrolling and searching.
Split datasheets into overlapping chunks, find the most relevant ones with vector search, and let an LLM answer only from them.
Retrieval hit rate@4 on a 25-question evaluation set.
How a question is answered
Extract
PyMuPDF pulls text from each datasheet page, keeping page numbers for citations.
Chunk and embed
Text is split into overlapping chunks and embedded with sentence-transformers.
Retrieve
FAISS cosine-similarity search returns the four closest chunks to the question.
Gate
If even the best match is below a similarity threshold, the question is refused before the LLM is called.
Answer
Llama 3 answers from the retrieved chunks only, citing the page each fact came from.
Cache
A hash of each file keys its embeddings, so re-uploading a datasheet skips re-indexing entirely.
Measured results
Chunk sizes of 400, 800 and 1,200 characters were benchmarked on the same 25 questions, and the best size was kept.
Questions the datasheets can't answer are declined instead of answered with a guess. Refusing before the LLM call also saves a model request.