PDF-SmartAI - An AI Study Companion for Uploaded Textbooks: A Book-Grounded Question-Answering System Using In-Browser PDF Extraction and Google Gemini
Students increasingly turn to general-purpose AI chatbots for help with their studies, yet these chatbots answer from what they absorbed during training rather than from the textbook a student is examined on, and they can state wrong facts with confidence. This paper presents PDF-SmartAI, a zero-cost web application in which a student uploads up to two PDF textbooks and asks questions that an assistant, AI Buddy, answers only from that book, citing the page numbers it used and saying so when the book does not cover a question.
Text is extracted entirely inside the browser by PDFium compiled to WebAssembly, split into page-aware chunks, stored per user in Cloud Firestore under owner-only security rules, and sent to Google Gemini through Firebase AI Logic on free tiers — the whole book when it is short (up to 100,000 characters), otherwise the eight chunks chosen by a plain-Dart keyword retriever. The study is secondary research combined with the evaluation of a built artefact; no participants were recruited. A public global survey of higher-education students (analytic n = 12,909) shows a moderate positive association between how much students use ChatGPT and how useful they find it for learning (Spearman ? = 0.376, p < .001), while a substantial share of students (44.3%) agree that ChatGPT might mislead with inaccurate information (Wilcoxon z = 21.286, p < .001). On 10,570 SQuAD v1.1 questions over 13 synthetic books, the app’s own retrieval code placed the answer-bearing passage among the eight excerpts sent to the AI for 94.9% of questions, far above a random baseline (4.9%) and within 0.05 of BM25 (95.7%), although statistically slightly below it. All three hypotheses are supported. AI answer quality was checked only through live smoke tests and remains to be benchmarked.
Introduction
The text presents PDF-SmartAI, a zero-cost, AI-powered study platform designed to help students answer questions using their own uploaded PDF textbooks. Its AI assistant, called AI Buddy, uses retrieval-augmented generation (RAG) to find relevant textbook passages, generate answers based on those passages, and provide page references for verification. It also acknowledges when information is not available in the uploaded book, helping reduce AI hallucinations and improve answer reliability.
The study highlights the limitations of general AI chatbots, including inaccurate answers, lack of textbook-based references, and concerns about student trust. Existing AI solutions often depend on paid servers, vector databases, and API services, making them less accessible to students.
PDF-SmartAI addresses these issues through in-browser PDF text extraction, keyword-based retrieval, secure document handling, and free-tier AI integration. The research evaluates student perceptions using a public survey of 23,218 students from 109 countries and tests retrieval performance using 10,570 questions from the SQuAD dataset. It also uses statistical analysis, automated unit tests, and system testing to assess the proposed approach.
Conclusion
PDF-SmartAI shows that a book-grounded AI study companion can be built and run at zero cost: the PDF is read inside the browser by PDFium compiled to WebAssembly, the text is held privately under owner-only rules, a simple keyword retriever chooses the passages, and Google Gemini answers only from them, with page references and an honest “not in this book” when needed. Secondary analysis of 12,909 students’ survey responses confirms both the demand (usefulness rises with use) and the problem (a substantial share doubt the accuracy of chatbot answers). On 10,570 SQuAD questions the retriever delivered the answer-bearing passage 94.9% of the time — well above the 0.80 criterion, far above chance and only slightly behind BM25. The limits are stated plainly: the survey concerns ChatGPT rather than PDF-SmartAI, the benchmark favours keyword methods, scanned books are unsupported, and the AI’s final answers have so far been confirmed only through smoke tests.
Based on the study, the following future work is recommended:
1) add BM25-style document-length normalisation to the retriever — a free, plain-Dart change that, judging by BM25’s lead, could add about 0.04 at rank 1 on this data — plus light stemming and typo tolerance for word-form misses;
2) once the AI is re-enabled, benchmark answer faithfulness and page-citation accuracy within the free daily quota, and run a consented user study with students on their own textbooks;
3) enforce the two-book limit in the Firestore security rules as well as in the app, since a determined user could currently bypass the client-side check;
4) support scanned books through free on-device text recognition; server-side OCR would require the paid Blaze plan and is deliberately excluded from the zero-cost scope;
5) for teachers and colleges: encourage students to check AI answers against the cited pages of the prescribed book, in line with the corroboration advice of Kasneci et al. [1].
References
[1] E. Kasneci et al., “ChatGPT for good? On opportunities and challenges of large language models for education,” Learning and Individual Differences, vol. 103, Art. no. 102274, 2023, doi: 10.1016/j.lindif.2023.102274.
[2] D. Ravšelj et al., “Higher education students’ perceptions of ChatGPT: A global study of early reactions,” PLOS ONE, vol. 20, no. 2, Art. no. e0315011, 2025, doi: 10.1371/journal.pone.0315011.
[3] Z. Ji et al., “Survey of hallucination in natural language generation,” ACM Computing Surveys, vol. 55, no. 12, Art. no. 248, 2023, doi: 10.1145/3571730.
[4] P. Lewis et al., “Retrieval-augmented generation for knowledge-intensive NLP tasks,” in Advances in Neural Information Processing Systems, vol. 33, 2020, pp. 9459–9474. [Online]. Available: https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html
[5] O. Zawacki-Richter, V. I. Marín, M. Bond, and F. Gouverneur, “Systematic review of research on artificial intelligence applications in higher education – where are the educators?,” International Journal of Educational Technology in Higher Education, vol. 16, no. 1, Art. no. 39, 2019, doi: 10.1186/s41239-019-0171-0.
[6] S. Wang et al., “Large language models for education: A survey and outlook,” arXiv:2403.18105, 2024, doi: 10.48550/arXiv.2403.18105.
[7] C. K. Y. Chan and W. Hu, “Students’ voices on generative AI: Perceptions, benefits, and challenges in higher education,” International Journal of Educational Technology in Higher Education, vol. 20, no. 1, Art. no. 43, 2023, doi: 10.1186/s41239-023-00411-8.
[8] G. Kestin, K. Miller, A. Klales, T. Milbourne, and G. Ponti, “AI tutoring outperforms in-class active learning: An RCT introducing a novel research-based design in an authentic educational setting,” Scientific Reports, vol. 15, no. 1, Art. no. 17458, 2025, doi: 10.1038/s41598-025-97652-6.
[9] H. Bastani, O. Bastani, A. Sungu, H. Ge, Ö. Kabakc?, and R. Mariman, “Generative AI without guardrails can harm learning: Evidence from high school mathematics,” Proceedings of the National Academy of Sciences of the United States of America, vol. 122, no. 26, Art. no. e2422633122, 2025, doi: 10.1073/pnas.2422633122.
[10] K. Shuster, S. Poff, M. Chen, D. Kiela, and J. Weston, “Retrieval augmentation reduces hallucination in conversation,” in Findings of the Association for Computational Linguistics: EMNLP 2021, 2021, pp. 3784–3803, doi: 10.18653/v1/2021.findings-emnlp.320.
[11] T. Gao, H. Yen, J. Yu, and D. Chen, “Enabling large language models to generate text with citations,” in Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, 2023, pp. 6465–6488, doi: 10.18653/v1/2023.emnlp-main.398.
[12] S. Robertson and H. Zaragoza, “The probabilistic relevance framework: BM25 and beyond,” Foundations and Trends in Information Retrieval, vol. 3, no. 4, pp. 333–389, 2009, doi: 10.1561/1500000019.
[13] P. Rajpurkar, J. Zhang, K. Lopyrev, and P. Liang, “SQuAD: 100,000+ questions for machine comprehension of text,” in Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, 2016, pp. 2383–2392, doi: 10.18653/v1/D16-1264.
[14] V. Karpukhin et al., “Dense passage retrieval for open-domain question answering,” in Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2020, pp. 6769–6781, doi: 10.18653/v1/2020.emnlp-main.550.
[15] Gemini Team, Google, “Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context,” arXiv:2403.05530, 2024, doi: 10.48550/arXiv.2403.05530.
[16] N. F. Liu et al., “Lost in the middle: How language models use long contexts,” Transactions of the Association for Computational Linguistics, vol. 12, pp. 157–173, 2024, doi: 10.1162/tacl_a_00638.
[17] Z. Li, C. Li, M. Zhang, Q. Mei, and M. Bendersky, “Retrieval augmented generation or long-context LLMs? A comprehensive study and hybrid approach,” in Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: Industry Track, 2024, pp. 881–893, doi: 10.18653/v1/2024.emnlp-industry.66.
[18] L. Blecher, G. Cucurull, T. Scialom, and R. Stojnic, “Nougat: Neural optical understanding for academic documents,” in The Twelfth International Conference on Learning Representations (ICLR 2024), 2024. [Online]. Available: https://arxiv.org/abs/2308.13418
[19] A. Haas et al., “Bringing the web up to speed with WebAssembly,” in Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, 2017, pp. 185–200, doi: 10.1145/3062341.3062363.
[20] A. Jangda, B. Powers, E. D. Berger, and A. Guha, “Not so fast: Analyzing the performance of WebAssembly vs. native code,” in Proceedings of the 2019 USENIX Annual Technical Conference, 2019, pp. 107–120. [Online]. Available: https://www.usenix.org/conference/atc19/presentation/jangda
[21] S. Siegel and N. J. Castellan, Jr., Nonparametric Statistics for the Behavioral Sciences, 2nd ed. New York, NY, USA: McGraw-Hill, 1988.
[22] F. Pedregosa et al., “Scikit-learn: Machine learning in Python,” Journal of Machine Learning Research, vol. 12, pp. 2825–2830, 2011.
[23] D. Ravšelj et al., “Higher education students’ early perceptions of ChatGPT: Global survey data,” Mendeley Data, Version 2, Feb. 2025, doi: 10.17632/ymg9nsn6kn.2.
[24] W. G. Cochran, Sampling Techniques, 3rd ed. New York, NY, USA: John Wiley & Sons, 1977.
[25] Flutter, “Web support for Flutter,” Flutter documentation. [Online]. Available: https://docs.flutter.dev/platform-integration/web (accessed Oct. 10, 2026).
[26] espresso3389.jp, “pdfrx | Flutter package,” pub.dev. [Online]. Available: https://pub.dev/packages/pdfrx (accessed Oct. 10, 2026).
[27] PDFium Authors, “pdfium - Git at Google,” Google Git. [Online]. Available: https://pdfium.googlesource.com/pdfium/ (accessed Oct. 10, 2026).
[28] Google, “Get started with Cloud Firestore Security Rules,” Firebase documentation. [Online]. Available: https://firebase.google.com/docs/firestore/security/get-started (accessed Oct. 10, 2026).
[29] Google, “Gemini API using Firebase AI Logic,” Firebase documentation. [Online]. Available: https://firebase.google.com/docs/ai-logic (accessed Oct. 10, 2026).
[30] Google, “Gemini Developer API pricing,” Google AI for Developers. [Online]. Available: https://ai.google.dev/gemini-api/docs/pricing (accessed Oct. 10, 2026).
[31] Google, “Firebase Pricing,” Firebase. [Online]. Available: https://firebase.google.com/pricing (accessed Oct. 10, 2026).