194 points · by evanhu_ · 2y ago · 73 comments
All implementation details are in the GitHub. Currently, because I've opted to extract text from the PDF of the paper rather than reading the LaTeX source code (since I wanted to build a more generic PDF RAG in the process), it struggles with symbolic text / mathematics, and sometimes fails to retrieve the correct context. I appreciate any feedback, and hope people find it useful!
Currently, the backend PDF processing server is only single-threaded so if embedding takes a while please be patient!
javascript:((u,a,b,c)=%3Ewindow.location.href=u.match(a)?u.replace(a,b):u.startsWith(b)?u.replace(b,c):u)(window.location.href,/https:\/\/arxiv\.org\/(abs|pdf)\//,'https://www.talk2arxiv.org/pdf/','https://arxiv.org/pdf/')
Using that might be easier than a multi-modal approach. Bonus points for:
* Multiple papers at once
* Comparing PDF and HTML output with the LLM as input for it correcting similar converter code
Both are tools to convert pdfs into Latex or Markup with latex formulas. Maybe that helps
"Relying on autoregressive forward passes to generate text is slow and prone to hallucination/repetition. From the nougat paper: We observed [repetition] in 1.5% of pages in the test set, but the frequency increases for out-of-domain documents. In my anecdotal testing, repetitions happen on 5%+ of out-of-domain (non-arXiv) pages."
When these are fed in the next levels as inputs, isn't it even less surprising to get even more hallucinations/repetitions?
https://ollama.ai/blog/building-llm-powered-web-apps
There's also Cheshire Cat, which is a framework for building chat assistants that use a set of documents as a knowledge base:
I assume I'm just getting old and have a limited imagination when it comes to these new AI things.
Anyone got any good examples on how to effectively use this?
"I'm building xyz app, how could this be applicable?"
"I want to know if x or y, what does this paper say, or does it even apply?"
"Implement the pseudocode algorithm in python"
"Can you help me understand section X, the wording is tricky"
"Doesn't this suffer from {flaw}?"
"How does the paper address x?"
No, an AI will not give 100% perfect answers all of the time. You know who else? Humans. You already have mechanisms to deal with unreliability, so please save yourself time and use AI to be more efficient.
Even though it gave a lot of great structured options, missing even a single sentence was unforgivable to me. I went with Nougat instead, for arxiv papers.
(Also check out Marker (mentioned on hn in the last month) for pretty high fidelity paper conversion to markdown. Does reasonable job with equations too.)
The chunking algorithm chunks by logical section (intro, abstract, authors, etc.) and also utilizes recursive subdivision chunking (chunk at 512 characters, then 256, then 128...). It is quite naive still but it works OK for now. An improvement would perhaps involve more advanced techniques like knowledge graph precomputation.
Reranking works by instead of embedding each text chunk as a vector and performing cosine similarity nearest neighbor search, you use a Cross-Encoder model that compares two texts and outputs a similarity score. Specifically, I chose Cohere's Reranker that specializes in comparing Query and Answer chunk pairs.
The query pipeline isn't that sophisticated, but it could be altered to do page reference and use keyterms first to filter, instead of doing the vector similarity on all data.
One thing with MittaAI is that it doesn't do UI interfaces. It expects you to handle those bits.
https://learn.microsoft.com/en-us/azure/ai-services/document...
Used it to scope/isolate databases storing backups to a shared storage account