구글TS1팀 황진규
1. 개요
사용자가 원하는 제시어나 자료를 입력하게 되면, 그것을 판독하여 사용자에게 적절한 컨텐츠를 생성해 제공하는 생성형 AI는 2022년 하반기 OpenAI에서 ChatGPT를 출시하면서 인터넷을 뜨겁게 달구기 시작했습니다. 테크 기업들, 스타트업 할 것 없이 너도 나도 생성형 AI 서비스들을 출시하게 되었습니다. 마이크로소프트의 BingChat, 구글의 Bard, 네이버의 하이퍼클로바X, Stability AI의 Stable Diffusion 등 일반사용자들도 사용할 수 있는 서비스 중이거나 서비스를 준비중에 있습니다.
여기서 한 발 더 나아가, 생성형 AI의 응답을 기업의 Application에 맞게 맞춤형으로 만들 수 있는 도구 또한 출시되고 있습니다. 구글은 생성형 AI 모델을 엔터프라이즈 기업 Application에 맞춰 제공할 수 있는 툴인 Vertex AI Generative AI를 2023년 6월 8일 정식 런칭했습니다. 이번 아티클에서는 Vertex AI Generative AI의 특징 및 제공 서비스, 간단한 구성에 대해서 알아보도록 하겠습니다.
2. Generative AI 서비스 소개
Vertex AI Generative AI(이하 Gen AI)는 Google의 대규모 생성형 AI 모델에 대한 액세스를 제공하여 AI 기반 애플리케이션에서 테스트, 조정, 배포할 수 있습니다. Google Cloud Console의 Generative AI Studio, Vertex AI API, Python용 Vertex AI SDK를 사용하여 Vertex AI의 생성 AI 기능과 상호작용할 수 있습니다. 현재(2023년 8월 3일 기준) 텍스트 및 채팅, 이미지, 코드 및 텍스트 임베딩 모델이 제공됩니다. 각 모델은 Google Cloud 프로젝트에 특정한 엔드포인트를 통해 노출되므로 특정 사용 사례에 맞게 커스터마이즈 해야하는 경우가 아니면 기본 모델을 배포할 필요 없이 바로 사용 가능합니다.
또한 입력-출력 예제의 데이터 세트를 사용하여 튜닝하여 특정 사용 사례에 대한 기본 모델을 커스터마이즈 할 수 있습니다. 조정된 모델은 Google Cloud 프로젝트에서 동일한 이름의 Vertex AI Endpoints에 자동으로 배포됩니다.
3. Generative AI에서 제공하는 서비스
2023년 8월 3일 기준 Gen AI 서비스 중 정식 출시 전 서비스인 Preview, 정식 출시 된 일반 사용(General Available, 이하 GA) 가능한 것이 있고, 일반 사용이 가능함에도 신뢰할 수 있는 테스터 프로그램(Trusted Tester Program, 이하 TTP)을 신청해야 사용할 수 있는 프로그램이 있습니다.
- Generative AI(GA): 기초 모델이라고도 하는 Vertex AI에서 사용할 수 있는 Gen AI 모델은 생성하도록 설계된 콘텐츠 유형에 따라 분류됩니다. 이 콘텐츠에는 텍스트 및 채팅, 이미지, 코드 및 텍스트 임베딩이 포함됩니다.
Model 상태 설명 PaLM 2 GA Text and Chat 모델은 향상된 100개 이상의 다국어, 논리, 상식 추리, 수학 및 코딩 기능을 갖춘 최첨단 언어 모델입니다. Imagen TTP Text-to-Image 기반 모델은 모든 비즈니스 요구에 맞게 규모에 맞게 스튜디오급 이미지를 생성하고 사용자 지정할 수 있습니다. Chirp Preview Speech-to-Text 기반 모델은 조직이 캡션 및 음성 지원을 통해 모국어로 고객과 보다 깊이 있고 포괄적으로 소통할 수 있도록 도와줍니다. Codey GA Text-Code 기반 모델은 SDK 또는 애플리케이션에 내장되어 코드 생성 및 코드 완성을 통해 개발자 속도를 개선하고 코드 품질을 개선할 수 있습니다. 표: 구글이 제공하는 Gen AI에서 적용 가능한 생성형 AI 모델
- Generative AI Studio(GA): PaLM 2, Imagen, Codey, Chirp를 비롯한 구글이 제공하는 기반 모델을 가지고 프롬프트 엔지니어링, 조정, 배포할 수 있습니다.
- 샘플 프롬프트 테스트: Gen AI Studio가 미리 준비해둔 프롬프트를 통해 생성형 AI에 던질 질의문을 빠르게 생성하고 테스트할 수 있습니다.
- 자체 프롬프트 디자인 및 저장: 자체 프롬프트를 생성한 뒤에 생성형 AI에 질의문을 던지고 테스트할 수 있습니다.
- 응답 인용: 응답이 훈련 데이터와 동일한 경우 Generative AI Studio 프롬프트 상자에서 출처를 인용합니다.
- Foundation 모델 조정: 훈련 데이터가 있는 경우 모델 자체를 조정하여 더 나은 품질의 응답을 얻을 수 있습니다. 모델을 조정하면 모델의 응답을 특정 작업의 예에 따라 사용자 지정할 수 있습니다.
- 텍스트와 음성의 변환: Generative AI Studio의 음성 도구를 사용하면 텍스트 조각을 음성 오디오 파일로 변환하고 재생 및 다운로드할 수 있습니다.
- Model Garden(GA): 위에서 언급된 구글의 AI 모델 뿐만 아니라 오픈 소스 모델/3rd Party 모델 등 다양한 모델을 제공하여 비즈니스 니즈에 맞춰 최고의 리소스를 사용할 수 있는 유연성을 제공합니다.
- Generative AI App Builder(TTP): Gen App Builder는 다양한 내부 및 외부 정형/비정형 소스에서 데이터를 쉽게 수집하여 자연어를 통해 사용자 의도를 이해하는 앱을 빌드하고 기업의 공개 및 비공개 데이터에서 관련된 인용 및 출처를 사용해 올바른 정보를 표시할 수 있습니다. 또한 애플리케이션에서 액세스하는 데이터와 다루고자 하는 콘텐츠 또는 주제를 완전하게 제어할 수 있습니다.
- Tune Model(Preview): 기본 모델에 프롬프트 디자인만으로 원하는 응답을 얻지 못할 수도 있습니다. 모델 튜닝의 목표는 특정 작업에 대한 모델의 성능을 더욱 향상시키는 것입니다. 모델 튜닝 작업은 많은 예시를 포함하는 교육 데이터 세트를 모델에 제공하여 커스터마이즈를 합니다. 이런 식으로 모델을 조정하여 모델 성능을 크게 향상시킬 수 있습니다.
Gen AI에서 제공하는 서비스는 Google Cloud의 AI 통합 환경인 Vertex AI, 데이터 저장 및 처리 서비스인 Google Cloud Storage, BigQuery 등 제품과도 연계가 가능합니다.
4. 간단한 나만의 맞춤형 Gen AI 제작해보기
아래 예제에서 다루는 Gen App Builder를 따라하기 위해서 먼저 TTP 신청(https://cloud.google.com/ai/earlyaccess/join?hl=en)을 하시고 Google의 승인이 이루어진 다음 진행할 수 있습니다. Gen App Builder을 사용하실 수 없더라도 아래 Sample Demo를 보면서 어떻게 Gen AI를 활용하는지 확인하실 수 있습니다.
TTP 신청이 완료된 구글 클라우드 프로젝트에서 Gen App Builder를 검색 후 진입한 다음 새로운 Gen App을 하나 만들어보도록 하겠습니다.

[CREATE A NEW APP] 버튼을 눌러 새로운 Gen App을 생성해보도록 하겠습니다.

Gen App은 현재 심층 정보 검색, 최첨단 자연어 처리 및 최신 대규모 언어 처리 기능을 결합하여 사용자 의도를 이해하고 사용자에게 가장 관련성 높은 결과를 반환하는 Enterprise Search, 사용자가 현재 보고 있는 콘텐츠와 유사한 콘텐츠를 제안할 수 있는 Recommendations 기능을 제공합니다.

Gen App이 어떠한 데이터를 참조할지 결정합니다. 특정 Web Site, 회사가 가지고 있는 비정형 데이터 또는 정형 데이터를 참조할 수 있습니다. Web Site는 Gen App Builder를 통해 특별히 로그인이 필요하지않은 페이지에 한해 접근 가능한 데이터를 기반으로 빠른 구축이 가능하며, 정형/비정형 Gen App Builder가 구축에 시간이 조금 소요되는 대신 회사의 Private한 데이터를 바탕으로 구축할 수 있습니다. 여기서는 Web Site를 가지고 생성을 해보도록 하겠습니다.

Web Site에서 어떤 사이트를 참조하고, 어떤 사이트를 배제할지 명시해주면, Gen App Builder로 만들어진 검색엔진 생성이 완료됩니다.

왼쪽의 Integration 메뉴에서 사용자가 원하는 방식으로 만들어진 Gen App을 embedding 시킬 수 있습니다. Widget은 Web Application에 삽입되어 동작할 수 있는 방식이고, API는 질의를 API 형식으로 던져 JSON 형태의 Response로 Gen App의 대답을 확인할 수 있습니다.
[Widget 방식]

[API 방식]

아래 JSON은 위의 API 응답의 일부입니다.
"results": [
{
"id": "0",
"document": {
"name": "projects/PROJECT_NO/locations/global/collections/default_collection/dataStores/my-website-search-engine_uuid/branches/0/documents/0",
"id": "0",
"derivedStructData": {
"displayLink": "cloud.google.com",
"htmlFormattedUrl": "https://cloud.google.com/\u003cb\u003edatastream\u003c/b\u003e",
"formattedUrl": "https://cloud.google.com/datastream",
"pagemap": {
"cse_thumbnail": [
{
"height": "79",
"src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSa8IR5F42FTxpTHD8L4d74r6iMstqX85Va_AqaMlPoz8BKmaMunv1prA",
"width": "150"
}
],
"document": [
{
"keyword": "E__org__GoogleCloudPlatform",
"keywords": "E__org__GoogleCloudPlatform E__category__Cloud E__category__ProductExploration E__product__Datastream E__product__CloudDatabases E__category__Interest E__product__GoogleCloud E__category__CloudDatabasesAndAnalytics E__org__Alphabet E__docType__Product E__docType__LandingPage K__docType__Product K__product__Datastream"
}
],
"cse_image": [
{
"src": "https://cloud.google.com/_static/cloud/images/social-icon-google-cloud-1200-630.png"
}
],
"metatags": [
{
"og:image": "https://cloud.google.com/_static/cloud/images/social-icon-google-cloud-1200-630.png",
"viewport": "width=device-width, initial-scale=1",
"track-metadata-page_publishing_platform": "bricks",
"og:locale": "en",
"og:image:width": "1200",
"google-signin-scope": "profile email https://www.googleapis.com/auth/developerprofiles https://www.googleapis.com/auth/developerprofiles.award https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/webhistory",
"og:type": "website",
"og:url": "https://cloud.google.com/datastream",
"og:title": "Change Data Capture | Datastream | Google Cloud",
"track-metadata-page_template": "Product v2 Template",
"google-signin-client-id": "721724668570-nbkv1cfusk7kk4eni4pjvepaus73b13t.apps.googleusercontent.com",
"twitter:card": "summary_large_image",
"og:site_name": "Google Cloud",
"og:description": "Replicate and synchronize data reliably and with minimal latency with Datastream.",
"og:image:height": "630",
"theme-color": "#039be5"
}
]
},
"snippets": [
{
"snippet": "Datastream reads and delivers every change—insert, update, and delete—from your MySQL, PostgreSQL, AlloyDB and Oracle databases to load data into BigQuery, ...",
"htmlSnippet": "\u003cb\u003eDatastream\u003c/b\u003e reads and delivers every change—insert, update, and delete—from your MySQL, PostgreSQL, AlloyDB and Oracle databases to load data into BigQuery, ..."
}
],
"htmlTitle": "Change Data Capture | \u003cb\u003eDatastream\u003c/b\u003e | Google Cloud",
"link": "https://cloud.google.com/datastream",
"title": "Change Data Capture | Datastream | Google Cloud"
}
}
},
…
]
위의 응답에서 snippet 부분을 추출하여 프롬프트를 만든 다음 Gen AI API에 쿼리해보도록 하겠습니다.
https://cloud.google.com/vertex-ai/docs/generative-ai/text/test-text-prompts
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://us-central1-aiplatform.googleapis.com/v1/projects/YOUR_PROJECT_ID/locations/us-central1/publishers/google/models/text-bison:predict"
@request.json 내용
{
"instances": [
{ "prompt": "You are an AI Chatbot describing Google Cloud Product. Please refer to the Context below and answer more detail.\nContext: Datastream reads and delivers every change—insert, update, and delete—from your MySQL, PostgreSQL, AlloyDB and Oracle databases to load data into BigQuery, ..."}
],
"parameters": {
"temperature": 0.2,
"maxOutputTokens": 200,
"topP": 0.95,
"topK": 40
}
}
위와 같이 구성을 하게 되면, 아래와 같이 Gen AI로부터 응답을 받게 될 것입니다.
{
"predictions": [
{
"content": "Datastream reads and delivers every change—insert, update, and delete—from your MySQL, PostgreSQL, AlloyDB and Oracle databases to load data into BigQuery, Cloud Storage, or Pub/Sub. It's a fully managed service that's simple to set up and use.\n\nDatastream is a great choice for businesses that need to keep their data up-to-date in real time. It's also a good option for businesses that want to avoid the hassle of managing their own data replication infrastructure.\n\nHere are some of the benefits of using Datastream:\n\n* It's a fully managed service, so you don't have to worry about managing the underlying infrastructure.\n* It's easy to set up and use.\n* It supports a variety of data sources, including MySQL, PostgreSQL, AlloyDB and Oracle databases.\n* It can deliver data in real time or in batches.\n* It's secure and reliable",
"safetyAttributes": {
"scores": [
0.1
],
"categories": [
"Finance"
],
"blocked": false
},
"citationMetadata": {
"citations": []
}
}
],
"metadata": {
"tokenMetadata": {
"outputTokenCount": {
"totalBillableCharacters": 692,
"totalTokens": 200
},
"inputTokenCount": {
"totalTokens": 60,
"totalBillableCharacters": 239
}
}
}
}
5. 지원 현황
Gen AI 서비스의 업데이트 속도 및 새로 출시되는 기능이 상당히 빠른 편이므로, 아래 Release Notes를 자주 확인하여 새로운 기능에 대한 업데이트를 확인해주시는것이 가장 정확합니다.
Gen AI는 8월 3일 기준 Gen AI에서 제공하는 텍스트/채팅 기반의 PaLM 2 모델은 한국어를 지원합니다.
https://cloud.google.com/vertex-ai/docs/generative-ai/release-notes#July-17-2023
Gen App Builder는 공식적으로 영문만 지원됩니다. 다만 한국어에 대해서도 사용은 가능하나 원활한 동작을 보장하지 않습니다.
https://cloud.google.com/generative-ai-app-builder/docs/release-notes
출처
- https://cloud.google.com/blog/products/ai-machine-learning/generative-ai-support-on-vertexai?hl=en
- https://cloud.google.com/blog/products/ai-machine-learning/google-cloud-launches-new-ai-models-opens-generative-ai-studio?hl=en
- https://services.google.com/fh/files/misc/blueprint_media_content_discovery.pdf?hl=ko
- https://ai.googleblog.com/2022/04/pathways-language-model-palm-scaling-to.html