This paper describes the work made during the internship period of three hundred and twenty hours by graduate student Osama Chelhaoui at the company Zucchetti S.p.A., which will be referred to as 'Zucchetti' or 'the company' in the body of the paper. The internship was supervised by the external tutor, Gregorio Piccoli, and by the lecturer, Prof. Ombretta Gaggi. The problem faced by the company was the need to explore efficient solutions to improve access to its technical manuals and documentation. In particular, it wanted to evaluate the possibility of creating Artificial Intelligence (AI) based applications that could be executed locally in the browser, to allow employees to consult company documents without depending on external server infrastructures. The objective of the stage was to create a Retrieval-Augmented Generation (RAG) based chatbot capable of extracting relevant information from uploaded documents, using technologies such as Transformers.js and PGlite, based on the WebAssembly standard. This Proof of Concept has been optimised with techniques such as BM25, Rag-Fusion and a rule engine based on the RETE algorithm, to improve the document retrieval process and to allow the dynamic redefinition of the prompt used by Large Language Models (LLMs) to generate a response. The first activities the internship, prior to development, dealt with the study of RAG systems, the analysis of the problems associated with them and the in-depth study of the forms of document segmentation (chunking) to optimise the process of response generation. The results obtained demonstrated the fulfilment of the requirements and the potential of these technologies for business applications, at the expense of performance and compatibility problems.

Il presente elaborato descrive il lavoro svolto durante il periodo di stage, della durata di trecento venti ore, dal laureando Osama Chelhaoui, presso l’azienda Zucchetti S.p.A., che verrà definita come “Zucchetti” o “l’azienda” nel corpo del documento. Lo stage è stato supervisionato dal tutor esterno Gregorio Piccoli, e dalla relatrice, prof.ssa Ombretta Gaggi. Il problema affrontato dall’azienda riguardava la necessità di esplorare soluzioni efficienti per migliorare l’accesso ai propri manuali e documentazioni tecniche. In particolare, voleva valutare la possibilità di creare applicazioni basate sull’Intelligenza Artificiale (IA) eseguibili localmente nel browser, per permettere ai dipendenti di consultare i documenti aziendali, senza dipendere da infrastrutture server esterne. L’obiettivo dello stage è stato creare un chatbot basato su Retrieval-Augmented Generation (RAG) in grado di estrarre informazioni rilevanti dai documenti caricati, utilizzando tecnologie come Transformers.js e PGlite, basate sullo standard WebAssembly. Questo Proof of Concept è stato ottimizzato attraverso tecniche come BM25, Rag-Fusion e un motore di regole basato sull’algoritmo RETE, per migliorare il processo di recupero dei documenti e consentire la ridefinizione dinamica del prompt utilizzato dai Large Language Models (LLMs) per la generazione delle risposte. Le prime attività svolte durante lo stage, prima dello sviluppo, hanno trattato lo studio dei sistemi RAG, l’analisi delle problematiche associate ad esse e l’approfondimento delle forme di segmentazione dei documenti (chunking) per ottimizzare il processo di generazione delle risposte. I risultati ottenuti hanno dimostrato il soddisfacimento dei requisiti e il potenziale di queste tecnologie per le applicazioni aziendali, a discapito delle prestazioni e problemi di compatibilità.

Applicazione Web per Retrieval-Augmented Generation (RAG) Locale nel Browser

CHELHAOUI, OSAMA
2024/2025

Abstract

This paper describes the work made during the internship period of three hundred and twenty hours by graduate student Osama Chelhaoui at the company Zucchetti S.p.A., which will be referred to as 'Zucchetti' or 'the company' in the body of the paper. The internship was supervised by the external tutor, Gregorio Piccoli, and by the lecturer, Prof. Ombretta Gaggi. The problem faced by the company was the need to explore efficient solutions to improve access to its technical manuals and documentation. In particular, it wanted to evaluate the possibility of creating Artificial Intelligence (AI) based applications that could be executed locally in the browser, to allow employees to consult company documents without depending on external server infrastructures. The objective of the stage was to create a Retrieval-Augmented Generation (RAG) based chatbot capable of extracting relevant information from uploaded documents, using technologies such as Transformers.js and PGlite, based on the WebAssembly standard. This Proof of Concept has been optimised with techniques such as BM25, Rag-Fusion and a rule engine based on the RETE algorithm, to improve the document retrieval process and to allow the dynamic redefinition of the prompt used by Large Language Models (LLMs) to generate a response. The first activities the internship, prior to development, dealt with the study of RAG systems, the analysis of the problems associated with them and the in-depth study of the forms of document segmentation (chunking) to optimise the process of response generation. The results obtained demonstrated the fulfilment of the requirements and the potential of these technologies for business applications, at the expense of performance and compatibility problems.
2024
Web Application for Local Retrieval-Augmented Generation (RAG) in the Browser
Il presente elaborato descrive il lavoro svolto durante il periodo di stage, della durata di trecento venti ore, dal laureando Osama Chelhaoui, presso l’azienda Zucchetti S.p.A., che verrà definita come “Zucchetti” o “l’azienda” nel corpo del documento. Lo stage è stato supervisionato dal tutor esterno Gregorio Piccoli, e dalla relatrice, prof.ssa Ombretta Gaggi. Il problema affrontato dall’azienda riguardava la necessità di esplorare soluzioni efficienti per migliorare l’accesso ai propri manuali e documentazioni tecniche. In particolare, voleva valutare la possibilità di creare applicazioni basate sull’Intelligenza Artificiale (IA) eseguibili localmente nel browser, per permettere ai dipendenti di consultare i documenti aziendali, senza dipendere da infrastrutture server esterne. L’obiettivo dello stage è stato creare un chatbot basato su Retrieval-Augmented Generation (RAG) in grado di estrarre informazioni rilevanti dai documenti caricati, utilizzando tecnologie come Transformers.js e PGlite, basate sullo standard WebAssembly. Questo Proof of Concept è stato ottimizzato attraverso tecniche come BM25, Rag-Fusion e un motore di regole basato sull’algoritmo RETE, per migliorare il processo di recupero dei documenti e consentire la ridefinizione dinamica del prompt utilizzato dai Large Language Models (LLMs) per la generazione delle risposte. Le prime attività svolte durante lo stage, prima dello sviluppo, hanno trattato lo studio dei sistemi RAG, l’analisi delle problematiche associate ad esse e l’approfondimento delle forme di segmentazione dei documenti (chunking) per ottimizzare il processo di generazione delle risposte. I risultati ottenuti hanno dimostrato il soddisfacimento dei requisiti e il potenziale di queste tecnologie per le applicazioni aziendali, a discapito delle prestazioni e problemi di compatibilità.
RAG
LLM
Web
React
File in questo prodotto:
File Dimensione Formato  
Chelhaoui_Osama.pdf

accesso aperto

Dimensione 4.44 MB
Formato Adobe PDF
4.44 MB Adobe PDF Visualizza/Apri

The text of this website © Università degli studi di Padova. Full Text are published under a non-exclusive license. Metadata are under a CC0 License

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/20.500.12608/81827