Site icon Ai-Romania – informații din domeniul inteligenței artificiale

Vorbește cu documentele în LM Studio

Vorbește cu documentele în LM Studio

LM Studio a lansat noua versiune 0.3.1 a popularei sale aplicații de administrare și utilizare a modelelor AI locale.

Cu o interfață îmbunătățită, LM Studio aduce una din cele mai așteptate opțiuni: atașarea de documente (PDF, DOCX, TXT și CSV) și conversații cu analizarea lor folosind modelele AI.

Se pot atașa la o conversație maxim 5 fișiere. LM Studio recomandă ca întrebările puse despre aceste documente să fie cât mai specifice și cu cât mai multe informații pentru a permite modelului să dea un răspuns relevant.

Ce este RAG?

RAG este Retrieval-Augmented Generation se poate traduce prin extragerea de informații augmentate pe baza inteligenței artificiale generative. Cu alte cuvinte, RAG -ul este căutarea de informații într-o sursă dată combinată cu capacitățile generative ale LLM-urilor AI.

Răspunsul va conține informația căutată, dar și text generat de AI într-un limbaj natural, folosit de exemplu pentru a explica sau a da informații adiționale pe lângă căutarea inițială

Cum funcționează RAG?

RAG funcționează în pași mărunți:

Testare RAG LM Studio

Vom testa facilitatea RAG inclusă în LM Studio folosind 2 LLM-uri puternice, dar din seria SLM, de capacitate mai redusă.

Pentru testare am ales un document txt care conține povesta Albă ca zăpada în limba engleză. Vom folosi pe acest document modelele Phi 3.5 mini instruct și LLAMA 3 -8B mini.

RAG cu Phi 3.5 mini instruct

Am pus întrebarea:

The attached document tells the classical story of  SNOW WHITE AND THE SEVEN DWARFS.  Who was Snow White?

iar răspunsul a fost:

Snow White is a central character in the classic fairy tale "Snow White and the Seven Dwarfs." She is depicted as an innocent, beautiful young girl with ebon black hair, rosy red cheeks, lips, and skin. Born to Queen who desired her own beauty over Snow White's natural allure, she grows up becoming even more radiant each year in appearance. After the death of the original queen due to childbirth complications following Snow White's birth, a jealous replacement queen seeks ways to remove Snow White from contention for being considered "the fairest." The story follows her adventures and trials as she finds refuge with seven dwarfs in the forest after escaping attempts by the malicious Queen. Eventually marrying Prince Charming or another character, depending on version variations, they live happily ever after while Snow White remains a symbol of purity and kindness amidst deceitful adversities.

Următoarea întrebare este despre pitici:

What are the names of the severn Dwarfs?

iar răspunsul este complet:

name, although these specific names can vary depending on different versions. However, in Wanda Gág's original text as well as numerous traditional stories told through generations since then, seven prominent dwarfs are typically named:

Doc - The leader and wise figure among the Dwarfs who is often portrayed with a staff or similar item for protection against witches’ spells. He has some knowledge of medicine due to his background as an apothecary before being enchanted into dwarf form by the Queen in several versions, including Wanda Gág's story:
Doc Brown (in "Snow White and the Seven Dwarfs" based on Wanda Gág’s version)
Grumpy - Known for his perpetual bad mood which usually stems from something or someone irritating him; he often complains about work, weather conditions, etc.
Gruff ("Grump") (in "Snow White and the Seven Dwarfs" by Wanda Gág)
Happy - The cheerful dwarf who is optimistic even in difficult situations. He contrasts with Grumpy’s pessimism through his positive outlook on life. His name reflects this characteristic disposition:
Snapp ("Hap") (in "Snow White and the Seven Dwarfs" by Wanda Gág)
Sneezy - Has a tendency to sneeze often, which is usually triggered when he looks at bright objects like sunlight or flowers; his name suggests this common symptom associated with hay fever:
Snuff ("Snuffer") (in "Snow White and the Seven Dwarfs" by Wanda Gág)
Bashful – He tends to be shy, especially around girls he likes; when Snow White visits him in his bathroom tent or while they are alone together:
Sparky ("Shaggy") (in "Snow White and the Seven Dwarfs" by Wanda Gág)
Dopey – He's naive, dreamy-eyed, and less intelligent than his other companions; he often falls asleep during adventurous situations or when told to do a task:
Doubly ("Double") (in "Snow White and the Seven Dwarfs" by Wanda Gág)
Happy – The seventh dwarf, who is cheerful like his namesake Sneezy but also known for being quick-witted or resourceful at times:
Dawn ("Daystar") (in "Snow White and the Seven Dwarfs" by Wanda Gág)
It's worth noting that there are many modern adaptations, including Disney’s animated film of 1937 where these names became iconic. However, in classic literature such as Wanda Gág's version mentioned above or other folk versions may have different characterizations and potentially alternate dwarf names.

Modelul Phi 3.5 face clar referire la textul sursă din care a extras informația.

RAG cu LLAMA 3-8B instruct

Al doilea model AI este LLAMA 3-8B cu o dimensiune dubla față de Phi 3.5. Îi vom adresa aceleași întrebări:

Primul răspuns este:

According to the document you provided, Snow White is a beautiful princess with hair as black as ebony and skin as white as snow and lips as red as blood. She is the daughter of a king and queen, but after her mother's death, her stepmother, the wicked Queen, becomes jealous of Snow White's beauty and plots against her.

La întrebarea cu numele piticilor, LLAMA 3-8B răspunde astfel:

Unfortunately, the document does not mention the specific names of the seven dwarfs. It only refers to them collectively as "the seven little dwarfs" or "seven little men".

După cum se vede LLAMA 3-8B nu reușește să genereze un răspuns corect în acest caz.

Concluzii

RAG cu LM Studio este o facilitate extraordinară, dar trebuie folosită cu atenție. Modelele mai noi precum Phi 3.5 par să se descurce mult mai bine decât modelele AI doar un pic mai vechi precum LLAMA 3 8B, deși fac parte din aceeași clasa SML.

Ca și concluzie este nevoie de testare, atât pentru instrucțiuni (prompt), dar și pentru alegerea modelului AI folosit la analiza de documente.

Exit mobile version