추론 엔진#
Xinference는 모델별로 다른 추론 엔진을 지원합니다. 사용자가 모델을 선택하면 Xinference가 자동으로 적합한 엔진을 선택합니다.
llama.cpp#
Xinference는 현재 Xinference 팀이 개발한 xllamacpp 를 llama.cpp 백엔드로 지원합니다. `llama.cpp`는 텐서 라이브러리 `ggml`을 기반으로 개발되었으며, LLaMA 시리즈 모델과 그 변형들의 추론을 지원합니다.
경고
Xinference v1.5.0부터 ``xllamacpp``는 llama.cpp의 기본 옵션이 되었고, ``llama-cpp-python``은 폐기되었습니다. Xinference v1.6.0부터 ``llama-cpp-python``은 제거되었습니다.
llama.cpp``의 `common.h <https://github.com/ggml-org/llama.cpp/blob/master/common/common.h>`_ 에 있는 ``common_params 구조체 정의를 참고하여 파라미터를 설정하십시오.
중첩된 여러 층의 매개변수가 있을 수 있습니다. 예를 들어, ``sampling.top_k``와 같습니다. 중첩된 매개변수를 구분할 때는 ``.``을 사용하세요.
다음은 WebUI에서 중첩 샘플링 매개변수를 설정하는 예시입니다:

자동 NGL#
Added in version v1.6.1: v1.6.1부터 n-gpu-layers가 지정되지 않은 경우(기본값: -1), GPU 레이어 수 추정 기능이 자동으로 활성화됩니다.
이 기능은 llama.cpp 백엔드에서 GPU 레이어 수(NGL)를 자동으로 설정합니다. 정확한 계산이 아니므로 -ngl 결과가 최적이 아닐 수 있으며, 여전히 VRAM 부족 오류가 발생할 수 있습니다.
현재 자동 NGL은 공식적으로 지원되지 않습니다. 자세한 내용은 아래 이슈를 참조하세요:
우리의 구현은 Ollama의 자동 NGL을 기반으로 하지만, 몇 가지 차이점이 있습니다:
우리는 xllamacpp 에서 제공하는 장치 정보를 사용합니다.
일부 흔하지 않은 아키텍처 지원을 제거했으며, 해당 아키텍처에서는 기본 계산 로직이 사용됩니다.
자동 NGL이 실패하면, 전체를 GPU에 로드하려고 시도합니다.
우리는 멀티모달 프로젝터가 모델의 GGUF에 내장되는 것을 지원하지 않습니다. 이 형식의 모델은 현재 실험 단계에 있습니다.
자주 묻는 질문#
Server error: {‘code’: 500, ‘message’: ‘failed to process image’, ‘type’: ‘server_error’}
서버 로그:
encoding image or slice... slot update_slots: id 0 | task 0 | kv cache rm [10, end) srv process_chun: processing image... ggml_metal_graph_compute: command buffer 0 failed with status 5 error: Internal Error (0000000e:Internal Error) clip_image_batch_encode: ggml_backend_sched_graph_compute failed with error -1 failed to encode image srv process_chun: image processed in 2288 ms mtmd_helper_eval failed with status 1 slot update_slots: id 0 | task 0 | failed to process image, res = 1
메모리 부족으로 인해 발생할 수 있습니다. ``n_ctx``를 줄여서 해결해 보세요.
Server error: {‘code’: 400, ‘message’: ‘the request exceeds the available context size. try increasing the context size or enable context shift’, ‘type’: ‘invalid_request_error’}
만약 multimodal 기능을 사용 중이라면, ``ctx_shift``는 기본적으로 비활성화됩니다. ``n_ctx``를 늘리거나 ``n_parallel``을 줄여 각 슬롯의 컨텍스트 크기를 증가시키십시오.
Server error: {‘code’: 500, ‘message’: ‘Input prompt is too big compared to KV size. Please try increasing KV size.’, ‘type’: ‘server_error’}
서버 로그:
ggml_metal_graph_compute: command buffer 1 failed with status 5 error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory) graph_compute: ggml_backend_sched_graph_compute_async failed with error -1 llama_decode: failed to decode, ret = -3 srv update_slots: failed to decode the batch: KV cache is full - try increasing it via the context size, i = 0, n_batch = 2048, ret = -3
KV cache 생성 실패로 인해 발생할 수 있습니다.
n_ctx``를 줄이거나 ``n_parallel``을 늘리거나 ``n_gpu_layers매개변수를 조정하여 모델 일부를 GPU에 로드하면 문제를 해결할 수 있습니다. 참고로, 직렬 추론 요청만 처리하는 경우 ``n_parallel``을 늘려도 성능이 향상되지 않습니다.
transformers#
Transformers는 대부분의 최신 출시 모델을 지원합니다. Pytorch 형식 모델의 기본 엔진입니다.
vLLM#
vLLM은 매우 효율적이고 사용하기 쉬운 대규모 언어 모델 추론 엔진입니다.
vLLM은 다음과 같은 특징을 가지고 있습니다:
선도적인 추론 처리량
PagedAttention을 사용하여 어텐션 키와 값 메모리를 효율적으로 관리하기
들어오는 요청을 연속 배치 처리합니다.
최적화된 CUDA 커널
Xinference가 다음 조건을 충족할 때 자동으로 vLLM을 추론 엔진으로 선택합니다:
모델 형식은
pytorch,gptq,awq,fp4,fp8또는bnb입니다.모델 형식이
pytorch일 경우, 양자화 옵션은none이어야 합니다.모델 형식이
gptq``일 때, 양자화 옵션은 ``Int3,Int4또는 ``Int8``이어야 합니다.운영 체제는 Linux이며 최소 하나의 CUDA를 지원하는 장치가 있어야 합니다.
사용자 정의 모델의
model_family필드와 내장 모델의model_name필드는 vLLM 지원 목록에 있습니다.
현재 지원되는 모델은 다음과 같습니다:
code-llama,code-llama-instruct,code-llama-python,deepseek,deepseek-chat,deepseek-coder,deepseek-coder-instruct,deepseek-r1-distill-llama,gorilla-openfunctions-v2,HuatuoGPT-o1-LLaMA-3.1,llama-2,llama-2-chat,llama-3,llama-3-instruct,llama-3.1,llama-3.1-instruct,llama-3.3-instruct,minicpm5-1b,tiny-llama,wizardcoder-python-v1.0,wizardmath-v1.0,Yi,Yi-1.5,Yi-1.5-chat,Yi-1.5-chat-16k,Yi-200k,Yi-chatcodestral-v0.1,mistral-instruct-v0.1,mistral-instruct-v0.2,mistral-instruct-v0.3,mistral-large-instruct,mistral-nemo-instruct,mistral-v0.1,openhermes-2.5,seallm_v2Baichuan-M2,codeqwen1.5,codeqwen1.5-chat,deepseek-r1-distill-qwen,DianJin-R1,fin-r1,HuatuoGPT-o1-Qwen2.5,KAT-V1,marco-o1,qwen1.5-chat,qwen2-instruct,qwen2.5,qwen2.5-coder,qwen2.5-coder-instruct,qwen2.5-instruct,qwen2.5-instruct-1m,qwenLong-l1,QwQ-32B,QwQ-32B-Preview,seallms-v3,skywork-or1,skywork-or1-preview,XiYanSQL-QwenCoder-2504llama-3.2-vision,llama-3.2-vision-instructbaichuan-2,baichuan-2-chatInternLM2ForCausalLMqwen-chatmixtral-8x22B-instruct-v0.1,mixtral-instruct-v0.1,mixtral-v0.1cogagentglm-edge-chat,glm4-chat,glm4-chat-1mcodegeex4,glm-4vseallm_v2.5orion-chatqwen1.5-moe-chat,qwen2-moe-instructCohereForCausalLMdeepseek-v2-chat,deepseek-v2-chat-0628,deepseek-v2.5,deepseek-vl2deepseek-prover-v2,deepseek-r1,deepseek-r1-0528,deepseek-v3,deepseek-v3-0324,Deepseek-V3.1,moonlight-16b-a3b-instructdeepseek-r1-0528-qwen3,qwen3minicpm3-4binternlm3-instructgemma-3-1b-itglm4-0414minicpm-2b-dpo-bf16,minicpm-2b-dpo-fp16,minicpm-2b-dpo-fp32,minicpm-2b-sft-bf16,minicpm-2b-sft-fp32,minicpm4Ernie4.5Qwen3-Coder,Qwen3-Instruct,Qwen3-Thinkingglm-4.5,GLM-4.6,GLM-4.7gpt-ossseed-ossQwen3-Next-Instruct,Qwen3-Next-ThinkingDeepSeek-V3.2,DeepSeek-V3.2-ExpMiniMax-M2,MiniMax-M2.5,MiniMax-M2.7GLM-4.7-Flashglm-5,glm-5.1DeepSeek-V4-Flash,DeepSeek-V4-Pro
SGLang#
SGLang 는 RadixAttention 기반의 고성능 추론 런타임을 갖추고 있습니다. 여러 호출 간에 KV 캐시를 자동으로 재사용하여 복잡한 LLM 프로그램의 실행을 크게 가속화합니다. 또한 연속 배치 처리 및 텐서 병렬 처리와 같은 다른 일반적인 추론 기술도 지원합니다.
MLX#
MLX 는 Apple Silicon 칩에서 LLM을 효율적으로 실행하는 방법을 제공합니다. 모델이 MLX 형식을 포함하는 경우, Apple Silicon 칩을 사용하는 Mac 사용자에게 MLX 엔진 사용을 권장합니다.