AI දැන් browser එක ඇතුළෙම: WebLLM කියන්නේ මොකක්ද?

Mic
By Mic

WebLLM කියන්නේ browser එක ඇතුළෙම AI model එකක් run කරන්න පුළුවන් system එකක්. සාමාන්‍යයෙන් AI chatbot එකක් use කරනකොට userගේ message එක server එකකට යවනවා. Server එකේ model එක run වෙලා response එක ආපහු browser එකට එනවා. ඒත් WebLLM වලදී මේක වෙනස්. Model එක browser එක තුළම load වෙලා local විදියට run වෙනවා. ඒ කියන්නේ userගේ message එක browser එකෙන් පිටට යවන්නේ නැහැ.

මේ concept එකේ main idea එක තමයි backend server එකක් නැතුව AI වැඩ කරවීම. Website එක open කරනකොට model files download වෙනවා. ඒ files browser cache එකේ save වෙනවා. ඊට පස්සේ user prompt එකක් type කරනකොට browser එකේ background worker එකක් model එක run කරනවා. Response එක generate වෙලා UI එකට පෙන්නනවා.

ගොඩක් අය හිතන්නේ මේ වගේ AI browser projects WebGL use කරනවා කියලා. හැබැයි WebGL mainly use කරන්නේ graphics render කරන්න. Example එකක් ලෙස 3D animations, particle effects, lighting, game graphics, neural network animations වගේ visual things වලට WebGL හොඳයි.

. LLM එකකට matrix calculations, tensor operations, attention layers, token generation වගේ GPU-heavy calculations ගොඩක් තියෙනවා. ඒ නිසා WebLLM use කරන්නේ WebGPU. WebGPU කියන්නේ GPU එකේ compute power directly use කරන්න පුළුවන් modern browser technology එකක්. මේක WebGL වලට වඩා AI inference වලට හොඳයි.

Website එකේ architecture එක සාමාන්‍යයෙන් මෙහෙමයි. Frontend එක React, Vue, හෝ plain JavaScript වලින් build කරනවා. User prompt එක Web Worker එකකට යවනවා. Worker එක WebLLM runtime එක use කරලා model එක run කරනවා. Runtime එක WebGPU use කරලා response generate කරනවා. Generated text එක token by token UI එකට stream වෙනවා. ඒ නිසා response එක එක පාරම එන්නේ නැතුව typing effect එකක් වගේ පෙන්නනවා.

WebLLM වල run කරන models සාමාන්‍යයෙන් smaller models. 70B වගේ huge model එකක් browser එකේ run කරන්න අමාරුයි. ඒ නිසා 1B, 3B, 7B වගේ smaller models use කරනවා. Model size එක අඩු කරන්න quantization use කරනවා. Example එකක් ලෙස 4-bit quantized model එකක් use කරනකොට RAM usage එකත් අඩු වෙනවා, speed එකත් හොඳ වෙනවා.

මේ concept එකේ biggest advantages තමයි privacy, low cost, සහ offline support. User data browser එකෙන් පිටට යන්නේ නැති නිසා privacy හොඳයි. Server එකකට request යවන්නේ නැති නිසා response fast. Model එක download වුනාට පස්සේ internet නැති වෙලාවකත් use කරන්න පුළුවන්. Developer කෙනෙකුට expensive GPU servers maintain කරන්න ඕනේ නැති නිසා backend cost එකත් අඩු වෙනවා.

හැබැයි limitationsත් තියෙනවා. Browser memory අඩු device වල model run වෙන්නේ slow වෙන්න පුළුවන්. Old laptops සහ phones වල performance weak වෙන්න පුළුවන්. WebGPU support නැති browsers වල මේක හරියට වැඩ නොකරන්නත් පුළුවන්. ඒ වගේම browser-based models server-based large models වලට වඩා ටිකක් weaker වෙන්න පුළුවන්.

WebLLM use කරලා local chatbot, coding assistant, PDF summarizer, offline study tool, translation tool, smart search box, සහ private AI assistant වගේ projects build කරන්න පුළුවන්. WebGL use කරන්න පුළුවන් website එක visually attractive කරන්න. Example ලෙස 3D avatar, floating particles, animated background, token animation වගේ graphics add කරන්න පුළුවන්. හැබැයි actual AI calculations run වෙන්නේ WebGPU වලින්.

-/github.com/mlc-ai/web-llm

Share This Article