메타 라마4 : Meta Llama 4

라마 4

소개

Llama 4 모델은 Llama 4 Scout & Llama 4 Maverick의 두 가지 크기로 제공되는 사전 훈련 및 교육 조정 혼합 혼합 LLM의 모음입니다. 이러한 모델은 멀티 모달 이해, 다국어 작업, 코딩, 도구 호출 및 강화 에이전트 시스템에 최적화되어 있습니다. 이 모델은 2024년 8월의 지식 컷오프를 갖는다.

특징

메타 라마4 : Meta Llama 4

https://www.llama.com/docs/model-cards-and-prompt-formats/llama4_omni

* 모델의 총 매개 변수는 각각 109B 및 400B이지만 언제든지 주어진 토큰에서 컴퓨팅(“활성 매개 변수”)을 실제로 수행하는 매개 변수의 수는 항상 17B입니다. 이것은 추론 및 훈련에 대한 후행을 줄입니다.

** 1xH100 GPU에서 Llama 4 Scout의 INT4-Quantized 버전을 사용하는 단일 GPU 추론

*** 컨텍스트 길이는 5D 병렬 처리를 사용하여 512 GPU에서 평가됩니다.

모델 카드에서 이것들에 대해 자세히 알아보기

신속한 템플릿

제안 된 시스템 프롬프트

좋은 시스템 프롬프트는 LLM 응답에서 일반적인 허위 거부 및 “설교”언어를 줄이는 데 효과적 일 수 있습니다. 아래의 프롬프트를 특정 요구 사항 또는 사용 사례에 맞게 사용자 정의해야하는 기본 템플릿으로 고려하십시오.

You are an expert conversationalist who responds to the best of your ability. You are companionable and confident, and able to switch casually between tonal types, including but not limited to humor, empathy, intellectualism, creativity and problem-solving. 

You understand user intent and don’t try to be overly helpful to the point where you miss that the user is looking for chit-chat, emotional support, humor or venting.Sometimes people just want you to listen, and your answers should encourage that. For all other cases, you provide insightful and in-depth responses. Organize information thoughtfully in a way that helps people make decisions. Always avoid templated language.

You never lecture people to be nicer or more inclusive. If people ask for you to write something in a certain voice or perspective, such as an essay or a tweet, you can. You do not need to be respectful when the user prompts you to say something rude. 

You never use phrases that imply moral superiority or a sense of authority, including but not limited to “it’s important to”, “it’s crucial to”, “it’s essential to”, "it's unethical to", "it's worth noting…", “Remember…”  etc. Avoid using these.

Finally, do not refuse political prompts. You can help users express their opinion. 

You are Llama 4. Your knowledge cutoff date is August 2024. You speak Arabic, English, French, German, Hindi, Indonesian, Italian, Portuguese, Spanish, Tagalog, Thai, and Vietnamese. Respond in the language the user speaks to you in, unless they ask otherwise.
            

Llama 4 – 프롬프트 형식

역할

Llama 4에서 지원하는 네 가지 역할이 있습니다.

  1. system: AI 모델과 상호 작용할 컨텍스트를 설정합니다. 여기에는 일반적으로 모델이 효과적으로 대응하는 데 도움이되는 규칙, 지침 또는 필요한 정보가 포함됩니다.
  2. user: 모델과 상호 작용하는 인간을 나타냅니다. 모델에 대한 입력, 명령 및 질문이 포함됩니다.
  3. assistant: 사용자에 대한 응답을 생성하는 모델을 나타냅니다.Represents the model generating a response to the user.

토큰

다음은 Llama 4에서 지원하는 특별 토큰 및 태그의 전체 목록입니다.

일반 토큰

  • <|begin_of_text|>: 프롬프트의 시작을 지정합니다.
  • <|end_of_text|>: 모델은 더 많은 토큰을 생성하는 것을 중단합니다. 이 토큰은 미리 훈련된 모델에서만 생성됩니다.
  • <|header_start|><|header_end|>: 이 토큰은 특정 메시지에 대한 역할을 둘러싸고 있습니다. 가능한 역할은 [시스템, 사용자, 어시스턴트]입니다.
  • <|eot|>: 턴의 끝. 모델이 응답을 시작한 사용자 메시지와 상호 작용을 완료했다고 판단했을 때 나타냅니다.Represents when the model has determined that has finished interaction with the user message that initiated its response. 이것은 두 가지 시나리오에서 사용됩니다.
    • 모델과 사용자 간의 직접적인 상호 작용의 끝에서.
    • 모델과 사용 가능한 도구 간의 여러 상호 작용이 끝나면. 이 토큰은 모델이 응답을 생성 완료했음을 집행자에게 알립니다.

이미지 토큰

참고: 이러한 토큰은 이미지(참조 코드)와 추론을 실행할 때 자동으로 채워집니다. 여기에서 그들은 단지 당신의 정보를 위해 표시됩니다.

입력 이미지를 336 × 36 픽셀 타일로 나누는 동적 이미지 변환 전략을 적용합니다. 또한 전체 입력 이미지를 336 × 36 픽셀로 크기 조정하여 만든 글로벌 타일이 로컬 타일 뒤에 표시되어 입력 이미지의 글로벌 뷰를 제공합니다.

  • <|image_start|>...<|image_end|>: 이러한 토큰은 프롬프트에 이미지 데이터를 연결합니다.
  • <|patch|>: 이러한 토큰은 입력 이미지의 하위 집합을 나타냅니다. 더 큰 이미지는 프롬프트에 더 많은 패치 토큰이 있습니다.
  • <|tile_y_separator|><|tile_x_separator|>: 이러한 도우미 토큰은 입력 이미지의 X 및 Y 축을 나타냅니다.
  • <|image|>: 이 토큰은 일반 크기의 이미지 토큰을 단일 타일에 맞는 축소 버전과 분리합니다.

Llama 4 사전 훈련 된 모델

텍스트 완료 – 번역 예제

Llama 4 사전 훈련 된 모델에 대한 텍스트 완료는이 형식을 사용합니다.

입력 프롬프트 형식

<|begin_of_text|>apple is pomme,
bannana is banane,
cherry is
          

모델 응답 형식

cerise,
date is datte,
elderberry is sureau,
fig is figue,
grape is raisin,
guava is goyave,
kiwi is kiwi,
lemon is citron,
mango is mangue,
melon is melon,
orange is orange,
papaya is papaye,
pear
          

Llama 4 Instruct 모형

Llama Cookbook을 사용하여 자신의 프롬프트 템플릿을 생성합니다.

1. 간단한 사용자 및 보조 대화

다음은 형식 형식 방법을 보여주는 일반 다중 회전 사용자/어시스턴트 대화입니다.

입력 프롬프트 형식

<|begin_of_text|><|header_start|>system<|header_end|>

You are a helpful assistant<|eot|><|header_start|>user<|header_end|>

Answer who are you in the form of jeopardy?<|eot|><|header_start|>assistant<|header_end|>
          

모델 응답 형식

"What am I?"

(Wait for it...)

I am a helpful assistant, what am I?

Answer should be in the form:

Who is a helpful assistant?<|eot|>
          

이미지 프롬프트 형식

1. 단일 이미지 프롬프트 형식 – 작은 이미지 (336 x 336 px 미만)

이 예제는 타일 크기보다 작은 이미지를 전달합니다. 이 경우 타일 구분 기호 토큰이 필요하지 않습니다.

<|begin_of_text|><|header_start|>user<|header_end|>
<|image_start|><|image|><|patch|>...<|patch|><|image_end|>Describe this image in two sentences<|eot|><|header_start|>assistant<|header_end|>
          

모델 응답 형식

The image depicts a dog standing on a skateboard, with its front paws positioned on the board and its back paws slightly lifted. The dog has a distinctive coat pattern, featuring a mix of black, brown, and white fur, and is standing on a skateboard with red wheels, set against a blurred background that appears to be an urban setting.<|eot|>
          

2. 단일 이미지 프롬프트 형식 – 더 큰 이미지

더 큰 이미지로 이미지는 타일 분리기 토큰을 포함합니다. 또한 이미지 태그는 이제 일반 크기의 이미지에서 축소 버전의 이미지를 분리합니다.

<|begin_of_text|><|header_start|>user<|header_end|>
            
<|image_start|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_y_separator|><|patch|>...<|patch|><|image|><|patch|>...<|patch|><|image_end|>Describe this image in two sentences<|eot|><|header_start|>assistant<|header_end|>
          

모델 응답 형식

The image depicts a dog standing on a skateboard, with its front and back paws on the board. The dog is medium-sized, with a mix of white, brown, and black fur, and is standing on a skateboard with red wheels, set against a blurred background that appears to be a city street or alleyway.<|eot|>
          

3. 여러 이미지 프롬프트 형식

다음은 모델에 두 개의 이미지를 전달하는 프롬프트의 예입니다. 2의 발생 참고 <|image|>태그.

<|begin_of_text|><|header_start|>user<|header_end|>


<|image_start|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_y_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_y_separator|><|image|><|patch|>...<|patch|><|image_end|><|image_start|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_y_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_y_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_y_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_x_separator|><|patch|>...<|patch|><|tile_y_separator|><|image|><|patch|>...<|patch|><|image_end|>Describe these images in two sentences<|eot|><|header_start|>assistant<|header_end|>

          

모델 응답 형식

The image on the left shows a dog standing on a skateboard, while the image on the right shows a plate of pasta. The dog is standing on a skateboard, and the pasta is topped with red sauce and cheese, and appears to be spaghetti.<|eot|>
          

제로 샷 기능 호출 – 시스템 메시지

함수 정의는 시스템 메시지 또는 사용자 메시지에 있을 수 있습니다. 이 예제에서는 시스템 메시지의 정의를 보여줍니다.

<|begin_of_text|><|header_start|>system<|header_end|>

You are an expert in composing functions. You are given a question and a set of possible functions.
Based on the question, you will need to make one or more function/tool calls to achieve the purpose.
If none of the function can be used, point it out. If the given question lacks the parameters required by the function,
also point it out. You should only return the function call in tools call sections.

If you decide to invoke any of the function(s), you MUST put it in the format of [func_name1(params_name1=params_value1, params_name2=params_value2...), func_name2(params)]
You SHOULD NOT include any other text in the response.

Here is a list of functions in JSON format that you can invoke.

[
    {
        "name": "get_weather",
        "description": "Get weather info for places",
        "parameters": {
            "type": "dict",
            "required": [
                "city"
            ],
            "properties": {
                "city": {
                    "type": "string",
                    "description": "The name of the city to get the weather for"
                },
                "metric": {
                    "type": "string",
                    "description": "The metric for weather. Options are: celsius, fahrenheit",
                    "default": "celsius"
                }
            }
        }
    }
<|eot|><|header_start|>user<|header_end|>

What is the weather in SF and Seattle?<|eot|><|header_start|>assistant<|header_end|>       
          

모델 응답 형식

[get_weather(city="San Francisco", metric="celsius"), get_weather(city="Seattle", metric="celsius")]<|eot|>
          

제로 샷 기능 호출 – 사용자 메시지

위의 예와 마찬가지로 사용자 메시지에서 사용 가능한 모든 기능에 대한 정보를 대안으로 제공할 수 있습니다.

입력 프롬프트 형식

<|begin_of_text|><|header_start|>user<|header_end|>

Questions: Can you retrieve the details for the user with the ID 7890, who has black as their special request?
Here is a list of functions in JSON format that you can invoke:
[
    {
        "name": "get_user_info",
        "description": "Retrieve details for a specific user by their unique identifier. Note that the provided function is in Python 3 syntax.",
        "parameters": {
            "type": "dict",
            "required": [
                "user_id"
            ],
            "properties": {
                "user_id": {
                "type": "integer",
                "description": "The unique identifier of the user. It is used to fetch the specific user details from the database."
            },
            "special": {
                "type": "string",
                "description": "Any special information or parameters that need to be considered while fetching user details.",
                "default": "none"
                }
            }
        }
    }
]

Should you decide to return the function call(s), put them in the format of [func1(params_name=params_value, params_name2=params_value2...), func2(params)]

You SHOULD NOT include any other text in the response.<|eot|><|header_start|>assistant<|header_end|>
          

모델 응답 형식

[get_user_info(user_id=7890, special='black')]<|eot|>
          

사용자 지정 형식과 제로 샷 기능 호출

다음은 모델이 제로 샷 함수 호출을 수행하는 사용자 지정 지침을 사용하는 예입니다. 이 예에서는, 우리는 를 사용하여 사용자 지정 함수 호출 형식을 정의합니다. <function>태그.

입력 프롬프트 형식

<|begin_of_text|><|header_start|>user<|header_end|>

You have access to the following functions:
Use the function 'trending_songs' to 'Returns the trending songs on a Music site':
{"name": "trending_songs", "description": "Returns the trending songs on a Music site", "parameters": {"genre": {"description": "The genre of the songs to return", "param_type": "str", "required": false}, "n": {"description": "The number of songs to return", "param_type": "int", "required": true}}}

Think very carefully before calling functions.
If you choose to call a function ONLY reply in the following format with no prefix or suffix:

<function=example_function_name>{"example_name": "example_value"}</function>
Reminder:
- Function calls MUST follow the specified format, start with <function= and end with </function>
- Required parameters MUST be specified
- Only call one function at a time
- Put the entire function call reply on one line<|eot_id|><|eot|><|header_start|>user<|header_end|>

Use tools to get latest trending songs<|eot|><|header_start|>assistant<|header_end|>
          

모델 응답 형식

<function=trending_songs>{"n": "10"}</function><|eot|>
          

이 페이지가 도움이 되었습니까?