diff --git a/network-poc/static/GUIDE.md b/network-poc/static/GUIDE.md index 7db64cb..6ae8c96 100644 --- a/network-poc/static/GUIDE.md +++ b/network-poc/static/GUIDE.md @@ -36,29 +36,13 @@ sanan osa, kokonainen sana tai välilyönti. Tokenisaatio tehdään BPE-algoritmilla (Byte Pair Encoding) joka oppii yleisimmät merkkijonot harjoitusdatasta. -### Esimerkki: koodi - -``` -"print('Hello')" → [print] [(' ] [Hello] [')] = 4 tokenia -"tulosta('Hei')" → [tul] [osta] [(' ] [He] [i] [')] = 6 tokenia -``` - -Koodi tokenisoidaan tehokkaasti koska `print`, `def`, `return` yms. -ovat kokonaisia tokeneita. Suomenkielinen `tulosta` joudutaan pilkkomaan -osiin koska se ei esiinny harjoitusdatassa kokonaisena. - ### Esimerkki: suomi vs. englanti -Sama lause kahdella kielellä Qwen2.5-Coder -tokenisaattorilla: +Alla oikea tokenisointitulos Qwen2.5-Coder-tokenisaattorilla. Jokainen +värikoodattu lohko on yksi tokeni — huomaa miten suomi vaatii enemmän +tokeneita saman merkityksen välittämiseen: -| | Teksti | Tokenit | Määrä | Merkkejä/token | -|---|---|---|---|---| -| EN | The cat sat on the mat | [The] [ cat] [ sat] [ on] [ the] [ mat] | **6** | 3.7 | -| FI | Kissa istui matolla | [K] [issa] [ ist] [ui] [ mat] [olla] | **6** | 3.2 | -| EN | Distributed computing in the browser | [Dist] [ributed] [ computing] [ in] [ the] [ browser] | **6** | 6.0 | -| FI | Hajautettu laskenta selaimessa | [H] [aj] [au] [tettu] [ las] [kenta] [ sel] [aim] [essa] | **9** | 3.3 | -| EN | Write a function that sorts a list | [Write] [ a] [ function] [ that] [ sorts] [ a] [ list] | **7** | 5.0 | -| FI | Kirjoita funktio joka lajittelee listan | [K] [irj] [oita] [ funkt] [io] [ joka] [ laj] [ittel] [ee] [ listan] | **10** | 4.0 | +![Tokenisointivertailu EN/FI](/images/tokenization-example.png) **Huomaa miten:** - Englannin yleiset sanat (`the`, `in`, `a`, `function`) ovat kokonaisia tokeneita diff --git a/network-poc/static/images/tokenization-example.png b/network-poc/static/images/tokenization-example.png new file mode 100644 index 0000000..83bde15 Binary files /dev/null and b/network-poc/static/images/tokenization-example.png differ diff --git a/network-poc/static/index.html b/network-poc/static/index.html index deec888..6337d49 100644 --- a/network-poc/static/index.html +++ b/network-poc/static/index.html @@ -4564,6 +4564,7 @@ ${filesHtml} function inlineFormat(text) { return text + .replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '$1') .replace(/`([^`]+)`/g, '$1') .replace(/\*\*([^*]+)\*\*/g, '$1') .replace(/\*([^*]+)\*/g, '$1');