kth.sePublications
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
A Mixture-of-Experts Approach for Code Generation: On upcycling and sparsifying dense models
KTH, School of Electrical Engineering and Computer Science (EECS).
2024 (English)Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesisAlternative title
En expertblandningsmetod för kodgenerering : Om återanvändning och förglesning av täta modeller (Swedish)
Abstract [en]

The Sparse Mixture-of-Experts (MoE) model architecture decouples model size and parameter count from inference and computational cost, by only activating a subset of the trainable parameters at inference time. MoEs include a gating network which allows each input to select a sparse mixture of k experts out of a total of E experts. This promise to scale up model size while keeping computational expense constant is suitable and very attractive in the context of LLMs. Despite sparse models being more computationally efficient than dense models, they remain hard and costly to train from scratch. Techniques, such as Sparse Upcycling, to reuse the trained parameters of existing dense models have emerged as a solution to this drawback, making training sparse models more feasible. While previous work has shown that sparsely upcycled models outperform their dense counterparts in language and vision domains, in this thesis we explore whether this also holds in the context of code generation. More specifically, we sparsely upcycle models and instruct-finetune them on instruction-following code generation datasets in order to compare them to their dense counterparts. We use small language models (SLMs) as our baseline dense models, notably Phi-2 and DeepSeek-Coder-Base 1.3B. We build a small upcycled model with a Phi-2 base and 2 total experts fine-tuned on an Evol-Instruct dataset that achieves a 61% on HumanEval and outperforms the tuned baseline Phi-2 on both HumanEval and MBPP code benchmarks, which validates our main hypothesis.

Abstract [sv]

Den glesa expertblandningsarkitekturen frånkopplar modellstorlek och antal modellparameterar från inferens- och beräkningskostnader, genom att endast aktivera en delmängd av de träningsbara parametrarna vid inferenstid. expertblandningsmodeller innehåller ett vägvalsnätverk som tillåter indata att välja en gles kombination av k expert-nätverk av totalt E stycken. Denna möjlighet att skala upp modellstorleken samtidigt som beräkningskostnaden hålls konstant är mycket väl lämpad och attraktiv i kontexten för stora språkmodeller (LLM:er). Trots att glesa modeller är beräkningsmässigt mer effektiva än täta modeller, är de fortfarande svåra och kostsamma att träna från grunden. Tekniker, såsom gles återanvändning, för att återanvända de tränade parametrarna från befintliga täta modeller har framkommit som en lösning för denna nackdel, vilket gör träningen av glesa modeller mer genomförbar. Medan tidigare arbeten har visat att glesa återanvändningsmodeller överträffar sina motsvarande täta modeller inom text- och bildgenerering, utforskar vi här om detta även gäller för kodgenerering. Mer specifikt så gör vi här en gles återanvändning på modeller samt en finjusterande träning på datamängd för instruktionsföljande kodgenerering för att sedan kunna jämföra dessa modeller med deras motsvarande täta modeller. Vi använder små språkmodeller som täta referensmodeller i jämförelser. Mer specifikt Phi-2 och DeepSeek-Coder-Base 1.3B. Vi bygger en liten uppskalad modell baserad på Phi-2 base med två experter finjusterade med datamängden Evol-Instruct. Denna modell får 61% på HumanEval vilket är högre än den finjusterade Phi-2 referensmodellen på båda kodtesten HumanEval och MBPP vilket bekräftar vår hypotes.

Place, publisher, year, edition, pages
2024. , p. 58
Series
TRITA-EECS-EX ; 2024:639
Keywords [en]
Deep Neural Networks, Mixture-of-Experts, Sparse Models, Code Generation, Sparse Upcycling, Instruction-finetuning, Conditional Computation
Keywords [sv]
Djupa neurala nätverk, expertblandning, glesa modeller, kodgenerering, gles återanvändning, instruktionsfinjustering, villkorlig beräkning
National Category
Computer and Information Sciences
Identifiers
URN: urn:nbn:se:kth:diva-354440OAI: oai:DiVA.org:kth-354440DiVA, id: diva2:1903655
External cooperation
Modulai AB
Supervisors
Examiners
Available from: 2024-10-16 Created: 2024-10-05 Last updated: 2024-10-16Bibliographically approved

Open Access in DiVA

fulltext(1794 kB)251 downloads
File information
File name FULLTEXT01.pdfFile size 1794 kBChecksum SHA-512
36b8aa129a079f9e54432f854523292db8ae627f2a28517e0982cbd94bb7baa7dd21d9b6ffd3729ebeedc364d0a6d009977ca40bf94bb453f5e8dd560ff5be7f
Type fulltextMimetype application/pdf

By organisation
School of Electrical Engineering and Computer Science (EECS)
Computer and Information Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 253 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 267 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf