MLP 드래프트 모델

MLP 드래프트 모델 (MLP Draft Models)

스펙큘레이티브 디코딩의 또 다른 방법으로, 드래프트 예측을 컨텍스트 벡터와 샘플링된 토큰 양쪽에 조건화하는 드래프트 모델을 쓰는 방식이 있어요. 이 페이지에서 vLLM에서 MLP(멀티 레이어 퍼셉트론) 드래프트 모델을 설정하는 방법을 살펴볼게요.

출처: vLLM 공식 문서 — MLP Draft Models

개요 (Overview)

MLP 드래프트 모델 방식에서는 제안이 컨텍스트 벡터와 샘플링된 토큰 둘 다에 조건화돼서 드래프트 예측이 생성돼요. 더 자세한 내용은 스펙큘레이티브 디코딩 히치하이커 가이드IBM Research 기술 보고서를 참고하세요.

MLP Drafter 예시

from vllm import LLM, SamplingParams

prompts = ["The future of AI is"]
sampling_params = SamplingParams(temperature=0.8, top_p=0.95)

llm = LLM(
    model="meta-llama/Meta-Llama-3.1-8B-Instruct",
    tensor_parallel_size=1,
    speculative_config={
        "model": "ibm-ai-platform/llama3-8b-accelerator",
        "draft_tensor_parallel_size": 1,
        "method": "mlp_speculator",
    },
)

outputs = llm.generate(prompts, sampling_params)

for output in outputs:
    prompt = output.prompt
    generated_text = output.outputs[0].text
    print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")

알려진 이슈: ibm-ai-platform/llama3-70b-acceleratorAttributeError: 'MLPSpeculatorConfig' object has no attribute 'num_attention_heads'로 실패할 수 있어요. 진행 상황은 #34106#34163에서 추적돼요.

사전 훈련된 MLP Drafter 모델 (Pre-trained models)

이 유형의 다양한 스펙큘레이티브 모델이 HF hub에서 제공돼요:

  • llama-13b-accelerator
  • llama3-8b-accelerator
  • codellama-34b-accelerator
  • llama2-70b-accelerator
  • llama3-70b-accelerator
  • granite-3b-code-instruct-accelerator
  • granite-8b-code-instruct-accelerator
  • granite-7b-instruct-accelerator
  • granite-20b-code-instruct-accelerator

더 알아보기 (Learn more)