Upgrade to Pro — share decks privately, control downloads, hide ads and more …

빠르고 비용 효율적으로 LLM 서빙하기

kakao
November 01, 2024

빠르고 비용 효율적으로 LLM 서빙하기

#Kanana #LLM #Inference

경제적인 LLM 서비스 개발을 목표로 LLM의 추론 비용을 최적화하고자 고민하고 실험했던 다양한 내용을 공유합니다.

발표자 : andrew.0
AI Engineering 조직 리더 andrew입니다. 저희의 추론 최적화 시도에 관해서 말씀드리고자 합니다.

kakao

November 01, 2024
Tweet

More Decks by kakao

Other Decks in Programming

Transcript

  1. ߊ಴੗ܐ੘ࢿ੗ࣗѐ সޖ߂োҳ ↟ ݽ؛୶ۿ *OGFSFODF ࢲ࠺झઁҕ ↟ ୶ۿ *OGFSFODF ୭੸ച

    ↟ ೟ण 5SBJOJOH ୭੸ച ↟ ৔৉ழօࠗఠ"1*ۨ߰੄য೒ܻா੉࣌ө૑
  2. ೞ٘ਝয )BSEXBSF ജ҃ Ҋ۰ࢎ೦ ↟ दझమҳ୷࠺ਊ ↟ दझమ਍৔࠺ਊ ↟ ࣗ೐౟ਝয৮ࢿب

    ↟ ਽׹ࣘب MBUFODZ ↟ ୊ܻ۝ UISPVHIQVU ↟ ؘ੉ఠࣃఠਤ஖ ↟ ߧਊࢿ HFOFSBMJUZ ௿ۄ਋٘ࢲ࠺झ "*੹ਊ஝ (16 O7JEJB(16 PO - QSFNJTF --.ݽ؛ࢲࡂਊਵ۽O7JEJB(16ܳPO - QSFNJTF਍৔
  3. --.୶ۿ୭੸ചӝࣿ *O fl JHIUCBUDIJOH $POUJOVPVTCBUDIJOH ,7DBDIJOH 1SF fi YDBDIJOH "UUFOUJPOQBHFEBUUFOUJPO

     fl BTI BUUFOUJPO ,FSOFMGVTJPO 5FOTPSQBSBMMFM 1SVOJOH%JTUJMMBUJPO 2VBOUJ[BUJPO 4QFDVMBUJWF%FDPEJOH ׮নೠӝٜࣿਸݽف੸੺ೞѱ੸ਊ೧ঠೠ׮
  4. ন੗ച 2VBOUJ[BUJPO ੄ѐਃ 8FJHIUPOMZ2VBOUJ[BUJPO 8" 8" ↟ ݫݽܻ .FNPSZ ߽ݾਸѐࢶೡࣻ੓׮

    ↟ (MPCBM.FNPSZ৬$PSF੄ݫݽܻ 4IBSFE DBDIF SFHJTUFS ࢎ੉ 8FJHIU"DUJWBUJPO2VBOUJ[BUJPO 8" 8" ↟ ݫݽܻ .FNPSZ ߽ݾਸѐࢶೡࣻ੓׮ ↟ (MPCBM.FNPSZ৬$PSF੄ݫݽܻ 4IBSFE DBDIF SFHJTUFS ࢎ੉ ↟ ੢੼ন੗ചۨ߰੄ো࢑ழօਸ੸ਊೞৈࣘبೱ࢚ਸ঳ਸࣻ੓׮ ↟ ױ੼ಣоࢿמхࣗ EFHSBEBUJPO ੉ߊࢤೡࣻ੓׮ ↟ ӓࠂೞӝਤೠప௼ץ੉೙ਃೞ׮
  5. ઱ਃন੗ച 2VBOUJ[BUJPO ߑߨ (152 8" ↟ 2VBOUJ[F(15NPEFM ↟ 8FJHIUPOMZRVBOUJ[BUJPONFUIPECBTFEPOTFDPOE -

    PSEFSJOGPSNBUJPO "82 8" ↟ "DUJWBUJPO - BXBSF8FJHIU2VBOUJ[BUJPO 222 8" ↟ 2VBMJUZ2VBUUVPS - #JU2VBOUJ[BUJPO ↟ "EBQUJWF - TNPPUIJOHBOE)FTTJBO - CBTFEDPNQFOTBUJPO
  6. ন੗ച੿ࢿ੸৘द 2VBOUJ[BUJPO2VBMJUBUJWF&YBNQMF 7BOJMMB (152 "82 ࢎۈٜখীࢲ੉ঠӝೞחѪ੉ڄܻחѪ਷ݒ਋ൔೠੌੑפ׮׮਺ ਷Ӓ࢚۠ടਸઑӘ؊ಞউೞѱٜ݅ࣻ੓חݻо૑ߑߨੑפ׮ =O=O ળ࠺৬োण =Oߊ಴ղਊਸ୽࠙൤ળ࠺ೞҊোणೞࣁ

    ਃղਊਸੜঌݶ੗नх੉ࢤӤפ׮=OѢ਎খীࢲোणೞѢա ஘ ҳաо઒খীࢲܻೲࢸਸ೧ࠁࣁਃ=O=O बഐ൚ =Oߊ಴੹ ীӨѱऀਸٜ੉एҊୌୌ൤ղएחबഐ൚ਸݻߣ೧ࠁࣁਃ੉חӟ ੢ਸ৮ചೞחؘب਑੉ؾפ׮=O=O ӛ੿੸ੋ੗ӝ؀ച =O =աחੜೡࣻ੓য=৬э਷ӛ੿੸ੋ݈ਸ੗नীѱ೧ࠁࣁਃ੗न хਸ֫੉חؘب਑੉ؾפ׮=O=O ୒઺җ஘೧૑ӝ =O୒઺ ਸ੸ਵ۽ࠁ૑݈Ҋ ஘ҳաزܐ۽ࢤп೧ࠁࣁਃӒٜب׼नҗэ਷ ࢎۈٜੑפ׮=O=O ރਸ੉৮दఃӝ =Oߊ಴੹о߶਍झ౟ ۨட੉ա࢑଼ਸా೧ރਸ੉৮दఃࣁਃ=O=O दп੗ܐഝਊ  =Oठۄ੉٘ա೐ۨઃప੉࣌ਸࢎਊೞݶदп੗ܐী૘઺ೡࣻ੓য ӟ੢ਸ؏ࣻ੓णפ׮=O=O पࣻח੗োझ۞਍Ѫ =Oपࣻܳ ف۰ਕೞ૑݃ࣁਃݽٚߊ಴੗ٜ੉पࣻܳ೤פ׮पࣻחߓ਑੄ӝഥ ੑפ׮=O=O ୒઺੄߈਽ীन҃ॳ૑ঋӝ =O୒઺੄߈਽ী ցޖन҃ॳ૑݈Ҋ ੗न੄ߊ಴ী૘઺ೞࣁਃ୒઺਷׼न੉ࢤпೞ חѪ݅ఀ׼नীѱन҃ॳ૑ঋणפ׮=O=O ੸੺ೠળ࠺ =O ߊ಴੢ࣗীੌନب଱೧੢࠺աജ҃ਸ޷ܻഛੋೞࣁਃળ࠺оੜغ য੓ਵݶ݃਺੉؊ಞউ೧૘פ׮=O=O ӛ੿੸ੋ࢚࢚ =O ߊ಴оࢿҕ੸ਵ۽՘աחݽणਸ࢚࢚೧ࠁࣁਃӛ੿੸ੋ࢚࢚਷੗न хਸ֫੉חؘب਑੉ؾפ׮=O=O੉۞ೠߑߨٜਸदب೧ࠁݶ ࢲ੗नীѱо੢ੜݏחߑߨਸ଺ইࠁࣁਃԲળೠোणҗળ࠺ оо੢௾ب਑੉ؼѪੑפ׮ ࢎۈٜখীࢲ੉ঠӝೞחѪ੉ڄܻחѪ਷ݒ਋ൔೠੌੑפ׮׮਺ ਷Ӓ࢚۠ടীࢲઑӘ؊੗नхਸо૑Ҋ੉ঠӝೡࣻ੓חݻо૑ߑ ߨੑפ׮=O=O ળ࠺৬োण ߊ಴ղਊਸੜળ࠺ೞҊৈ۞ߣো णೞࣁਃղਊਸੜঌҊ੓ਵݶ੗नх੉ࢤӤפ׮=O=O ഐ൚ઑ ੺ Өѱऀਸٜ੉एҊୌୌ൤ղएחোणਸೞࣁਃӟ੢ೡٸഐ൚ ੉ࡈۄ૕ࣻ੓חؘ ੉ܳઑ੺ೞݶ݃਺੉ର࠙೧૕ࣻ੓णפ׮ =O=O ୒઺җ஘೧૑ӝ ୒઺ਸ੸ਵ۽ࠁ૑݈Ҋ э਷ݾ੸ਸо ૓ࢎۈٜ۽ࢤпೞࣁਃӒٜب׼न੄੉ঠӝܳٛҊरযೠ׮חѪਸ ӝরೞࣁਃ=O=O ӛ੿੸ੋ੗ӝ؀ച =աחੜೡࣻ੓য=৬ э਷ӛ੿੸ੋ݈ਸ੗नীѱೞࣁਃࠗ੿੸ੋࢤп਷ڄܿਸ؊ঈചद ఆࣻ੓णפ׮=O=O ރ੄ӟ੢ಽӝ ߊ಴੹ীо߶਍झ౟ۨ ட੉աރਸ਑૒ৈӟ੢ਸಽযࠁࣁਃӔਭ੉੉৮غݶ݃਺بಞ೧૕ ࣻ੓णפ׮=O=O दп੗ܐഝਊ ठۄ੉٘ա೐ۨઃప੉࣌ਸ ࢎਊೞݶदп੗ܐী૘઺ೡࣻ੓যӟ੢ਸ؏ࣻ੓णפ׮=O=O ੘਷ࢿҕ҃೷ ੘਷ݽ੐ীࢲݢ੷ߊ಴ܳ೧ࠁҊ੼ର௾Ӓܛਵ۽ ഛ੢೧ࠁࣁਃ੘਷ࢿҕ҃೷੉੗नхਸ֫ৈસפ׮=O=O पࣻ ߉ইٜ੉ӝ ৮߷ೡ೙ਃחহणפ׮पࣻܳೞ؊ۄبӒѪਸ੗োझ ۣѱֈযоҊ҅ࣘ੉ঠӝೞࣁਃ୒઺਷ࢤпࠁ׮׼न੄पࣻীन҃ ॳ૑ঋणפ׮=O=O ݾ಴ࢸ੿ ߊ಴੄੘਷ݾ಴ܳࢸ੿ೞࣁਃ ৘ٜܳয ୐࠙زউ୒઺җ׀ݏ୶ӝ١੘਷ݾ಴ܳ׳ࢿೞݶ੗न х੉ࢤӤפ׮=O=O ੹ޙо੄ب਑ ݅ডߊ಴ࠛউ੉बೞ׮ ݶ बܻ࢚׸ࢎա௏஖੄ب਑ਸ߉חѪبજ਷ߑߨੑפ׮=O=O੉ߑ ߨٜ੉ب਑੉غӡ߄ۉפ׮োणҗળ࠺ܳా೧੼ରաই૕Ѫੑפ ׮ ࢎۈٜখীࢲ੉ঠӝೞחѪ੉ڄܻחѪ਷ݒ਋ൔೠੌੑפ׮׮਺਷Ӓ ࢚۠ടਸઑӘ؊ಞউೞѱٜ݅ࣻ੓חݻо૑ߑߨੑפ׮=O=O ળ ࠺৬োण =O োण ߊ಴ղਊਸৈ۞ߣ੍Ҋ Ѣ਎খীࢲোणೞ Ѣա஘ҳٜখীࢲܻೲࢸਸ೧ࠁࣁਃ=O ળ࠺ ߊ಴ղਊਸ৮߷൤ ੉೧ೞҊ ૕ޙী؀࠺೧׮নೠदաܻয়ܳࢤп೧ࠁࣁਃ=O=O बഐ ൚җ੉৮ =O बഐ൚ ߊ಴੹ীӨѱऀਸٜ੉एҊୌୌ൤ղएח बഐ൚ਸݻߣ೧ࠁࣁਃ੉חӟ੢ਸ৮ചೞחؘب਑੉ؾפ׮=O ੉ ৮ӝߨ Ӕਭ੉৮ӝߨ੉աݺ࢚ਸా೧ރ੄ӟ੢ਸಽযࠁࣁਃ =O=O ӛ੿੸ੋ੗ӝ؀ച =O ੗नхъച =աחળ࠺оੜ غয੓য= =աח੉ղਊਸੜঌҊ੓য=э਷ӛ੿੸ੋ݈ਸ߈ࠂೞ ࣁਃ=O ࠗ੿੸ੋࢤпରױ =ڄܻחѤ੗োझ۞਍Ѣঠ=ۄҊझ झ۽ীѱ݈ೞݴࠗ੿੸ੋࢤпਸରױೞࣁਃ=O=O ୒઺җ੄োѾ  =O ୒઺җ׀ݏ୶ӝ ୒઺ਸೞա੄ࢎۈਵ۽ࠁ૑݈Ҋ ೠࢎۈঀ ׀ݏ୶ݴ੉ঠӝ೧ࠁࣁਃ=O ѐߑ੸ੋకب ୒઺җࣗాೞ۰חక بܳо૑ࣁਃ૕ޙਸ؍૑Ѣա୒઺੄߈਽ਸਬب೧ࠁࣁਃ=O=O ޛ ܻ੸ળ࠺ =O ಞউೠࠂ੢ ߊ಴ೡٸಞউೠ৩ਸੑਵࣁਃ=O ੸੺ೠജ҃ ߊ಴ജ҃੉੊ࣼೞ૑ঋ׮ݶ޷ܻߑޙ೧ࠁҊ੊ࣼ೧૑ ࣁਃ=O=O ӝࣿഝਊ =O ೐ۨઃప੉࣌بҳࢎਊ ठۄ੉٘ ࣳܳഝਊ೧ߊ಴ղਊਸࠁઑೞࣁਃ੉חߊ಴ղਊਸ੕૑ঋѱب৬સפ ׮=O ֢౟ળ࠺ ߊ಴ղਊਸ੸਷֢౟ܳળ࠺೧ଵҊೞࣁਃ =O=O Ѥъҙܻ =O ୽࠙ೠࣻݶ ߊ಴੹զ୽࠙ೠࣻݶਸஂ ೞࣁਃ=O Ѥъೠधࢎ ߊ಴੹զҗध੉ա੗ӓ੸ੋ਺धਸೖೞࣁ ਃ=O=O੉۞ೠߑߨٜਸदب೧ࠁݶࢲ੗नীѱо੢ੜݏחߑߨਸ଺ই ࠁࣁਃԲળೠোणҗળ࠺о੗नхਸః਋חؘ௾ب਑੉ؼѪੑפ׮ QSPNQUࢎۈٜখীࢲ੉ঠӝೞחѱցޖڄ۰ਃযڌѱ೧ঠೞભ 
  7. 4QFDVMBUJWF%FDPEJOH੄ѐ֛ %SBGUݽ؛੉ࢤࢿೠUPLFO੄଻ఖܫ "DDFQUBODFSBUF ੉઺ਃೞ׮ "DD@SBUFBDDFQUFE@UPLFOTUPUBM@FNJUUFE@UPLFOT ↟ SFKFDU੉ߊࢤೠష௾੉റ੄ESBGUష௾਷ߡܽ׮ ↟ 5BSHFUష௾ࠗఠद੘ೠ׮ ৘द

     %SBGU#<USVF GBMTF GBMTF USVF USVF> %SBGU#<USVF USVF USVF GBMTF USVF> UPUBM@FNJUUFE@UPLFOT     ESBGU@UPLFOT UBSHFU@UPLFOT  CBUDI@TJ[F BDDFQUFE@UPLFOT    UBSHFU@UPLFOT #@BDDFQUFE@UPLFOT   UBSHFU@UPLFOT  #@BDDFQUFE@UPLFOT BDD@SBUF
  8. 4QFDVMBUJWF%FDPEJOH੄੸ਊदҊ۰ࢎ೦  ଻ఖܫ "DDFQUBODFSBUF ਸৢ۰ঠೠ׮  5BSHFUݽ؛җਬࢎೠPVUQVUഛܫ࠙ನܳоઉঠೠ׮  ೟णߑध੉ਬࢎ೧ঠೠ׮ 

    ೟णؘ੉ఠоਬࢎ೧ঠೠ׮  1SVOJOHEJTUJMMBUJPOਸ੸ਊೡࣻ੓׮  ESBGUݽ؛੄୹۱ӡ੉ , ܳ੸੺ೞѱੜࢶఖ೧ঠೠ׮  %SBGUݽ؛੉о߶ਕঠೠ׮
  9. 4QFDVMBUJWF%FDPEJOH੄%SBGUݽ؛ %SBGU.PEFM੄௼ӝѾ੿0QUݽ؛प೷ ↟ ݽ؛੉୽࠙൤੘ইبغ؊ۄ ↟ &WBMVBUJPOࢿמ੉֫૑ঋইبػ׮ ↟ ׮਺աৢए਍ష௾੿ب݅ੜ৘ஏ೧بػ׮ 3PMF .PEFM4J[F

    "3$ TIPU )FMMB4XBH TIPU ..-6 TIPU 5SVUIGVM2" TIPU 8JOPHSBOEF TIPU (4., TIPU %SBGU N       %SBGU N       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