Gemini 또는 Gemini와 같은 인공지능 (AI) 모델에 대한 프롬프트를 생성하는 작업
Gemma를 사용하여 개발자의 의도를 완벽하게 포착하는 것은 결코 간단하지 않은 작업일 수 있습니다. 프롬프트를 직접 작성한 후 다양한 사용 사례에서 테스트하여 필요에 맞는지 확인해야 하는 경우가 많습니다. 결과에 따라 프롬프트를 타겟팅하여 업데이트할 수 있습니다. 한 곳에서는 일부 단어를 변경하고 다른 곳에서는 새 문장을 추가하는 식입니다. 이 프로세스는 그다지 원칙이 적용되어 있지 않으며 최상의
있습니다.
Google은 LLM을 사용하여 다음과 같은 방법을 개발했습니다.
현재 실행 중인 언어를 기반으로 프롬프트 템플릿을
모델의 출력에 대해 알기 쉬운 언어로 제공하는 피드백을 제공합니다. 보내 주신 의견,
프롬프트 및 모델의 출력과 함께 이 모델은 LLM으로 전송되어
프롬프트에 맞게 조정하는 것이 좋습니다.
원칙을 기반으로 반복적인 업데이트 이 워크플로에서는 LLM을 사용하여
가이드라인을
직접 수정할 수도 있습니다. 다음과 같은 작업을 할 수 있습니다.
가이드라인을 하나 이상 반복적으로 생성한 다음 LLM에 보내기 전에
해당 가이드라인을 준수하도록 프롬프트 템플릿을 업데이트합니다. 다음과 같은 작업을 할 수 있습니다.
직접 선별하고 LLM에서 정제된 가이드라인과 함께 포함할 수도 있습니다.
모델 출력에 대한 직접적인 비판 이 워크플로에는
프롬프트 및 모델과 함께 전체 모델 출력에 대한 정보를 제공하고
LLM에 직접 출력하여 업데이트된 프롬프트 템플릿을 생성합니다.
이 두 워크플로 모두 애플리케이션에 유용할 수 있습니다. 주목할 만한 절충점은 가이드라인의 존재입니다. 가이드라인은 투명성에 대한 접근 방식을 알리는 데 도움이 되는 유용하고 구체적인 프로세스 아티팩트가 될 수 있습니다.
그림 1. 이 플로우 차트는 두 모델 정렬의 위치와 방법을 보여줍니다.
가이드 기반 또는 직접 업데이트를 가능케 하기 위해 라이브러리 워크플로가 다양하며
프롬프트 템플릿을 사용할 수 있습니다. 프로세스는 반복적이며 이러한 워크플로는
언제든지 전환할 수 있습니다.
프롬프트를 실행한 후 모델이 다르게 작동해야 하는 방식에 관한 의견을 제공할 수 있으며 Vertex AI Studio는 Gemini를 사용하여 재작성 초안을 작성합니다. 제안된 변경사항을 수락하고 버튼을 클릭하여 업데이트된 프롬프트를 다시 실행하거나 의견을 업데이트하고 Gemini가 다른 후보를 초안으로 작성하도록 할 수 있습니다.
그림 2. '프롬프트 세부 조정' Vertex AI Studio의 기능을 사용하여
사용자 의견에 따라 프롬프트를 업데이트할 수 있습니다
링크
모델 정렬을 직접 살펴보세요.
Gemini를 사용하여 두 가지 정렬 접근 방식을 모두 사용하여 개방형 가중치 Gemma 2 모델의 다양한 프롬프트를 정렬하는 이 Colab 노트북을 실행합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-10-23(UTC)"],[],[],null,["# Model Alignment\n\n\u003cbr /\u003e\n\nCreating a prompt for an artificial intelligence (AI) model, such as Gemini or\nGemma, that perfectly captures a your intent can be a non-trivial task. Often,\nyou must write a prompt by hand and then test it in a variety of use cases to\nensure it fits your needs. Based on the results, you might make targeted updates\nto the prompt: changing some words in one place, adding a new sentence in\nanother. This process is not very principled and may not lead to the best\nresults.\n\nGoogle has [developed a method](https://arxiv.org/abs/2310.15428) that uses LLMs to\nautomatically update a [prompt template](/responsible/docs/alignment#prompt-templates) based on\nfeedback you provide about the model's output in plain language. Your feedback,\nalong with the prompt and the model's output, are sent to an LLM that updates\nthe prompt to better align with your intended behavior.\n\nThis method available in two ways:\n\n- The open source [`model-alignment` Python library](https://pypi.org/project/model-alignment/) lets you flexibly incorporate this approach into your software and workflows.\n- A [version of this approach](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/ai-powered-prompt-writing#refine_prompts) is integrated into Vertex AI Studio, letting you use this workflow with just a few clicks.\n\nOpen-Source Library\n-------------------\n\nModel Alignment is an [open-source Python library](https://github.com/pair-code/model-alignment), released as a\n[package on PyPI](https://pypi.org/project/model-alignment/) that enables alignment of prompts from human\nfeedback through an API. The library is based on our research into\n[prompt updating through human feedback](https://arxiv.org/abs/2310.15428) and\n[automatic classifier creation from labeled-data](https://arxiv.org/abs/2403.04894).\n\n**Curate prompt templates for Gemma using the Model Alignment library**\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Start Google Colab](https://colab.research.google.com/github/pair-code/model-alignment/blob/main/notebooks/Gemma_for_Model_Alignment.ipynb) |\n\n\u003cbr /\u003e\n\nThis library supports two workflows for automatically updating prompt templates:\n\n1. **Iterative updates from principles** . This workflow uses an LLM to distill [guidelines](https://arxiv.org/abs/2212.08073) either from indirect critiques of the model's output, or from direct edits of the model output. You can iteratively create one or more guidelines before sending them to the LLM, which updates the prompt template to adhere to those guidelines. You can also hand-curate guidelines and include them alongside LLM-distilled ones.\n2. **Direct critique of model outputs**. This workflow takes your feedback about the entire model output and feeds it, along with the prompt and model output, directly to the LLM to generate an updated prompt template.\n\nThese two workflows may both be useful for you application. The notable\ntrade-off is the presence of guidelines, which can be a useful, concrete process\nartifact that can help inform, for example, your approach to\n[transparency](/responsible/docs/design#transparency-artifacts).\n\n**Figure 1.** This flowchart illustrates where and how the two Model Alignment\nlibrary workflows diverge to enable guideline-driven or direct updates to your\nprompt templates. Note that the process is iterative, and these workflows are\nnot mutually exclusive, you can switch between them at any time.\n\nCheck out the [Colab notebook](https://colab.research.google.com/github/pair-code/model-alignment/blob/main/notebooks/Gemma_for_Model_Alignment.ipynb) that uses [Gemini](https://ai.google.dev/gemini-api) to\nalign prompts for [Gemma 2](https://ai.google.dev/gemma) using both workflows.\n\nAlignment in Vertex AI Studio\n-----------------------------\n\nGoogle's [Vertex AI Studio](https://console.cloud.google.com/vertex-ai/studio/freeform) has added a\n[\"refine prompt\"](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/ai-powered-prompt-writing#refine_prompts) feature based on the *direct* workflow\nfrom the Model Alignment open source library to compliment its authoring,\nrunning, evaluation, and comparison tools.\n\nAfter running a prompt, you can provide feedback on ways in which the model\nshould behave differently, and Vertex AI Studio uses [Gemini](https://ai.google.dev/gemini-api) to draft\na rewrite. You can accept the proposed changes and re-run the updated prompt\nwith a click of a button, or update your feedback and have Gemini draft another\ncandidate.\n\n**Figure 2.** The \"refine prompt\" feature of Vertex AI Studio being used to\nupdate a prompt based on user feedback.\n\nLinks\n-----\n\nExplore model alignment for yourself:\n\n- Run this [Colab notebook](https://colab.research.google.com/github/pair-code/model-alignment/blob/main/notebooks/Gemma_for_Model_Alignment.ipynb) that uses Gemini to align various prompts for our open-weights Gemma 2 model using both alignment approaches.\n- Try the \"refine prompt\" model alignment feature in [Vertex AI Studio](https://console.cloud.google.com/vertex-ai/studio/freeform)."]]