Бұл жазба автоматты түрде аударылған. Бастапқы тіл: Ағылшын
Мақалада Hugging Face платформасында не бар екені, модель архитектураларының қандай түрлері болатыны, тілдік модельді жеке компьютерде қалай іске қосуға болатыны және оның жұмысын қалай жақсартуға болатыны сипатталған. Сандар ресми құжаттамадан алынған және 2026 жылғы желтоқсандағы жағдайды көрсетеді.
Hugging Face деген не
Hugging Face — америкалық компания әрі сол атаумен аталатын платформа; онда машиналық оқыту модельдері, деректер жиындары және демонстрациялық қолданбалар жарияланады. Платформаны «машиналық оқытуға арналған GitHub» деп атайды: әр жоба нұсқалар тарихы бар Git-репозиторий ретінде сақталады, ал жария репозиторийлер барлығына ашық.
Компанияның негізін 2016 жылы Клеман Деланг, Жюльен Шомон және Тома Вольф қалаған, бас кеңсесі Нью-Йоркте орналасқан. Алғашқы өнімі жасөспірімдерге арналған чат-бот болды. Оның моделі көпшілікке ашық жарияланғаннан кейін компания машиналық оқыту платформасын жасауға көшті.
2026 жылдың қыркүйегінде Nvidia Hugging Face-ті сатып алу туралы келісімді жариялады. Мәміле реттеуші органдар мақұлдағаннан кейін, 2027 жылдың бірінші жартысында аяқталады деп күтілуде.
Платформада 3 млн-нан астам модель, 1 млн деректер жиыны және 2 млн қолданба орналастырылған; бұл сандар құжаттамада келтірілген. Компания туралы мәліметтер Википедия мақаласынан алынған.
Платформада қандай бөлімдер бар
Платформаның орталық бөлігі Hub деп аталады. Тіркелу және жария модельдерді жүктеп алу тегін, ал платформа серверлерінде есептеу ақылы болуы мүмкін.
Models — модель салмақтары, конфигурациясы және сипаттамасы бар репозиторийлер. Салмақтар — модельдің оқыту кезінде іріктелген сандық параметрлері. Модельді өз компьютерінде іске қосу үшін осы жерден жүктеп алады. Оқытылған модельді жаңа деректерге қолдану инференс деп аталады.
Datasets — модельдерді оқытуға және тексеруге арналған деректер жиындары. Жиынның мазмұнын браузерде қарауға болады.
Spaces — демонстрациялық қолданбаларға арналған хостинг. Модель авторы интерфейсті жариялайды, ал келуші модельді ештеңе орнатпай-ақ браузерде сынап көреді. Қолданбалар үш түрлі болады: Gradio, Docker және статикалық HTML.
Inference Providers — өз жабдығынсыз модельдерді API арқылы шақыру. Сұраныстарды бөгде провайдер-компаниялар өңдейді. Құжаттама көрсеткішінде 200 мыңнан астам модель бар делінген; алайда API арқылы кемінде бір провайдер қызмет көрсететін модельдер ғана қолжетімді. Чат-модельдер үшін OpenAI API-імен үйлесімді интерфейс бар: қолданыстағы бағдарламада мекенжай, қол жеткізу кілті және модель атауы ауыстырылады.
Inference Endpoints — таңдалған модельді платформа басқаратын арнайы бөлінген серверлерде іске қосу.
Бұған қоса, платформада модельдер мен деректер мысалдары бар Tasks тапсырмалар каталогы және модельдерді салыстыратын Leaderboards кестелері бар.
Модель архитектураларының түрлері
Архитектура дегеніміз — нейрондық желінің қандай қабаттардан тұратынын және деректердің сол қабаттар арқылы қалай өтетінін анықтайтын құрылымы. Модельдің қандай тапсырмаларды шешетіні және қандай бағдарламамен іске қосылатыны архитектураға байланысты.
Hub-тағы модельдердің көпшілігі «трансформер» архитектурасына негізделген. Оны Google зерттеушілері 2017 жылы Attention Is All You Need мақаласында ұсынған. Өңдеу алдында мәтін сөз, сөз бөлігі немесе жеке таңба түріндегі токендерге бөлінеді. Трансформердің негізі — зейін механизмі (attention): кезекті токенді өңдегенде модель тізбектің өзіне қолжетімді токендерін ескереді және олардың қайсысы маңызды екенін өзі анықтайды. Hugging Face курсында трансформерлер үш түрге бөлінеді.

Сызбада зейіннің бір рет қалай есептелетіні көрсетілген. Әр токеннің векторынан үш вектор алынады: сұраныс, кілт және мән. Q, K және V матрицалары барлық токендердің осы векторларынан құралған. Сұраныстар мен кілттердің скалярлық көбейтінділерін есептеу арқылы токендердің бір-біріне жақындығы бағаланады. Softmax функциясы бағаларды салмақтарға айналдырады, әр жолдағы салмақтардың қосындысы бірге тең. Токеннің жаңа векторы — осы салмақтармен алынған мәндердің қосындысы. √d_k-ға бөлу (мұндағы d_k — кілттердің өлшемділігі) өлшемділік артқан сайын бағалардың өсіп кетуіне жол бермейді.
Энкодерлер мәтінді тұтас оқиды: зейін сөйлемдегі барлық сөздерді, ағымдағы сөздің сол жағындағысын да, оң жағындағысын да бірден көреді. Мұндай модельдер мәтін генерацияламайды. Оларды жіктеу, атаулы нысандарды тану және дайын мәтіннен жауап табу үшін қолданады. Мысалдар: BERT, DistilBERT, ModernBERT. Энкодерлердің негізінде көбінесе эмбеддинг модельдері жасалады: олар мәтінді сандық векторға айналдырады, ал мәтіндер осы векторлар арқылы мағынасына қарай салыстырылады.
Декодерлер авторегрессиялық түрде жұмыс істейді: әр токен өзін және алдыңғы токендерді көреді, ал модель келесі токенді болжайды. Бұл — мәтін генерациялау архитектурасы. Қазіргі үлкен тілдік модельдердің көпшілігі — декодерлер. Мысалдар: Llama, Gemma, SmolLM, сондай-ақ GPT және Qwen модельдер топтары.
Энкодер-декодерлер екі бөлікті біріктіреді: энкодер кіріс мәтінді тұтас оқиды, декодер соның негізінде жаңа мәтін жазады. Оларды аударма жасау, қысқаша мазмұндау және сұрақтарға жауап беру сияқты жауабы нақты кіріс мәтінге тәуелді тапсырмаларда қолданады. Мысалдар: T5, BART, Marian. Сөйлеуді тану моделі Whisper те осы сызбамен құрылған.

M маскасы зейінге қай позициялар қолжетімді екенін белгілейді. Ол бағаларға softmax-қа дейін қосылады: рұқсат етілген позицияларға нөл, тыйым салынғандарына минус шексіздік сәйкес келеді, сондықтан олардың салмағы нөлге айналады. Энкодер болашақ токендерді жасырмайды, декодер жасырады. Энкодер-декодерде үш бөлек зейін бар: энкодердің зейіні, декодердің зейіні және декодердің энкодер шығысына бағытталған зейіні. Формулаларда x — кіріс тізбегі, y — шығыс тізбегі, h_i — i-токеннің векторы, P — ықтималдық, ∏ таңбасы — көбейтінді.
Трансформерлердің Mixture of Experts (MoE, «сарапшылар қоспасы») деген түрі бар. Мұндай модельде қабаттардың бір бөлігі «сарапшылар» жиынымен, яғни шағын нейрондық желілермен алмастырылған, ал маршрутизатор әр токенді қай сарапшыларға беру керегін шешеді. Hugging Face сипаттамасына сәйкес, әр токенмен сарапшылардың бір бөлігі ғана жұмыс істейді, сондықтан есептеу көлемі сол өлшемдегі тығыз модельге қарағанда азырақ. Дегенмен жадқа барлық сарапшылар жүктеледі, сондықтан жадқа қойылатын талап параметрлердің толық санымен анықталады.
Желі архитектурасы, генерациялау тәсілі және деректер түрі — әртүрлі сипаттамалар: бір модель трансформер болып, MoE-ні қолданып, кескіндермен жұмыс істей алады.
Диффузиялық модельдер кескін, бейне және дыбыс жасайды. Олар кездейсоқ шудан бастап, оны бірнеше қадамда мәтіндік сипаттамаға сәйкес кескінге айналдырады. Қадамдар саны модельге байланысты: кейбірінде бірден төртке дейін болса, басқаларында бірнеше ондағанға жетеді. Мысал — Stable Diffusion; FLUX те соған ұқсас тәсілді қолданады. Оларға Diffusers кітапханасы арналған.
Үйірткілі желілер мен Vision Transformer кескіндермен жұмыс істейді. ResNet және ConvNeXT сияқты үйірткілі желілер суретті шағын терезелермен қарап шығады. Vision Transformer — кескіндерге арналған трансформер: ол суретті бөліктерге бөліп, оларды токендер тізбегі ретінде өңдейді.
Мультимодальды модельдер әртүрлі типтегі деректерді қабылдайды. CLIP кескіндер мен мәтіндерді ортақ кеңістікте сәйкестендіреді. Көру-тіл модельдері суретті сұрақпен бірге алып, мәтінмен жауап береді.
Күй кеңістігі модельдері (state space models) — трансформердің баламасы. Солардың бірі, Mamba, зейін механизмінсіз жұмыс істейді. Ол трансформер тым көп есептеуді қажет ететін ұзын тізбектерге арнап жасалған.
Чат үшін әдетте диалог жүргізуге үйретілген декодерді, ал құжаттардан іздеу үшін эмбеддинг моделін таңдайды. Жергілікті іске қосу бағдарламасы таңдалған модельдің архитектурасымен жұмыс істей алуы керек, әйтпесе файл жүктелмейді.
Модель картасын қалай оқу керек
Әр модельдің картасы бар — бұл репозиторийдегі README файлы. Ол метадеректер блогынан және мәтіннен тұрады; мәтінде автор модельдің мақсаты мен шектеулерін, оқыту параметрлерін, пайдаланылған деректерді және бағалау нәтижелерін сипаттайды.
Метадеректердегі лицензия коммерциялық мақсатта пайдалануға рұқсат бар-жоғын анықтайды. Тілдер тізімі модельдің қай тілдерде жұмыс істейтінін көрсетеді. Тапсырма түрі модельдің мәтін генерациялауға, жіктеуге немесе сөйлеуді тануға арналғанын білдіреді. Базалық модель өрісі осы нұсқаның неге негізделгенін көрсетеді және қосымша оқытылған әрі квантталған нұсқаларды табуға көмектеседі.
Тілдік модельдердің атауларында base және instruct белгілері кездеседі. Базалық модель мәтінді тек жалғастырады. Instruct-модель нұсқауларды орындауға және диалог жүргізуге қосымша үйретілген; чат пен ассистенттерге дәл осындай модель қажет.
Кейбір жария модельдердің файлдарын сұраныс жіберу арқылы ғана жүктеп алуға болады; мұндай режим gated деп аталады. Пайдаланушы аккаунтына кіріп, модель бетін ашады да, сұраныс жібереді. Автор пайдаланушының аты мен электрондық пошта мекенжайын алады және қолжетімділікті автоматты түрде немесе қолмен тексергеннен кейін ашады.
Салмақтар негізгі екі форматта таратылады. Safetensors — transformers және басқа Python кітапханаларына арналған формат, ол тек тензорларды сақтайды. GGUF — жылдам жүктеуге оңтайландырылған бинарлық формат. llama.cpp авторы әзірлеген бұл формат тензорларды метадеректермен бірге сақтайды әрі llama.cpp, Ollama және LM Studio бағдарламаларында қолданылады. Үй компьютерінде іске қосу үшін әдетте модельдің GGUF нұсқасын іздейді.
Чат-модельдердің чат шаблоны бар. Ол хабарламалар тізімінің басқарушы токендері бар мәтін жолына қалай айналатынын белгілейді. Басқарушы токендер қате болса, жауаптардың сапасы күрт төмендейді. Жергілікті іске қосу бағдарламалары шаблонды модель файлынан өздері алады. transformers кітапханасында чат-pipeline осы шаблонды қолданады, ал модель тікелей шақырылғанда хабарламалардың форматын әзірлеуші өзі белгілейді.
Кванттау және жад
Кванттау — модель салмақтарын бұрынғыдан аз бит қолданып жазу. Файл кішірейеді, сондықтан модельді қуаты азырақ компьютерде іске қосуға болады. Бұл ретте, әсіресе сығу дәрежесі жоғары болғанда, жауаптардың сапасы төмендеуі мүмкін; сапаның қаншалықты төмендейтіні модельге байланысты және пайдаланушының өз тапсырмалары арқылы тексеріледі.
Hub құжаттамасында көрсетілген GGUF кванттау түрлері:
| Түрі | Бір салмаққа шаққандағы бит саны |
| F16 | 16 |
| Q8_0 | 8,5 |
| Q6_K | 6,5625 |
| Q5_K | 5,5 |
| Q4_K | 4,5 |
| IQ4_XS | 4,25 |
| Q3_K | 3,4375 |
| Q2_K | 2,625 |
Кестеде салыстыру үшін F16 түрі де келтірілген: бұл — сығылмаған бастапқы 16 биттік салмақтар. Файл атауларында Q4_K_M сияқты белгілер кездеседі. S, M немесе L суффиксі кванттау нұсқасын көрсетеді: онда тензорлардың бір бөлігі жоғарырақ немесе төменірек дәлдікпен сақталады, сондықтан файл өлшемі де, сапасы да өзгеше болады.
Салмақтардың көлемін бағалау үшін параметрлер санын бір салмаққа шаққандағы бит санына көбейтіп, 8-ге бөледі. 8 млрд параметрі бар модель үшін Q4_K түрінде бұл шамамен 4,5 ГБ, 27 млрд параметрі бар модель үшін IQ4_XS түрінде шамамен 14,3 ГБ болады. Файлдың нақты өлшемі репозиторий бетінде көрсетілген.
Модельге файлдың көлемінен көбірек жад қажет. Салмақтардан бөлек, жад контекске де жұмсалады; контекст — модель бір сұраныста ескеретін мәтін: жүйелік хабарлама, диалог тарихы, сұрақ және жауап. Контекст неғұрлым ұзын болса, жад соғұрлым көп қажет. Модель бейнежадқа толық сыймаған кезде llama.cpp қабаттардың бір бөлігін процессорда есептей алады, бірақ бұл жағдайда генерация баяулайды. Жад жетпесе, контексті қысқартады немесе кішірек модель таңдайды.
transformers кітапханасында кванттауды bitsandbytes орындайды. Салмақтарды 8 биттік форматта жүктегенде олардың көлемі 16 биттік салмақтармен салыстырғанда екі есе, ал 4 биттік форматта жүктегенде төрт есе азаяды. NVIDIA бейнекарталарында 4 биттік режим үшін Pascal буыны немесе одан жаңасы қажет.
Неден бастау керек
Алғаш танысу үшін ештеңе орнатудың қажеті жоқ: Spaces бөлімін ашып, бірнеше модельді браузерде сынап көру жеткілікті.
Келесі қадам — huggingface.co сайтына тіркелу. Аккаунт сұраныс арқылы ашылатын модельдерге қол жеткізу үшін және өз жұмыстарын жариялау үшін керек. Аккаунт баптауларында қол жеткізу токені жасалады; бағдарламалар осы кілт арқылы пайдаланушының жеке басын растайды. Оның мәтін токендерімен атауы ғана ортақ.
Терминалда платформамен жұмыс істеу үшін hf утилитасы қолданылады; ол huggingface_hub пакетімен бірге орнатылады. Утилита токен арқылы жүйеге кіреді және Hub-тан репозиторийлерді тұтас немесе жеке файлдарды жүктеп алады.
Python-да модельмен жұмысты бастаудың ең қысқа жолы — transformers кітапханасындағы pipeline функциясын қолдану. Оны шақырғанда тапсырма түрі мен модель атауы көрсетіледі, сонда функция салмақтарды жүктеп алып, модельді жұмысқа дайындайды. Содан кейін оған сұраныс беріледі. Егер сұраныс рөлдері бар хабарламалар тізімі түрінде берілсе, чат шаблоны автоматты түрде қолданылады; ал қарапайым мәтін жолын модель жай ғана жалғастырады. Алғашқы тәжірибелер үшін осы жеткілікті, ал сол кітапхананың модель және токенизатор кластары баптауға көбірек мүмкіндік береді.
Жергілікті іске қосу
Жергілікті іске қосу дегеніміз — модельдің провайдер серверінде емес, пайдаланушының компьютерінде жұмыс істеуі. Модель жүктеп алынғаннан кейін интернетсіз жұмыс істейді, ал сұраныстар үшін ақы төлеу қажет емес. Бағдарламаның өзі және оған қосылған құралдар деректерді сыртқа жібермесе, деректер компьютерде қалады. Шектеулері — жад көлемі мен генерация жылдамдығы.
Hub-та жергілікті бағдарламалар тізімі жүргізіледі.
llama.cpp — GGUF форматындағы модельдерге арналған, C/C++ тілінде жазылған қозғалтқыш. Ол процессорда да, бейнекартада да жұмыс істейді; құрамында консольдік чат және OpenAI-мен үйлесімді API бар сервер бар. Пакет менеджерлері арқылы орнатылады: Windows-та winget, macOS пен Linux-та Homebrew. Модель Hub-тағы репозиторий атауымен көрсетіледі, ал бағдарлама файлды өзі жүктеп алады.
Ollama — фондық қызметі және жергілікті API-і бар пәрмен жолы утилитасы. Ол Hub-тағы GGUF-модельдерді «hf.co/автор/репозиторий» түріндегі мекенжай арқылы іске қосады; мекенжайға қажетті кванттауды қосуға болады. Кванттау көрсетілмесе және репозиторийде Q4_K_M болса, бағдарлама осы нұсқаны таңдайды.
LM Studio — графикалық интерфейсі бар жұмыс үстелі қолданбасы: модельдерді іздеу, чат және жергілікті сервер бір терезеде. Терминалда жұмыс істемейтіндерге қолайлы.
Алғаш іске қосу үшін LM Studio ресми сайттан орнатылады. Модельдерді іздеу бөлімінде GGUF форматындағы instruct-модель таңдалып, жүктегеннен кейін де компьютерде бос жад қалатындай нұсқасы жүктеп алынады. Содан кейін чат терезесінде жүктеп алынған модельді таңдап, оның жадқа жүктелуін күтеді де, алғашқы сұрақты қояды.
Сол тізімде Apple Silicon процессорлары бар Apple компьютерлеріне арналған MLX LM бар. Сондай-ақ онда vLLM және SGLang бар — бұлар бейнекарталарда көптеген сұранысты өңдеуге арналған серверлер.
Бағдарламалар аккаунт баптауларындағы Local Apps бөлімінде таңдалады. Осыдан кейін модель бетіндегі Use this model мәзірінде үйлесімді бағдарламалар мен іске қосудың дайын пәрмені көрсетіледі. Оны терминалға көшіру ғана қалады.
Кітапханалар
Hugging Face ашық кітапханалар жинағын дамытып келеді, толық тізімі құжаттама көрсеткішінде берілген. Модельді жұмыс үстелі қолданбасында іске қосу үшін олар қажет емес; кітапханалар өз бағдарламаларын әзірлегенде керек болады.
Модельдерді іске қосу. Негізгі кітапхана — transformers: ол PyTorch-тағы модельдерді жүктейді, іске қосады және оқытады. tokenizers мәтінді токендерге жылдам бөледі, ал safetensors салмақтарды қауіпсіз форматта сақтауға арналған. transformers.js модельдерді тікелей браузерде іске қосады.
Деректер және іздеу. datasets деректер жиындарын жүктейді және өңдейді. sentence-transformers мағыналық іздеуге арналған эмбеддинг модельдерімен және табылған құжаттардың ретін нақтылайтын қайта саралау модельдерімен жұмыс істейді.
Оқыту. peft арқылы LoRA және басқа әдістермен аз ғана параметрді өзгертіп, модельді қосымша оқытуға болады. trl тілдік модельдерді оқытудың дайын циклдерін қамтиды. accelerate оқытуды бірнеше бейнекартаға бөледі, bitsandbytes модельдерді 8 және 4 битке кванттайды, optimum оқыту мен инференсті жеделдетеді.
Платформа және қолданбалар. huggingface_hub — Hub-тың Python-клиенті, онымен бірге hf пәрмен жолы утилитасы орнатылады. gradio Python тілінде веб-интерфейстер, ал smolagents агенттер жасайды. lighteval тілдік модельдерді бағалайды, trackio эксперименттерді тіркеп отырады. Кескін, бейне және дыбыс генерациялауға diffusers арналған.
Жергілікті модельді жақсарту тәсілдері
Тәсілдер арзанынан қымбатына қарай берілген. Алғашқы жетеуі модель салмақтарын өзгертпейді және оқытуды қажет етпейді.
Модель мен кванттауды таңдау. Сапаға ең көп әсер ететін — модельдің өзі. Жадқа сыятын және қажетті тілде жұмыс істейтін бірнеше модельді салыстырып, пайдаланушының өз тапсырмаларын орындау нәтижелеріне қарай біреуін таңдайды. Параметрлер саны өздігінен сапаны анықтамайды: тапсырмаға арнап оқытылған шағын модель ірі әмбебап модельден жақсы болып шығуы мүмкін.
Генерация параметрлері. Температура мен top-p жауаптың кездейсоқтығын басқарады: мәндері төмен болса, жауаптар тұрақтырақ, жоғары болса, алуан түрлірек болады. Контекст ұзындығы модельдің бір мезгілде қанша мәтін көретінін, ал токендер лимиті жауаптың ең үлкен ұзындығын анықтайды. Пайымдау режимі бар модельдерде жауапты жеделдету үшін оны қарапайым тапсырмаларда өшіріп қояды.
Чат шаблоны. Сұраныстар модельдің өз шаблонымен пішімделуі керек. Жауаптар күтпеген жерден нашарласа, алдымен дұрыс шаблон қолданылып тұрғаны тексеріледі.
Жүйелік промпт және мысалдар. Жүйелік промптта модельдің рөлі мен жауап форматы беріледі. Сұраныстағы бірнеше «сұрақ — жауап» үлгісі модельге одан не талап етілетінін ешқандай оқытусыз көрсетеді.
Құжаттардан іздеу (RAG). Құжаттар фрагменттерге бөлініп, әрқайсысы үшін эмбеддинг есептеледі. Пайдаланушы сұрағына мағынасы жағынан жақын фрагменттер модельге сұрақпен бірге беріледі. Осылайша модель өзінің оқыту деректерінде болмаған мәліметтерге сүйеніп жауап береді. Эмбеддингтер sentence-transformers кітапханасымен есептеледі.
Құралдар және агенттер. Модель функцияны аргументтермен шақыруға сұраныс жібереді, ал бағдарлама есептейді, іздейді немесе кодты іске қосады. Нәтиже диалогқа қосылады, және модель оны жауабында пайдаланады. Агенттер жасау үшін Hugging Face-те smolagents кітапханасы бар.
Құрылымдалған шығыс. Жауап JSON схемасымен немесе грамматикамен шектеледі. Қозғалтқыш әр қадамда схеманы бұзбайтын токендерге ғана рұқсат береді, сондықтан жауапты бағдарламамен талдауға болады. llama.cpp-де бұл үшін грамматикалар қолданылады. Жауап бәрібір тексеріледі: ол токендер лимитіне жетіп үзіліп қалуы мүмкін, ал дұрыс құрылым мәндердің дұрыстығына кепілдік бермейді.
Қосымша оқыту. Пайдаланушының өз мысалдары негізінде модельдің жұмысын өзгертетін LoRA адаптері оқытылады. Бұл тәсілге келесі бөлім арналған.
Дистилляция. Шағын модель үлкен модельдің жауаптарын қайталауға үйретіледі. Мақсат — жадты азырақ қажет ететін шағын модельдің сапасын үлкен модельдің сапасына жақындату.
Құжаттардан іздеу модельге мәлімет жетіспегенде көмектеседі. Құралдар модель есептеуде қателескенде көмектеседі. Қосымша оқыту жауаптардың стилін немесе форматын өзгерту не модельді нақты бір мамандандырылған тапсырманы орындауға үйрету қажет болғанда қолданылады.
Әр қадамның нәтижесі бірдей тапсырмалар жиынында алдын ала белгіленген өлшем бойынша, мысалы дұрыс жауаптардың үлесі бойынша, тексеріледі. Токендер кездейсоқ таңдалғанда жауаптар әр іске қосылған сайын өзгереді, сондықтан тексеру бірнеше рет қайталанып, орташа мәндер салыстырылады. Тілдік модельдерді бағалау үшін Hugging Face-те lighteval кітапханасы бар.
Қосымша оқыту: LoRA және QLoRA
Толық қосымша оқыту модельдің барлық салмақтарын өзгертеді және көп жадты қажет етеді. PEFT әдістерімен оқыту кезінде модель параметрлерінің аз ғана бөлігі немесе жаңадан қосылған аздаған параметр ғана өзгертіледі. PEFT құжаттамасына сәйкес, бұл есептеу мен сақтау шығындарын азайтады, ал сапасы толық қосымша оқытумен шамалас болуы мүмкін.
Ең кең тараған әдіс — LoRA. Салмақтардың өзгерісі төмен рангілі екі шағын матрицамен беріледі, ал бастапқы салмақтар матрицасы өзгермейді. Оқытудың нәтижесі — модельден көп есе кіші жеке адаптер файлы. Адаптер өзі оқытылған базалық модельмен ғана жұмыс істейді. Оны модельге іске қосу кезінде қосады немесе модельмен біріктіреді; біріктірілген жағдайда ол генерацияны баяулатпайды.
LoRA рангі матрицалардың өлшемін белгілейді: ол неғұрлым кіші болса, оқытылатын параметрлер соғұрлым аз. Масштабтау коэффициенті адаптердің әсер ету күшін анықтайды. Модульдер тізімі LoRA қабаттарының қайда қосылатынын көрсетеді; әдетте бұл — зейін блоктары.
QLoRA LoRA-ны кванттаумен ұштастырады: базалық модель 4 биттік форматта жүктеліп, сол модельге қосылған адаптердің салмақтары оқытылады. Осылайша модельді толық нұсқасы жадына сыймайтын бейнекартада қосымша оқытуға болады. bitsandbytes құжаттамасына сәйкес, 8 және 4 биттік режимде қосымша параметрлер ғана оқытылады. Әдістің басқа нұсқаларының ішінен құжаттамада rsLoRA және DoRA аталған.
Оқыту циклінің өзін TRL кітапханасы орындайды. Дайын мысалдар негізінде оқыту (SFT) ең жиі қолданылады: модельге «сұраныс — дұрыс жауап» жұптары көрсетіледі. DPO әдісінде модель қалаулы жауап пен қабылданбаған жауаптан тұратын жұптар негізінде оқытылады. GRPO нығайту арқылы оқытуға (reinforcement learning) жатады. Басқа модельдің білімін дистилляциялауға жеке класс арналған.
Алдымен Hub-та тапсырмаға сай дайын модель немесе адаптер бар-жоғы тексеріледі. Содан кейін мысалдар жиналып, олардың бір бөлігі тексеруге қалдырылады және сол бөлікте базалық модельдің жауаптары бағаланады. Адаптер оқытылғаннан кейін нәтиже сол тапсырмаларда базалық модельмен салыстырылады. Адаптер модельмен біріктіріледі және қажет болса, модель llama.cpp құралдарымен GGUF форматына түрлендіріледі.
Қосымша оқыту модельдің жұмысы жақсаратынына кепілдік бермейді. Мысал аз болса, адаптер модельдің жұмысын жақсартпауы мүмкін, ал басқа модельдің жауаптары негізінде оқытылса, сол модельдің қателерін де қайталайды. Сондықтан тексеруге қалдырылған тапсырмаларда базалық модельмен салыстыру міндетті.
Қазақ тіліне арналған модельдер
Hub-та қазақ тіліне бейімделген модельдер бар. Назарбаев Университеті жанындағы ISSAI институты Qwen3.5 Kazakh жинағын жариялайды; оған instruct-модельдер және кеңейтілген сөздікпен қосымша оқытылған базалық модель кіреді. Жинақта 4B, 9B және 35B-A3B деп белгіленген үш нұсқа бар; параметрлердің нақты саны мен файлдардың өлшемі әр модельдің бетінде көрсетілген.
Қазақ тілінде жұмыс істейтін басқа модельдерді Hub-тың модельдер бетіндегі тіл сүзгісі арқылы табуға болады. Тіл модель картасының метадеректерінде көрсетіледі.
Жаңадан бастаушыға арналған әрекет реті
- huggingface.co сайтына тіркеліп, Spaces-те бірнеше модельді ештеңе орнатпай сынап көру.
- Компьютердің бейнежадының немесе жедел жадының көлемін анықтау.
- Осы жадқа сыятын модель мен кванттауды таңдау.
- Ollama, LM Studio немесе llama.cpp орнатып, модельді іске қосу.
- Дұрыс жауаптары бар типтік сұрақтар жиынын құрастырып, сапаны сол жиында өлшеу.
- Генерация параметрлері мен жүйелік промптты баптап, өлшеуді қайталау.
- Қателер мәліметтің жетіспеуіне немесе есептеуге байланысты болса, өз құжаттарынан іздеуді немесе құралдарды қосу.
- Алдыңғы қадамдармен модельді одан әрі жақсарту мүмкін болмағанда қосымша оқытуға көшу.
This article covers what the Hugging Face platform offers, which model architectures exist, how to run a language model on your own computer, and how to improve its output. The figures come from the official documentation as of December 2026.
What Hugging Face is
Hugging Face is an American company and the platform of the same name, where machine learning models, datasets and demo applications are published. The platform is often called “the GitHub of machine learning”: every project is stored as a Git repository with version history, and public repositories are open to everyone.
The company was founded in 2016 by Clément Delangue, Julien Chaumond and Thomas Wolf and is headquartered in New York. Its first product was a chatbot for teenagers. After the chatbot's model was released as open source, the company switched to building a platform for machine learning.
In September 2026 Nvidia announced an agreement to acquire Hugging Face. The deal is expected to close in the first half of 2027, after regulatory approval.
The platform hosts more than 3 million models, 1 million datasets and 2 million applications; these numbers are given in the documentation. The facts about the company are taken from the Wikipedia article.
What the platform offers
The central part of the platform is called the Hub. Signing up and downloading public models are free; computation on the platform's servers may be paid.
Models are repositories with model weights, configuration and a description. Weights are the numeric parameters of a model, fitted during training. This is where a model is downloaded from to be run locally. Applying a trained model to new data is called inference.
Datasets are collections of data for training and evaluating models. The contents of a dataset can be viewed in the browser.
Spaces is hosting for demo applications. A model's author publishes an interface, and a visitor tries the model in the browser without installing anything. Applications come in three kinds: Gradio, Docker and static HTML.
Inference Providers lets you call models through an API without your own hardware. Requests are served by third-party provider companies. The documentation index claims more than 200,000 models, but only those served by at least one provider are available through the API. For chat models there is an interface compatible with the OpenAI API: in an existing program you change the address, the access key and the model name.
Inference Endpoints runs a chosen model on dedicated servers managed by the platform.
The platform also has Tasks, a catalogue of tasks with example models and data, and Leaderboards, tables that compare models.
Which model architectures exist
An architecture is the structure of a neural network: which layers it consists of and how data passes through them. The architecture determines which tasks a model solves and which program runs it.

Most models on the Hub are built on the transformer architecture. Google researchers proposed it in 2017 in the paper Attention Is All You Need. Before processing, text is split into tokens: words, parts of words or single characters. The core of a transformer is the attention mechanism: while processing a token, the model takes into account the tokens of the sequence available to it and decides by itself which of them matter. According to the Hugging Face course, transformers fall into three kinds.
The diagram shows a single attention computation. Three vectors are derived from the vector of each token: a query, a key and a value. The matrices Q, K and V are made of these vectors for all tokens. Dot products of queries and keys give similarity scores between tokens. The softmax function turns the scores into weights that sum to one in each row. The new vector of a token is the sum of the values taken with these weights. Dividing by √d_k, where d_k is the dimension of the keys, keeps the scores from growing with the dimension.
Encoders read the whole text: attention sees all the words of a sentence at once, to the left and to the right of the current one. These models do not generate text. They are used for classification, named entity recognition and finding an answer in a given text. Examples are BERT, DistilBERT and ModernBERT. Embedding models are often built on encoders: they turn a text into a numeric vector, and texts are then compared by meaning through these vectors.
Decoders work autoregressively: each token sees itself and the preceding tokens, and the model predicts the next one. This is the architecture for text generation. Most modern large language models are decoders. Examples are Llama, Gemma and SmolLM, as well as the GPT and Qwen families.
Encoder-decoders combine both parts: the encoder reads the whole input text, and the decoder writes a new text from it. They are used where the answer depends on a specific input: translation, summarization, question answering. Examples are T5, BART and Marian. The Whisper speech recognition model follows the same scheme.

The mask M sets which positions attention may use. It is added to the scores before softmax: allowed positions get zero, forbidden ones get minus infinity, and their weight becomes zero. An encoder does not hide future tokens; a decoder does. An encoder-decoder has three separate attentions: the encoder's, the decoder's, and the decoder's attention to the encoder output. In the formulas, x is the input sequence, y is the output sequence, h_i is the vector of token i, P is a probability, and the sign ∏ is a product.
Transformers have a variety called Mixture of Experts (MoE). In such a model some layers are replaced by a set of “experts”, small neural networks, and a router decides which experts receive each token. According to the Hugging Face description, only some of the experts work on each token, so less computation is needed than in a dense model of the same size. All the experts are still loaded into memory, so memory requirements are set by the total number of parameters.
Network architecture, generation method and data type are separate properties: one model can be a transformer, use MoE and work with images.
Diffusion models create images, video and audio. They start from random noise and turn it into an image that matches a text description in several steps. The number of steps depends on the model: from one to four up to several dozen. An example is Stable Diffusion; FLUX uses a similar approach. The Diffusers library is intended for them.
Convolutional networks and the Vision Transformer work with images. Convolutional networks, such as ResNet and ConvNeXT, scan a picture with small windows. The Vision Transformer is a transformer for images: it splits a picture into patches and processes them as a sequence of tokens.
Multimodal models accept data of different types. CLIP matches images and texts in a shared space. Vision-language models receive a picture together with a question and answer in text.
State space models are an alternative to the transformer. One of them, Mamba, does without the attention mechanism. It was developed for long sequences, on which a transformer needs too much computation.
For chat, a decoder trained for dialogue is the usual choice; for document search, an embedding model. The program used for local inference must support the architecture of the chosen model, otherwise the file will not load.
How to read a model card
Every model has a card, the README file in its repository. It consists of a metadata block and a text in which the author describes the purpose and limitations of the model, the training parameters, the data used and the evaluation results.
The license in the metadata determines whether commercial use is allowed. The list of languages shows which languages the model works with. The task type says what the model is meant for: text generation, classification, speech recognition. The base model field shows what this variant is built on and helps to find fine-tuned and quantized versions.
Names of language models often carry the labels base and instruct. A base model only continues text. An instruct model is additionally trained to follow instructions and hold a dialogue, and it is the one needed for chat and assistants.
The files of some public models can be downloaded only on request; this mode is called gated. The user signs in, opens the model page and sends a request. The author receives the user's name and email address and grants access automatically or after a manual review.
Weights are distributed in two main formats. Safetensors is the format for transformers and other Python libraries; it stores only tensors. GGUF is a binary format optimized for fast loading. It stores tensors together with metadata, was developed by the author of llama.cpp and is used in llama.cpp, Ollama and LM Studio. To run a model on a home computer, people usually look for its GGUF version.
Chat models have a chat template. It defines how a list of messages is turned into a string with control tokens. With the wrong control tokens the quality of answers drops sharply. Programs for local inference take the template from the model file themselves. In transformers the chat pipeline applies it, and when the model is called directly the developer is responsible for the formatting.
Quantization and memory
Quantization means storing model weights with fewer bits. The file gets smaller, and the model can be run on a less powerful computer. The quality of answers may drop, especially with strong compression; how much depends on the model and has to be checked on your own tasks.
GGUF quantization types according to the Hub documentation:
| Type | Bits per weight |
| F16 | 16 |
| Q8_0 | 8.5 |
| Q6_K | 6.5625 |
| Q5_K | 5.5 |
| Q4_K | 4.5 |
| IQ4_XS | 4.25 |
| Q3_K | 3.4375 |
| Q2_K | 2.625 |
The F16 row is the original 16-bit weights without compression; it is given for comparison. File names contain labels such as Q4_K_M. The suffix S, M or L marks a variant of the quantization: some tensors in it are stored with higher or lower precision, so both file size and quality differ.
To estimate the size of the weights, multiply the number of parameters by the bits per weight and divide by 8. For a model with 8 billion parameters in Q4_K this is about 4.5 GB; for a model with 27 billion parameters in IQ4_XS, about 14.3 GB. The exact file size is shown on the repository page.
More memory is needed than the file takes. Besides the weights, memory is spent on the context: the text the model takes into account in one request, that is, the system message, the dialogue history, the question and the answer. The longer the context, the more memory. When a model does not fit into video memory entirely, llama.cpp can compute some of the layers on the CPU, but generation becomes slower. If memory runs short, the context is reduced or a smaller model is chosen.
In the transformers library quantization is done by bitsandbytes. Compared with 16-bit weights, loading in 8 bits halves their size, and loading in 4 bits cuts it to a quarter. On NVIDIA graphics cards the 4-bit mode requires the Pascal generation or newer.
Where to start
A first look requires no installation: it is enough to open the Spaces section and try a few models in the browser.
The next step is to sign up at huggingface.co. An account is needed for gated models and for publishing your own work. An access token is created in the account settings; it is a key that programs use to confirm the user's identity. It shares only its name with text tokens.
From the terminal, the platform is handled by the hf utility, which is installed together with the huggingface_hub package. The utility signs in with a token and downloads whole repositories or single files from the Hub.
In Python the shortest way to a model is the pipeline function from the transformers library. It is called with a task type and a model name, and the function downloads the weights and prepares the model for work. Then a request is passed to it. If the request is a list of messages with roles, the chat template is applied automatically; a plain string is simply continued by the model. This is enough for first experiments, and the model and tokenizer classes of the same library give more settings.
Local inference
Local inference means that the model runs on the user's computer and not on a provider's server. Once downloaded, the model works without the internet and without a fee per request. The data stays on the computer, unless the program itself or the tools connected to it send the data out. The limits are the amount of memory and the speed of generation.
The Hub maintains a list of local applications.
llama.cpp is an engine written in C/C++ for models in the GGUF format. It runs on the CPU and on the GPU and includes a console chat and a server with an OpenAI-compatible API. It is installed through package managers: winget on Windows, Homebrew on macOS and Linux. The model is specified by the name of its repository on the Hub, and the program downloads the file by itself.
Ollama is a command-line utility with a background service and a local API. It runs GGUF models from the Hub by an address of the form “hf.co/author/repository”, to which the required quantization can be added. If no quantization is given, Q4_K_M is used when the repository has it.
LM Studio is a desktop application with a graphical interface: model search, chat and a local server in one window. It suits those who do not work in a terminal.
For a first run, LM Studio is installed from the official website. In the model search section the user picks an instruct model in the GGUF format and downloads a variant that leaves memory to spare. Then, in the chat window, the user selects the downloaded model, waits until it is loaded into memory and asks the first question.
The same list includes MLX LM for Apple computers with Apple Silicon processors, as well as vLLM and SGLang, servers for handling many requests on GPUs.
The applications are enabled in the account settings, in the Local Apps section. After that, the Use this model menu on a model page shows the compatible applications and a ready command to run the model. All that is left is to copy it into the terminal.
Libraries
Hugging Face develops a set of open-source libraries; the full list is given in the documentation index. They are not needed to run a model in a desktop application; the libraries are required when developing your own programs.
Running models. The main library is transformers: it loads, runs and trains models on PyTorch. tokenizers handles fast splitting of text into tokens, and safetensors provides a safe format for storing weights. transformers.js runs models directly in the browser.
Data and search. datasets loads and processes datasets. sentence-transformers works with embedding models for semantic search and with reranking models, which refine the order of the documents found.
Training. peft implements fine-tuning with a small number of parameters, including LoRA. trl contains ready-made training loops for language models. accelerate distributes training across several GPUs, bitsandbytes quantizes models to 8 and 4 bits, and optimum speeds up training and inference.
Platform and applications. huggingface_hub is the Python client of the Hub; the hf command-line utility is installed with it. gradio builds web interfaces in Python, and smolagents builds agents. lighteval evaluates language models, and trackio keeps track of experiments. diffusers is intended for generating images, video and audio.
Ways to improve a local model
The methods are listed from cheap to expensive. The first seven do not change the model's weights and require no training.
Choosing a model and a quantization. The model itself affects quality the most. Several models that fit into memory and support the required language are compared, and the choice is made by the results on your own tasks. The number of parameters alone does not determine quality: a small model trained for a task can turn out better than a large general-purpose one.
Generation parameters. Temperature and top-p control the randomness of the answer: at low values answers are more stable, at high values more varied. The context length determines how much text the model sees at once, and the token limit sets the maximum length of the answer. In models with a reasoning mode, the mode is switched off on simple tasks to speed up the answer.
Chat template. Requests must be formatted with the model's own template. If answers suddenly get worse, the first thing to check is whether the right template is applied.
System prompt and examples. The system prompt sets the model's role and the format of the answer. A few “question and answer” samples in the request show the model what is required of it, without any training.
Document search (RAG). Documents are split into chunks, and an embedding is computed for each. The chunks closest in meaning to the user's question are passed to the model together with the question. This way the model answers from information that was not in its training data. Embeddings are computed with the sentence-transformers library.
Tools and agents. The model requests a function call with arguments, and the program performs a calculation, a search or a code run. The result is added to the dialogue, and the model uses it in its answer. For building agents, Hugging Face has the smolagents library.
Structured output. The answer is constrained by a JSON schema or a grammar. At each step the engine allows only the tokens that do not break the schema, so the answer can be parsed by a program. In llama.cpp grammars serve this purpose. The answer is still checked: it can be cut off at the token limit, and a correct structure does not guarantee correct values.
Fine-tuning. A LoRA adapter that changes the model's behaviour is trained on your own examples. The next section is devoted to this method.
Distillation. A small model is trained to reproduce the answers of a large one. The goal is to approach its quality with lower memory requirements.
Document search helps when the model lacks information. Tools help when it makes mistakes in calculations. Fine-tuning is used when the style or format of the answers has to change, or when the model has to learn a narrow task.
The result of each step is checked on the same set of tasks with a criterion defined in advance, for example the share of correct answers. When tokens are sampled randomly, answers change from run to run, so the check is repeated several times and the averages are compared. For evaluating language models, Hugging Face has the lighteval library.
Fine-tuning: LoRA and QLoRA
Full fine-tuning changes all the weights of a model and requires a lot of memory. PEFT methods train only a small part of the model's parameters or a small number of added ones. According to the PEFT documentation, this lowers the cost of computation and storage, and the quality can be comparable to full fine-tuning.
The most widespread method is LoRA. The change in the weights is defined by two small low-rank matrices, and the original weight matrix stays unchanged. The result of training is a separate adapter file that is many times smaller than the model. An adapter works only with the base model it was trained on. It is attached to that model at launch or merged into it, in which case it does not slow down generation.
The LoRA rank sets the size of the matrices: the smaller it is, the fewer trainable parameters there are. The scaling factor determines how strongly the adapter acts. The list of modules shows where LoRA layers are added; usually these are the attention blocks.
QLoRA combines LoRA with quantization: the base model is loaded in 4 bits, and the adapter weights are trained on top of it. This is how a model is fine-tuned on a graphics card whose memory cannot hold the full version. According to the bitsandbytes documentation, only the additional parameters are trained in 8-bit and 4-bit mode. Among other variants of the method, the documentation lists rsLoRA and DoRA.
The training loop itself is run by the TRL library. Training on ready examples (SFT) is used most often: the model is shown pairs of a request and the correct answer. The DPO method trains on pairs of a preferred and a rejected answer. GRPO belongs to reinforcement learning. A separate class handles distilling knowledge from another model.
First, the Hub is checked for a ready model or adapter for the task. Then examples are collected, part of them is set aside for testing, and the answers of the base model are evaluated on that part. After the adapter is trained, the result is compared with the base model on the same tasks. The adapter is merged with the model and, if needed, the model is converted to GGUF with the llama.cpp tools.
Fine-tuning does not guarantee an improvement. With few examples an adapter may give no gain, and when trained on the answers of another model it reproduces that model's mistakes as well. This is why the comparison with the base model on held-out tasks is mandatory.
Models for the Kazakh language
The Hub has models adapted to the Kazakh language. The ISSAI institute at Nazarbayev University publishes the Qwen3.5 Kazakh collection: instruct models and a base model further trained with an extended vocabulary. The collection has three variants labelled 4B, 9B and 35B-A3B; the exact number of parameters and the file sizes are given on each model's page.
Other models that support Kazakh can be found with the language filter on the Hub's models page. The language is given in the metadata of the model card.
Steps for a beginner
- Sign up at huggingface.co and try a few models in Spaces without installing anything.
- Find out how much video memory or RAM the computer has.
- Choose a model and a quantization that fit into this memory.
- Install Ollama, LM Studio or llama.cpp and run the model.
- Put together a set of typical questions with correct answers and measure quality on it.
- Adjust the generation parameters and the system prompt, then repeat the measurement.
- Add search over your own documents or tools if the mistakes come from missing information or from calculations.
- Move on to fine-tuning when the previous steps are exhausted.
Пікірлер 4
Жаңа Танымал