Najlepsze praktyki podpowiedzi dotyczące korzystania z Llama 2 Chat LLM za pośrednictwem Amazon SageMaker JumpStart | Usługi internetowe Amazona

Najlepsze praktyki podpowiedzi dotyczące korzystania z Llama 2 Chat LLM za pośrednictwem Amazon SageMaker JumpStart | Usługi internetowe Amazona

Llama 2 stoi na czele innowacji w zakresie sztucznej inteligencji, ucieleśniając zaawansowany model języka autoregresyjnego opracowany na wyrafinowanym fundamencie transformatora. Jest dostosowany do wielu zastosowań zarówno w dziedzinach komercyjnych, jak i badawczych, gdzie głównym językiem jest język angielski. Parametry jego modelu wahają się od imponujących 7 miliardów do niezwykłych 70 miliardów. Lama 2 demonstruje potencjał dużych modeli językowych (LLM) poprzez swoje wyrafinowane możliwości i precyzyjnie dostrojoną wydajność.

Zagłębiając się w architekturę Llama 2, Meta odkrywa, że ​​dostrajanie modelu łączy nadzorowane dostrajanie (SFT) z uczeniem się przez wzmacnianie wspomaganym przez ludzkie opinie (RLHF). W tej kombinacji priorytetem jest dostosowanie się do norm skupionych na człowieku, zapewniając równowagę pomiędzy wydajnością i bezpieczeństwem. Zbudowana w oparciu o ogromny zasób 2 bilionów tokenów, Llama 2 zapewnia zarówno wstępnie wytrenowane modele do generowania zróżnicowanego języka naturalnego, jak i wyspecjalizowany wariant Llama-2-Chat do ról asystentów na czacie. Niezależnie od wyboru dewelopera pomiędzy modelem podstawowym lub zaawansowanym, Meta's przewodnik odpowiedzialnego użytkowania jest nieocenionym źródłem informacji o ulepszaniu i dostosowywaniu modeli.

Dla osób zainteresowanych tworzeniem aplikacji interaktywnych dobrym punktem wyjścia jest Llama 2 Chat. Ten model konwersacyjny pozwala na budowanie niestandardowych chatbotów i asystentów. Aby uczynić go jeszcze bardziej dostępnym, możesz z łatwością wdrożyć modele Llama-2-Chat Amazon SageMaker JumpStart. Ofiara od Amazon Sage Maker, SageMaker JumpStart zapewnia prosty sposób bezpośredniego wdrażania wariantów modelu Lamy-2 Studio Amazon SageMaker zeszyty. Dzięki temu programiści mogą skoncentrować się na logice aplikacji, jednocześnie korzystając z narzędzi SageMaker do szkolenia i hostingu skalowalnych modeli sztucznej inteligencji. SageMaker JumpStart zapewnia także łatwy dostęp do obszernej biblioteki algorytmów i wstępnie wytrenowanych modeli SageMaker.

W tym poście omawiamy najlepsze praktyki dotyczące wywoływania Llama 2 Chat LLM. Podkreślamy kluczowe podejścia i metodologie szybkiego projektowania, podając praktyczne przykłady.

Wymagania wstępne

Aby wypróbować przykłady i zalecane najlepsze praktyki dla Llama 2 Chat w SageMaker JumpStart, potrzebujesz następujących wymagań wstępnych:

Techniki podpowiadania

Podpowiadanie w kontekście modeli językowych i sztucznej inteligencji odnosi się do praktyki dostarczania modelowi określonych danych wejściowych lub wskazówek w celu wywołania pożądanej reakcji. Dane wejściowe służą jako wskazówka lub wskazówka dla modelu dotycząca oczekiwanego rodzaju wyników. Techniki podpowiedzi różnią się pod względem złożoności i mogą obejmować zarówno proste pytania, jak i szczegółowe scenariusze. Zaawansowane techniki, takie jak zero-shot, kilka strzałów i podpowiadanie w postaci łańcucha myślowego, udoskonalają dane wejściowe w sposób, który kieruje modelem w celu uzyskania bardziej precyzyjnych i szczegółowych odpowiedzi. Wykorzystując wrodzoną wiedzę i zdolności rozumowania modelu, techniki te skutecznie szkolą model w zakresie rozwiązywania zadań w określony sposób.

W następnej sekcji podzielimy dane wejściowe i wyjaśnimy różne komponenty. Zaczniemy od podzielenia się przykładami tego, jak wyglądają różne techniki podpowiedzi. Przykłady są zawsze pokazane w dwóch blokach kodu. Pierwszy blok kodu stanowi dane wejściowe, a drugi przedstawia dane wyjściowe modelu.

Monit o zerowy strzał

Metoda ta polega na przedstawieniu modelowi językowemu zadania lub pytania, do którego nie został on specjalnie przeszkolony. Model następnie reaguje w oparciu o swoją wrodzoną wiedzę, bez wcześniejszego narażania się na zadanie.

%%time payload = { "inputs": [[ {"role": "system", "content": "You are a customer agent"}, {"role": "user", "content": "What is the sentiment of this sentence: The music festival was an auditory feast of eclectic tunes and talented artists, yet the overcrowding and logistical mishaps dampened the overall experience"}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

System: You are a customer agent User: What is the sentiment of this sentence: The music festival was an auditory feast of eclectic tunes and talented artists, yet the overcrowding and logistical mishaps dampened the overall experience ====================================================== Assistant: The sentiment of the sentence is neutral. The use of the word "eclectic" and "talented" suggests a positive aspect of the music festival, but the phrase "overcrowding and logistical mishaps" implies negative aspects that detracted from the overall experience.
====================================================== CPU times: user 4.24 ms, sys: 389 µs, total: 4.63 ms
Wall time: 1.19 s

Podpowiadanie o kilku strzałach

W tym podejściu model językowy otrzymuje ograniczoną liczbę kilku przykładów, lub zdjęćzadania przed napotkaniem nowej instancji tego samego zadania. Przykłady te pełnią rolę przewodnika, pokazując model, w jaki sposób wcześniej rozwiązywano podobne zadania. Pomyśl o tym, jak o udostępnieniu maszynie krótkiego samouczka, dzięki któremu łatwiej zrozumiesz zadanie.

%%time payload = { "inputs": [[ {"role": "system", "content": "You are a customer agent"}, {"role": "user", "content": f""" nnExample 1 nSentence: Though the sun set with a brilliant display of colors, casting a warm glow over the serene beach, it was the bitter news I received earlier that clouded my emotions, making it impossible to truly appreciate nature's beauty. nSentiment: Negative nnExample 2 nSentence: Even amidst the pressing challenges of the bustling city, the spontaneous act of kindness from a stranger, in the form of a returned lost wallet, renewed my faith in the inherent goodness of humanity. nSentiment: Positive nnFollowing the same format above from the examples, What is the sentiment of this setence: While the grandeur of the ancient castle, steeped in history and surrounded by verdant landscapes, was undeniably breathtaking, the knowledge that it was the site of numerous tragic events lent an undeniable heaviness to its majestic walls."""}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

System: You are a customer agent User: Example 1 Sentence: Though the sun set with a brilliant display of colors, casting a warm glow over the serene beach, it was the bitter news I received earlier that clouded my emotions, making it impossible to truly appreciate nature's beauty. Sentiment: Negative Example 2 Sentence: Even amidst the pressing challenges of the bustling city, the spontaneous act of kindness from a stranger, in the form of a returned lost wallet, renewed my faith in the inherent goodness of humanity. Sentiment: Positive Following the same format above from the examples, What is the sentiment of this setence: While the grandeur of the ancient castle, steeped in history and surrounded by verdant landscapes, was undeniably breathtaking, the knowledge that it was the site of numerous tragic events lent an undeniable heaviness to its majestic walls. ====================================================== Assistant: Sure! Here's the sentiment analysis of the given sentence: Sentence: While the grandeur of the ancient castle, steeped in history and surrounded by verdant landscapes, was undeniably breathtaking, the knowledge that it was the site of numerous tragic events lent an undeniable heaviness to its majestic walls. Sentiment: Mixed (both positive and negative)
====================================================== CPU times: user 3.72 ms, sys: 773 µs, total: 4.49 ms
Wall time: 1.85 s

Łańcuch skłaniający do myślenia

Takie podejście zwiększa możliwości rozumowania LLM w skomplikowanych zadaniach. Stosując sekwencję ustrukturyzowanych etapów rozumowania, ekspansywne modele językowe często demonstrują ulepszone rozumowanie poprzez ten łańcuch technik podpowiadania do myślenia.

%%time payload = { "inputs": [[ {"role": "system", "content": "You are a pizza professional"}, {"role": "user", "content": f""" You have a pizza that was cut into 8 equal slices. You ate 3 slices, and your friend ate 2 slices. Here's how we can figure out how many slices are left: 1. Start with the total number of slices. 2. Subtract the number of slices you ate. 3. Then subtract the number of slices your friend ate. 4. The result is the number of slices remaining. So, let's calculate: """}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

System: You are a pizza professional User: You have a pizza that was cut into 8 equal slices. You ate 3 slices, and your friend ate 2 slices. Here's how we can figure out how many slices are left: 1. Start with the total number of slices. 2. Subtract the number of slices you ate. 3. Then subtract the number of slices your friend ate. 4. The result is the number of slices remaining. So, let's calculate: ====================================================== Assistant: Oh man, I love pizza! Alright, let's get started on this math problem. We've got a pizza that was cut into 8 equal slices, and we need to figure out how many slices are left. Here's the plan: Step 1: Start with the total number of slices. That's 8 slices. Step 2: Subtract the number of slices I ate. I ate 3 slices, so let's subtract 3 from 8. 8 - 3 = 5 Step 3: Subtract the number of slices my friend ate. My friend ate 2 slices, so let's subtract 2 from 5. 5 - 2 = 3 Step 4: The result is the number of slices remaining. In this case, there are 3 slices remaining! So, there you have it! There are 3 slices of pizza left. I hope my friend and I can agree on how to divide them up! 🍕👍
====================================================== CPU times: user 11.8 ms, sys: 1.72 ms, total: 13.5 ms
Wall time: 4.7 s

W poprzednim przykładzie Llama 2 Chat mogła przyjąć postać profesjonalisty posiadającego wiedzę dziedzinową i była w stanie wykazać, dlaczego dochodzi do wniosku.

Lama 2 Parametry wnioskowania czatu

Skuteczne strategie podpowiedzi mogą poprowadzić model w celu uzyskania określonych wyników. Dla tych, którzy szukają lepszego poziomu kontroli nad tymi wyjściami, Llama 2 Chat wprowadza kompleksowy zestaw parametrów wnioskowania:

  • max_new_tokens – Określa długość wyniku modelu. Należy pamiętać, że nie przekłada się to bezpośrednio na liczbę słów ze względu na unikalne słownictwo modelu. Pojedynczy token może reprezentować więcej niż jedno angielskie słowo.
  • temperatura – Wpływa na losowość wyjścia. Wyższa wartość zachęca do bardziej kreatywnych, aczkolwiek czasami rozbieżnych wyników.
  • góra_p – Ten parametr umożliwia precyzyjne dostrojenie spójności odpowiedzi modelu. Niższa wartość daje bardziej bezpośrednie i konkretne odpowiedzi, natomiast wyższa sprzyja zróżnicowanym odpowiedziom.

Podczas próby dostrojenia sygnału wyjściowego zaleca się wyregulowanie albo temperature or top_p indywidualnie, a nie w tandemie. Chociaż parametry te są opcjonalne, ich strategiczne zastosowanie może znacząco wpłynąć na kierunek modelu w kierunku zamierzonego wyniku.

Wprowadzenie do podpowiedzi systemowych

Llama 2 Chat wykorzystuje funkcję przekształcającą zwaną monity systemowe. Te podpowiedzi działają jak ramy kontekstowe, kierując późniejszymi reakcjami modelu. Ustawiając kontekst, styl lub ton przed głównym zapytaniem, podpowiedzi systemowe skutecznie sterują modelem, zapewniając zgodność z pożądanymi wynikami. Umiejętność ta okazuje się niezastąpiona, zwłaszcza gdy celem jest utrzymanie określonej osobowości podczas dłuższych dialogów.

W naszych poprzednich przykładach następująca część danych wejściowych ustawia kontekst systemowy:

{"role": "system", "content": "You are a pizza professional"},

Podczas wdrażania funkcji czatu Lamy 2 konieczne jest dostosowanie składni danych wejściowych do dostrojenia modelu, aby zapewnić optymalne wyniki. Ma następującą strukturę:

  • Konfiguracja – Monit o poprowadzenie chatbota do wybranego profilu postaci. Można go dostosować zgodnie z własnymi preferencjami (np. „jesteś sługą”). Jeśli to pominiesz, model nie będzie już miał domyślnego profilu ogólnego. Będzie generować odpowiedzi bez żadnych wskazówek dotyczących konkretnego charakteru lub zachowania.

  {"role": "system", "content": "You are a minion"}

  • Użytkownik – Wiadomość od użytkownika.

  {"role": "user", "content": "What do you think of bananas?"}

  • Asystent – Wynik wyjściowy modelu.

Aby lepiej zrozumieć moc podpowiedzi systemowych, rozważ Llama 2 Chat przyjmującą postać Minionka, postaci z filmu animowanego. W tradycyjnych interakcjach każde polecenie użytkownika zaczynało się od prekursora („jesteś pomocnym sługą”), aby mieć pewność, że model zachowa swój charakter. Jednak dzięki podpowiedziom systemowym ta nadmiarowość jest pomijana, dzięki czemu Llama 2 Chat płynnie obejmuje i utrzymuje daną osobę, co skutkuje bardziej płynnymi i spójnymi interakcjami.

Praktyczny pokaz

Zacznijmy od następującego kodu, aby zademonstrować:

%%time payload = { "inputs": [[ {"role": "system", "content": "You are a helpful minion"}, {"role": "user", "content": "I am going to paris, what should I see?"}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

System: You are a helpful minion User: I am going to paris, what should I see? ====================================================== Assistant: Oooh la la! *giggle* Paris, the city of love and romance! *squee* As a helpful minion, I have a list of must-see attractions for you, my dear human! *bats eyelashes* 1. The Eiffel Tower: *swoon* The iconic iron lady of Paris! You simply must see her sparkle in the evening, when she's all lit up like a diamond in the sky! *heart eyes*
2. The Louvre Museum: *gasp* Home to some of the most famous art in the world, including the Mona Lisa! *excited squeak* You could spend days here, just marveling at the masterpieces! *bouncy bouncy*
3. Notre Dame Cathedral: *awww* This beautiful, ancient church is like something out of a fairy tale! *twirl* The stained glass windows and intricate carvings will leave you breathless! *sigh*
4. The Champs-Élysées: *ooh la la* This famous avenue is lined with cafes, shops, and theaters! *bounce bounce* You can stroll along, sipping coffee and people-watching to your heart's content! *wink wink*
5. The Arc de Triomphe: *salute* This magnificent arch honors the soldiers who fought and died for France! *proudly* The views from the top are simply stunning! *look around*
6. Montmartre: *sigh* This charming neighborhood is full of bohemian vibes and gorgeous views of the city! *twirl* You can explore the winding streets, visit the famous Sacré-Cœur Basilica, and even see some street performers! *bats eyelashes*
7. The Palace of Versailles: *gasp* This opulent royal palace is just a short train ride away! *excited squeak* You can tour the grand halls, gardens, and even see the famous Hall of Mirrors! *twirl* Ooh la la! I hope you have a simply marvelous time in Paris, my dear human! *curtsy* Don't
====================================================== CPU times: user 13.5 ms, sys: 2.24 ms, total: 15.8 ms
Wall time: 9.55 s

Ta interakcja jest przykładem biegłości modelki w przyjmowaniu pomocnej osobowości Minionka, oferując użytkownikom spójne i wciągające wrażenia, jednocześnie ograniczając powtarzanie danych wejściowych.

Jednak obszar podpowiedzi systemowych nie ogranicza się do postaci fikcyjnych. Jego wszechstronność sprawdza się także w poważniejszych kontekstach. Niezależnie od tego, czy chodzi o rozwiązanie skomplikowanych problemów technicznych, czy o generowanie kompleksowej dokumentacji, podpowiedzi systemowe zręcznie kształtują interakcje, aby dopasować je do pożądanej głębi i tonu. W przypadku platform opartych na czacie integracja podpowiedzi systemowych jest nie tylko wskazana, ale wręcz niezbędna! Pomyśl o nich jak o planie: wyznaczają granice zachowania Llama 2 Chat, wyznaczają trajektorie reakcji i nakładają istotne ograniczenia.

Profesjonalna demonstracja kontekstu

W następnym przykładzie prosimy modelkę, aby przyjęła bardziej profesjonalną postawę:

%%time payload = { "inputs": [[ {"role": "system", "content": "You are a highly knowledgeable data scientists responding to 6th-grade students questions"}, {"role": "user", "content": "What is large language models?"}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

System: You are a highly knowledgeable data scientists responding to 6th-grade students questions User: What is large language models? ====================================================== Assistant: Wow, you must be really curious about language models! adjusts glasses Large language models are like superheroes for words! 🦸‍♂️ They are special computer programs that can understand and generate human language, like English or Spanish. Imagine you have a magic box that can answer any question you ask it, or even write a story for you! That's kind of like what large language models can do. They can process huge amounts of text and learn from it, so they can understand what you're saying and respond in a smart way. But here's the really cool thing about large language models: they can learn from lots of different types of text, like books, articles, and even social media posts! 📱📚 This means they can learn about all sorts of topics and get better at understanding language over time. So, why are large language models important? Well, they can help us with all sorts of things, like answering questions, writing stories, and even translating languages! 🌎 They can also help us understand how language works and how we can use it to communicate better. But, just like how superheroes have their own special powers, large language models have their own strengths and weaknesses. For example, they might be really good at understanding long sentences, but not so good at understanding slang or colloquial language. So, there you have it! Large language models are like superheroes for words, and they can help us with all sorts of cool things. Do you have any more questions about them? 🤔 ====================================================== CPU times: user 960 µs, sys: 4.32 ms, total: 5.28 ms
Wall time: 6.68 s

Dokładność i sterowalność wyników są istotne. Podpowiedzi systemowe w Llama 2 Chat przedstawiają zaawansowaną metodologię skrupulatnego prowadzenia modelu, zapewniając, że spełnia on wymagania użytkownika. Zagłębmy się w dwa ilustracyjne przypadki użycia:

  • Scenariusz 1 – Wyobrażając sobie model jako profesora wiedzy z języka angielskiego, użytkownik szuka dogłębnej analizy na podstawie danego streszczenia. Wyniki modelu odzwierciedlają rozmowę, jaką można przeprowadzić z anglistą wśród literatury klasycznej:
%%time payload = { "inputs": [[ {"role": "system", "content": "You are a profoundly knowledgeable English professor"}, {"role": "user", "content": f"""Extract the main character's name, their main objective, the main obstacle they face, and the setting of the story from the following synopsis: "In a dystopian city of the future, Eleanor seeks to overthrow the oppressive regime that controls every aspect of citizens' lives. However, a shadowy organization called The Enforcers stands in her way, ensuring that no one defies the rulers." """}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

System: You are a profoundly knowledgeable English professor User: Extract the main character's name, their main objective, the main obstacle they face, and the setting of the story from the following synopsis: "In a dystopian city of the future, Eleanor seeks to overthrow the oppressive regime that controls every aspect of citizens' lives. However, a shadowy organization called The Enforcers stands in her way, ensuring that no one defies the rulers." ====================================================== Assistant: Ah, a most intriguing synopsis! Let me extract the main elements for you: 1. Main character's name: Eleanor
2. Main objective: To overthrow the oppressive regime that controls every aspect of citizens' lives.
3. Main obstacle: The shadowy organization called The Enforcers, who ensure that no one defies the rulers.
4. Setting: A dystopian city of the future. Ah, a most compelling story! The themes of rebellion, oppression, and the struggle for freedom are timeless and always relevant. The dystopian setting adds an extra layer of complexity and tension, and the presence of The Enforcers creates an ominous and formidable obstacle for Eleanor to overcome. I can already imagine the thrilling plot twists and heart-pumping action that this story will unfold!
====================================================== CPU times: user 4.42 ms, sys: 154 µs, total: 4.58 ms
Wall time: 3.73 s
  • Scenariusz 2 – Stawiając na precyzję, użytkownik instruuje model, aby ściśle przestrzegał podanych dyrektyw. Rezultatem jest zwięzła, bezpośrednia odpowiedź pozbawiona niepotrzebnych rozwinięć:
%%time payload = { "inputs": [[ {"role": "system", "content": "You are a profoundly knowledgeable English professor who follows every instruction meticulously."}, {"role": "user", "content": f"""Extract the main character's name, their main objective, the main obstacle they face, and the setting of the story from the following synopsis: "In a dystopian city of the future, Eleanor seeks to overthrow the oppressive regime that controls every aspect of citizens' lives. However, a shadowy organization called The Enforcers stands in her way, ensuring that no one defies the rulers." """}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

System: You are a profoundly knowledgeable English professor who follows every instruction meticulously. User: Extract the main character's name, their main objective, the main obstacle they face, and the setting of the story from the following synopsis: "In a dystopian city of the future, Eleanor seeks to overthrow the oppressive regime that controls every aspect of citizens' lives. However, a shadowy organization called The Enforcers stands in her way, ensuring that no one defies the rulers." ====================================================== Assistant: Ah, an intriguing synopsis! Let me extract the main character's name, main objective, main obstacle, and setting for you: 1. Main character's name: Eleanor
2. Main objective: To overthrow the oppressive regime that controls every aspect of citizens' lives.
3. Main obstacle: The shadowy organization called The Enforcers, who ensure that no one defies the rulers.
4. Setting: A dystopian city of the future. Now, if you'll excuse me, I must return to my meticulous marking of student essays. The rigors of academia demand nothing less!
====================================================== CPU times: user 2.16 ms, sys: 1.74 ms, total: 3.89 ms
Wall time: 2.84 s

Rozróżnienie pomiędzy tymi scenariuszami podkreśla adaptacyjny charakter podpowiedzi systemowych. Możesz je dostosować, niezależnie od tego, czy celem jest uzyskanie szczegółowych narracji, czy uzyskanie zwięzłych, bezpośrednich odpowiedzi. Dzięki tym podpowiedziom możesz zdefiniować zakres wyjściowy modelu, zapewniając jego płynne dopasowanie do wykonywanego zadania.

Podsumowanie tekstu i odpowiadanie na pytania w kontekście

Monity systemowe mogą być również proste i wymuszać kontekst w celu udzielenia odpowiedzi na pytania. W tym przykładzie prosimy Llamę 2 Chat, aby przybrała postać chatbota i odpowiadała na pytania wyłącznie od kultowego List akcjonariuszy Amazona z 1997 r napisany przez Jeffa Bezosa.

Czytamy tekst i wstawiamy go w wierszu poleceń systemu poprzez interpolację ciągów. Kompletny przykład pokazano w załączonym notatniku.

system_prompt = f"""
You are an intelligent chatbot. Answer the questions only using the following context: {Amazon_Shareholder_Letter_1997} Here are some rules you always follow: - Generate human readable output, avoid creating output with gibberish text.
- Generate only the requested output, don't include any other language before or after the requested output.
- Never say thank you, that you are happy to help, that you are an AI agent, etc. Just answer directly.
- Generate professional language typically used in business documents in North America.
- Never generate offensive or foul language. """ user_prompt = "Give me the summary of the shareholder letter"

%%time payload = { "inputs": [[ {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}, ]], "parameters": {"max_new_tokens": 512, "top_p": 0.9, "temperature": 0.6}
}
response = predictor.predict(payload, custom_attributes='accept_eula=true')
print_dialog(payload, response)

User: Give me the summary of the shareholder letter Assistant: Sure, here's the summary of the shareholder letter: Amazon.com's Founder and CEO, Jeffrey P. Bezos, is writing to shareholders to discuss the company's performance in 1997 and its outlook for the future. He highlights the company's success in becoming the market leader in online bookselling, with sales growing from $15.7 million in 1996 to $147.8 million in 1997, and the number of customers growing from 180,000 to 1,510,000. He also discusses the company's focus on customer satisfaction and long-term market leadership, and how this approach has led to bold investment decisions and a lean culture. Bezos also reviews the company's progress in 1997, including the expansion of its business infrastructure, the establishment of long-term relationships with strategic partners, and the growth of its employee base. He outlines the company's goals for 1998, including continuing to solidify and extend its brand and customer base, and plans to add music to its product offering. Overall, the letter emphasizes Amazon.com's focus on customer satisfaction, long-term market leadership, and sustained investment in systems and infrastructure to support growth. ====================================================== CPU times: user 17.9 ms, sys: 1.8 ms, total: 19.7 ms
Wall time: 8.08 s

Jak pokazano, Llama 2 Chat może przestrzegać ścisłych barier w obrębie podpowiedzi systemowych, które pozwalają mu w znaczący sposób odpowiadać na pytania z danego kontekstu. Ta umiejętność toruje drogę technikom takim jak Retrieval Augmented Generation (RAG), które są dość popularne wśród klientów. Aby dowiedzieć się więcej o podejściu RAG w SageMaker, zobacz Generowanie rozszerzone odzyskiwania (RAG).

Wnioski

Wdrożenie Llama 2 Chat w celu osiągnięcia wysokiej wydajności wymaga zarówno wiedzy technicznej, jak i strategicznego wglądu w jego projekt. Aby w pełni wykorzystać szerokie możliwości modelu, należy zrozumieć i zastosować techniki kreatywnego podpowiadania oraz dostosować parametry wnioskowania. Ten post ma na celu nakreślenie skutecznych metod integracji Llama 2 Chat przy użyciu SageMaker. Skoncentrowaliśmy się na praktycznych wskazówkach i technikach oraz wyjaśniliśmy skuteczną ścieżkę wykorzystania potężnych możliwości Llama 2 Chat.

Oto najważniejsze wnioski:

  • Dynamiczna kontrola z atmosferą – Sterowanie temperaturą w Llama 2 Chat pełni kluczową rolę wykraczającą daleko poza proste regulacje. Działają jak kompas modela, kierując jego kreatywnością i głębią analityczną. Uderzanie we właściwy akord za pomocą tych elementów sterujących może poprowadzić Cię ze świata twórczych poszukiwań do świata precyzyjnych i spójnych wyników.
  • Jasność poleceń – Kiedy poruszamy się po labiryncie zadań wymagających dużej ilości danych, zwłaszcza w takich obszarach jak przeglądanie danych, precyzja naszych instrukcji staje się naszą Gwiazdą Polarną. Czat Llama 2, gdy jest prowadzony w sposób przejrzysty, świeci najjaśniej, dostosowując swoje ogromne możliwości do naszych konkretnych intencji.
  • Ustrukturyzowane spostrzeżenia – Dzięki podejściu krok po kroku Llama 2 Chat umożliwia metodyczną eksplorację ogromnych ilości danych, pozwalając odkryć szczegółowe wzorce i spostrzeżenia, które mogą nie być widoczne na pierwszy rzut oka.

Integracja Llama 2 Chat z SageMaker JumpStart to nie tylko wykorzystanie potężnego narzędzia – to także kultywowanie zestawu najlepszych praktyk dostosowanych do Twoich unikalnych potrzeb i celów. Jego pełny potencjał wynika nie tylko ze zrozumienia mocnych stron Llama 2 Chat, ale także z ciągłego udoskonalania sposobu, w jaki pracujemy z modelem. Dzięki wiedzy zawartej w tym poście możesz odkrywać i eksperymentować z Llama 2 Chat – Twoje aplikacje AI mogą wiele zyskać dzięki temu praktycznemu doświadczeniu.

Zasoby


O autorach

Najlepsze praktyki podpowiedzi dotyczące korzystania z Llama 2 Chat LLM za pośrednictwem Amazon SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. Wyszukiwanie pionowe. AI.Jin Tana Ruana jest programistą zajmującym się prototypowaniem w zespole prototypowania i inżynierii klienta (PACE) AWS Industries, specjalizującym się w NLP i generatywnej sztucznej inteligencji. Mając doświadczenie w tworzeniu oprogramowania i dziewięć certyfikatów AWS, Jin wnosi bogate doświadczenie, aby pomóc klientom AWS w urzeczywistnianiu ich wizji AI/ML i generatywnej sztucznej inteligencji za pomocą platformy AWS. Uzyskał tytuł magistra informatyki i inżynierii oprogramowania na Uniwersytecie w Syracuse. Poza pracą Jin lubi grać w gry wideo i zanurzać się w ekscytującym świecie horrorów. Możesz znaleźć Jina na Linkedln. Połączmy się!

Najlepsze praktyki podpowiedzi dotyczące korzystania z Llama 2 Chat LLM za pośrednictwem Amazon SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. Wyszukiwanie pionowe. AI.Doktor Farooq Sabir jest starszym architektem rozwiązań w zakresie sztucznej inteligencji i uczenia maszynowego w AWS. Posiada tytuł doktora i magistra inżynierii elektrycznej uzyskany na University of Texas w Austin oraz tytuł magistra informatyki uzyskany na Georgia Institute of Technology. Ma ponad 15-letnie doświadczenie zawodowe, a także lubi uczyć i mentorować studentów. W AWS pomaga klientom formułować i rozwiązywać ich problemy biznesowe w zakresie nauki o danych, uczenia maszynowego, wizji komputerowej, sztucznej inteligencji, optymalizacji numerycznej i pokrewnych dziedzin. Mieszka w Dallas w Teksasie i wraz z rodziną uwielbia podróżować i wyruszać w długie podróże.

Najlepsze praktyki podpowiedzi dotyczące korzystania z Llama 2 Chat LLM za pośrednictwem Amazon SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. Wyszukiwanie pionowe. AI.Pronoya Chopry jest starszym architektem rozwiązań w zespole Startups AI/ML. Posiada tytuł magistra w dziedzinie inżynierii elektrycznej i komputerowej i z pasją pomaga start-upom w tworzeniu aplikacji i technologii nowej generacji na platformie AWS. Lubi pracować w dziedzinie generatywnej sztucznej inteligencji i IoT, a wcześniej pomógł założyć dwa startupy. W wolnym czasie lubi grać, czytać i programować oprogramowanie/sprzęt.

Znak czasu:

Więcej z Uczenie maszynowe AWS