AWS Certified AI Practitioner(16) - Prompt Engineering Techniques
๐ฏ Prompt Engineering TechniquesUnderstanding different prompting techniques is essential for getting the most out of Large Language Models (LLMs). These concepts are also important for AWS certification exams, especially when dealing with Amazon Bedrock and generative AI. 1. ๐น Zero-Shot PromptingDefinition:Present a task to the model without providing any examples or prior training for that specific task. Prompt Example: 1Write a short story about a dog that helps solve a mystery. Respons...
AWS Certified AI Practitioner(15) - LLM Text Generation & Prompt Optimizatio
๐ค LLM Text Generation & Prompt Optimization1. How Text is Generated in an LLMWhen a model generates text, it predicts the next word based on probabilities. Example:โAfter the rain, the streets wereโฆโPossible next words and probabilities: wet (0.40) flooded (0.25) slippery (0.15) empty (0.10) muddy (0.05) clean (0.03) blocked (0.02) The model randomly selects a word according to these probabilities. 2. Prompt Performance Optimization๐น System Prompts Define how the mode...
(ํ๊ตญ์ด) AWS Certified AI Practitioner (15) - LLM์์ ํ
์คํธ ์์ฑ ๊ณผ์ & ํ๋กฌํํธ ์ต์ ํ
๐ LLM์์ ํ
์คํธ ์์ฑ ๊ณผ์ & ํ๋กฌํํธ ์ต์ ํ1๏ธโฃ ํ
์คํธ ์์ฑ ์๋ฆฌLLM(๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ)์ ๋ค์ ๋จ์ด๊ฐ ๋ฌด์์ผ์ง ํ๋ฅ ์ ์ผ๋ก ๊ณ์ฐํด์ ๋ฌธ์ฅ์ ๋ง๋ค์ด ๊ฐ๋๋ค.์๋ฅผ ๋ค์ด,โAfter the rain, the streets were โฆโ ๋ค์ ์ฌ ์ ์๋ ํ๋ณด ๋จ์ด์ ํ๋ฅ ์ด ์๋ค๊ณ ํ ๋: wet (0.40) flooded (0.25) slippery (0.15) empty (0.10) muddy (0.05) ๋ชจ๋ธ์ ์ด ํ๋ฅ ์ ๊ธฐ๋ฐ์ผ๋ก ๋ฌด์์ ์ ํ(random sampling) ํ์ฌ ๋ค์ ๋จ์ด๋ฅผ ์์ฑํฉ๋๋ค.์ฆ, LLM์ ์ถ๋ ฅ์ ํญ์ ํ๋ฅ ์ ์ด๋ฏ๋ก, ๊ฐ์ ์ง๋ฌธ์ ์ฌ๋ฌ ๋ฒ ํด๋ ๊ฒฐ๊ณผ๊ฐ ์กฐ๊ธ์ฉ ๋ฌ๋ผ์ง ์ ์์ต๋๋ค. 2๏ธโฃ ํ๋กฌํํธ ์ฑ๋ฅ ์ต์ ํ (Prompt Performance Optimization)Amazon Bedrock ๊ฐ์ ์๋น์ค์์๋ ์ถ๋ ฅ ํ์ง์ ์กฐ์ ํ ์ ์๋ ์ฌ๋ฌ ํ๋ผ๋ฏธํฐ๋ฅผ ์ ๊ณตํฉ๋๋ค. ๐น System Prompt ๋ชจ๋ธ์ด ์ด๋ค ์ญํ ์ ํด...
AWS Certified AI Practitioner(14) - Prompt Engineering
๐ Prompt EngineeringWhat is Prompt Engineering?Prompt Engineering is the process of designing, refining, andoptimizing prompts to guide a foundation model (FM) or large languagemodel (LLM) toward producing the best possible output for your needs. A naรฏve prompt gives little guidance and leaves interpretation up tothe model.Example: โSummarize what is AWS.โThis works, but the answer may not be clear or focused. By contrast, Prompt Engineering uses a structured approach toimprove results. Com...
(ํ๊ตญ์ด) AWS Certified AI Practitioner (14) - ํ๋กฌํํธ ์์ง๋์ด๋ง
๐ ํ๋กฌํํธ ์์ง๋์ด๋ง (Prompt Engineering)ํ๋กฌํํธ ์์ง๋์ด๋ง์ AI ๋ชจ๋ธ์ด ๋ ์ ํํ๊ณ ์ํ๋ ๋ต๋ณ์ ๋ด๋๋ก ์ง๋ฌธ(ํ๋กฌํํธ)์ ์ค๊ณํ๊ณ ์ต์ ํํ๋ ๊ธฐ์ ์ ๋งํฉ๋๋ค.๋จ์ํ โAWS๋ฅผ ์์ฝํด์คโ ๊ฐ์ ์ง๋ฌธ์ ๋์ง๋ ๊ฒ๋ณด๋ค, ๊ตฌ์ฒด์ ์ผ๋ก ์ง์, ๋งฅ๋ฝ, ์
๋ ฅ ๋ฐ์ดํฐ, ์ถ๋ ฅ ํ์์ ํฌํจํ๋ฉด ํจ์ฌ ์ข์ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์ต๋๋ค. 1. ๊ธฐ๋ณธ ๊ฐ๋
(Naรฏve Prompt vs. ๊ฐ์ ๋ Prompt) Naรฏve Prompt (๋จ์ ํ๋กฌํํธ)์: โAWS๋ฅผ ์์ฝํด์ค.โ๐ ๋ชจ๋ธ์ด ์์์ ๋ตํ๊ธด ํ์ง๋ง, ์ํ๋ ์์ค์ ๋ต๋ณ์ด ์๋ ์ ์์. Prompt Engineering (ํ๋กฌํํธ ์์ง๋์ด๋ง)๐ ํ๋กฌํํธ๋ฅผ ์ค๊ณํ๊ณ ๊ฐ์ ํ์ฌ ์ํ๋ ๋ต๋ณ์ ์ป๋ ๋ฐฉ๋ฒ.๐ 4๊ฐ์ง ํต์ฌ ์์: Instructions (์ง์์ฌํญ) โ ๋ชจ๋ธ์ด ์ด๋ค ์ผ์ ํด์ผ ํ๋์ง (์: โ์์ฝ๋ฌธ ์์ฑโ) Context (๋งฅ๋ฝ) โ ๋ชจ๋ธ์ด ์ฐธ๊ณ ํ ์ถ๊ฐ ์ ๋ณด (์: โAWS ์ด๋ณด์๋ฅผ ๊ฐ๋ฅด์น๋ ์ํฉโ) ...
AWS Certified AI Practitioner(13) - End-to-End Use Case (AI Stylist Demo)
๐ Amazon Bedrock End-to-End Use Case (AI Stylist Demo)๐ Why This Demo MattersSo far, weโve explored many features of Amazon Bedrock. But in reality, using Bedrock isnโt just about clicking around in the console.To build a real-world application, you need to make API calls to Bedrock and integrate those capabilities directly into your service. To demonstrate this, AWS provides an AI Stylist demo application.This demo shows how end users actually experience an application built on top of Be...
(ํ๊ตญ์ด) AWS Certified AI Practitioner (13) - AI Stylist Demo
๐ Amazon Bedrock End-to-End Use Case (AI Stylist Demo)๐ ์ ์ด ๋ฐ๋ชจ๊ฐ ์ค์ํ๊ฐ?์์์ Amazon Bedrock์ ์ฌ๋ฌ ๊ธฐ๋ฅ์ ์ดํด๋ดค์ง๋ง, ์ค์ ๋ก๋ ์ฝ์์์ ํด๋ฆญ๋ง ํ๋ ๊ฒ์ผ๋ก ๋๋์ง ์์ต๋๋ค.์ค์ ์ ํ๋ฆฌ์ผ์ด์
์์ Bedrock์ ํ์ฉํ๋ ค๋ฉด API ํธ์ถ์ ํตํด Bedrock ๊ธฐ๋ฅ์ ๋ถ๋ฌ์ค๊ณ , ์ด๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ์๋น์ค๋ฅผ ๋ง๋ค์ด์ผ ํฉ๋๋ค. AWS์์๋ ์ด๋ฅผ ๋ณด์ฌ์ฃผ๊ธฐ ์ํด AI Stylist๋ผ๋ ๋ฐ๋ชจ ์ ํ๋ฆฌ์ผ์ด์
์ ์ ๊ณตํฉ๋๋ค.์ด ๋ฐ๋ชจ๋ฅผ ํตํด ์ค์ ์ฌ์ฉ์๊ฐ ์ด๋ป๊ฒ Bedrock ๊ธฐ๋ฐ ์ฑ์ ๊ฒฝํํ๋์ง ํ์ธํ ์ ์์ต๋๋ค. ๐ Try the AI Stylist Demo ๐ Demo Video: Your browser does not support the video tag. ๐ AI Stylist ๋์ ๋ฐฉ์ ์ฌ์ฉ์๊ฐ ์ง๋ฌธ์ ์
๋ ฅํฉ๋๋ค. ์: โ์ ๋ ์ปจ์คํดํธ์ธ๋ฐ, ๋ค์ ์ฃผ ๋ด์ ์ถ์ฅ์ ๊ฐ๋๋ฐ ์ฒซ ์ถ๊ทผ ๋ ๋ฌด์จ...
(ํ๊ตญ์ด) AWS Certified AI Practitioner (11) - CloudWatch
๐ Amazon Bedrock & CloudWatch๐ CloudWatch๋?Amazon CloudWatch๋ AWS ๋ฆฌ์์ค์ ์ ํ๋ฆฌ์ผ์ด์
์ ๋ชจ๋ํฐ๋งํ๋ ์๋น์ค์
๋๋ค.CloudWatch๋ ๋ค์๊ณผ ๊ฐ์ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค: Logs (๋ก๊ทธ) โ ์ด๋ฒคํธ๋ ์์ฒญ ๋ด์ญ์ ๊ธฐ๋ก (๋๋ฒ๊น
์ ์ ์ฉ) Metrics (์งํ) โ ์์คํ
์ฑ๋ฅ์ ์์น๋ก ๋ชจ๋ํฐ๋ง Alarms (์๋) โ ํน์ ๊ธฐ์ค์ ๋์์ ๋ ์๋ฆผ ์ ์ก Dashboards (๋์๋ณด๋) โ ๋ชจ๋ํฐ๋ง ์ ๋ณด๋ฅผ ์๊ฐํ ๐ ์ํ์ ์์ฃผ ๋์ค๋ ํฌ์ธํธ: CloudWatch Logs: ์ด๋ฒคํธยท๋ก๊ทธ ๊ธฐ๋ก CloudWatch Metrics: CPU, ๋ฉ๋ชจ๋ฆฌ, ์ง์ฐ ์๊ฐ ๊ฐ์ ์ฑ๋ฅ ์์น CloudWatch Alarms: ๊ธฐ์ค์น ์ด๊ณผ ์ ์๋ฆผ CloudWatch Dashboards: ๋ชจ๋ํฐ๋ง ๊ฒฐ๊ณผ ์๊ฐํ ๐ Bedrock + CloudWatch ์ฐ๋1. ๋ชจ๋ธ ํธ์ถ(Invocation) ๋ก๊น
Bedrock...
(ํ๊ตญ์ด) AWS Certified AI Practitioner (10) - Agents (์์ด์ ํธ)
๐ค Amazon Bedrock โ Agents (์์ด์ ํธ)๐ ์์ด์ ํธ๋?Amazon Bedrock์ ์์ด์ ํธ(Agents) ๋ ๋จ์ํ ์ง๋ฌธ์ ๋ต๋ณํ๋ ๋ชจ๋ธ์ด ์๋๋ผ, ์ฌ๋ฌ ๋จ๊ณ๋ฅผ ๊ณํํ๊ณ ์คํํ ์ ์๋ ๊ณ ๊ธ ๊ธฐ๋ฅ์
๋๋ค.์ฆ, ์ฌ๋์ด โ์๊ฐํ๊ณ โ ๊ณํํ๊ณ โ ํ๋ํ๋โ ๊ณผ์ ์ ํ๋ด ๋ด์ ์ค์ ์์
๊น์ง ์๋์ผ๋ก ์ํํ ์ ์์ต๋๋ค. ์์ด์ ํธ๋ ๋จ์ ํ
์คํธ ์์ฑ ์ธ์๋ ๋ค์๊ณผ ๊ฐ์ ์ผ์ ํ ์ ์์ต๋๋ค: AWS ์ธํ๋ผ ์์ฑ (์๋ฒ, S3, Lambda ๋ฑ) ์ ํ๋ฆฌ์ผ์ด์
๋ฐฐํฌ ์๋ํ ๋ฐ์ดํฐ๋ฒ ์ด์ค/์์คํ
์์
์ํ ์ธ๋ถ API ๋ฐ ์ฌ๋ด ์์คํ
์ฐ๋ ๐ Bedrock Agents ์ฃผ์ ํน์ง ๋ฉํฐ์คํ
์์
์คํ: ๋จ์ ์ง์์๋ต์ด ์๋๋ผ, ์ฌ๋ฌ ๋จ๊ณ๋ฅผ ๊ฑฐ์ณ ๋ณต์กํ ์
๋ฌด๋ฅผ ์ํ ์์
์์ ์ ์ด: ๊ฐ ๋จ๊ณ๊ฐ ์ฌ๋ฐ๋ฅธ ์์๋ก ์คํ๋๊ณ , ๋ฐ์ดํฐ๊ฐ ๋จ๊ณ ๊ฐ ์ ์ ๋ฌ๋จ ์ก์
๊ทธ๋ฃน(Action Groups): API, Lambda ํจ์ ๋ฑ ๋ฏธ๋ฆฌ ์ ์๋ ์์
๋จ์๋ฅผ ์ฌ์ฉ ...
(ํ๊ตญ์ด) AWS Certified AI Practitioner (9) - Guardrails (๊ฐ๋๋ ์ผ)
๐ก๏ธ Amazon Bedrock โ Guardrails (๊ฐ๋๋ ์ผ)๐ Guardrails๋ ๋ฌด์์ธ๊ฐ?Amazon Bedrock์ Guardrails(๊ฐ๋๋ ์ผ) ์ ์ฌ์ฉ์๊ฐ ์
๋ ฅํ ๋ด์ฉ๊ณผ ๋ชจ๋ธ์ด ์์ฑํ๋ ๋ต๋ณ์ ํํฐ๋งํ๊ณ ์ ์ดํ๋ ์์ ์ฅ์น์
๋๋ค.์ฆ, AI๊ฐ ์๋ชป๋ ๋ต๋ณ์ด๋ ์ํํ ๋ด์ฉ์ ๋ด๋์ง ์๋๋ก ๋ณดํธ๋ง ์ญํ ์ ํฉ๋๋ค. ๐ Guardrails ์ฃผ์ ๊ธฐ๋ฅ ์ ํด ์ฝํ
์ธ ์ฐจ๋จ์์ค, ํ์ค ํํ, ์ฑ์ ์ธ ๋ด์ฉ, ํญ๋ ฅ์ ์ธ ๋ด์ฉ ๋ฑ์ ์๋์ผ๋ก ์ฐจ๋จ ํน์ ์ฃผ์ ์ ํ๋ฏผ๊ฐํ๊ฑฐ๋ ํ์ฉํ์ง ์์ ์ฃผ์ (์: ์๋ฃ ์กฐ์ธ, ๋ฒ๋ฅ ์๋ด, ๋ ์ํผ ๋ฑ)๋ ๋ต๋ณํ์ง ์๋๋ก ์ค์ ๊ฐ์ธ์ ๋ณด ๋ณดํธ(PII)์ด๋ฉ์ผ, ์ ํ๋ฒํธ, ์ฃผ์ ๊ฐ์ ๊ฐ์ธ์ ๋ณด๋ฅผ ์๋ ๊ฐ์ง ํ ๋ง์คํน ์ฒ๋ฆฌ ํ๊ฐ(Hallucination) ์ค์ด๊ธฐ๋ชจ๋ธ์ด ๊ทผ๊ฑฐ ์๋ ๋ต๋ณ์ ํ์ง ์๋๋ก ๋งฅ๋ฝ ๊ธฐ๋ฐ ์ฌ์ค ํ์ธ(grounding) ์ ์ฉ ๊ธ์ง์ด(Word Filter)์ง์ ์ ์ํ ํน์ ๋จ์ดยท๋ฌธ๊ตฌ๋ฅผ ์ฐจ๋จ ์ ๊ท์(Regex) ํํฐ์: ์ ์ฉ์นด๋ ๋ฒํธ,...