Up to Main Index                         Up to Journal for September, 2024

                  JOURNAL FOR SATURDAY 28TH SEPTEMBER, 2024
______________________________________________________________________________

SUBJECT: AI distractions + More mote data types and operators
   DATE: Sat 28 Sep 22:58:52 BST 2024


AI DISTRACTIONS
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
I find myself becoming distracted with exciting new developments in artificial
intelligence every time I sit down to work on Mere/Mote. Today it was a new
small language model from AMD called AMD-135M[1]. Naturally, I couldn’t resist
trying it out. In doing so I also found ChatQA-1.5[2] from NVIDIA which is a
model for QA chats and RAG (Retrieval Augmented Generation). The model was of
particular interest since I’ve been working on a RAG system recently.

Oops, there goes another 4.7Gb of disk space for the ChatQA-1.5 model :( With
my NVIDIA T1000 (8Gb) I can just about squeeze both the mxbai-embed-large and
llama3-chatqa models onto the GPU at the same time. Initial impression is that
the model produces some odd results. Need to spend time investigating…

Last week, I was distracted by the nemotron-mini[3] model from NVIDIA. This
model is intended for NPC conversations and role-playing. As an experiment I
plugged it into WolfMUD’s barkeeper in the dragon’s breath tavern with some
curious results :) I plan on writing more about my WolfMUD and AI experiments
soon.


MERE/MOTE DEVELOPMENTS
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
As fun as working on AI projects is, I’ve made some progress on Mote as well.
Two new data types have finally been added: uint (unsigned integer) and float
(floating point numeric). Both of these data types have matching arrays and
maps. For example:


    u  = 3u
    f  = 3.3
    ua = []uint  1u  2u  3u
    fa = []float 1.1 2.2 3.3
    um = [uint]  1u  "one", 2u  "two"
    fm = [float] 1.0 "one", 2.0 "two"


There are new bit-wise operators for shift left ‘<<’, shift right ‘>>’. There
are also new bit-wise AND ‘&’, OR ‘|’ and XOR ‘^’ operators. Optimisations for
each of the operators has been added. For example, defining a constant “const
c = 1 << 31” evaluates to “const c = 2147483648”. The constant ‘c’ is then
replaced with the literal ‘2147483648’ wherever it is used. Some example code:


    >cat example.src
    const c = 1 << 31
    println c
    println c | 2
    dump
    >mote example.src
    2147483648
    2147483650

    ============= PROGRAM DUMP =============

      cur/max exec limit: 7/-
      cur/max call depth: 1/-

    -- Call Stack --------------------------

       Depth        Line  Address/ID  Called/Variable
           0           4  0x0000000C
                          C 0x000001                    c = i[2147483648]


    -- Image -------------------------------

    Address     Line/Label
    0x00000000           1 | C[0x01:c] i[2147483648] O[const] O[;]
    0x00000004           2 | s["…"] i[2147483648] F[println] O[;]
    0x00000008           3 | s["…"] i[2147483650] F[println] O[;]
    0x0000000C           4 | F[dump] O[;]
    0x0000000E           4 |

    =============== END DUMP ===============


Looking at the image section of the dump we can see that ‘c’ for line 2 has
been replaced with its constant value. We can also see for line 3 that the
expression “c | 2” has been pre-calculated and substituted with the result.


    Note to self: Conditional constants are still broken.
  Note from self: I know dammit! We shouldn’t allow them…


BIT OF A CONUNDRUM
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
While adding the new bit-wise operators I found myself in a bit of a quandary.
As an example, consider the shift left ‘<<’ operator. It takes two operands.
The operand on the left is the value to be shifted. The operand on the right
is the amount to shift the left operand by. The left operand can be an int or
uint: 0xFF<<2, 0xFFu<<2

But what about the operand on the right? In Go this has to be an int. But why?
Thinking about this I don’t see a good reason for forcing the right operand to
be an int. Therefore, the right operand of the shift operators are allowed to
take either an int or a uint value.


WHAT NEXT?
‾‾‾‾‾‾‾‾‾‾
With the addition of two new types, and the array and map variants, plus the
new operators we need tests. Yes, I am currently bored to tears again writing
new tests and updating the existing. I know and appreciate the value of tests.
I just hate writing them :(


STYLE TWEAKS
‾‾‾‾‾‾‾‾‾‾‾‾
As can be seen, two lines up, I’ve made a little style change to the journal
and started adding some headings. Usually I don’t use headings / sub-headings.
However, people have asked if I can maybe break up my walls of text a bit :)

I’m not sure if I like the style of upper-case with over-lines for underlining
or if I need to experiment a bit more. Plain text can be limiting, but Unicode
helps a lot. There is a combining low line U+0332 for underlining I could use.
However, Chrome is not rendering it properly and its a pain to type :P

--
Diddymus


  FOOTNOTES
  ‾‾‾‾‾‾‾‾‾
  [1] AMD Unveils Its First Small Language Model AMD-135M:
      https://community.amd.com/t5/ai/amd-unveils-its-first-small-language-model-amd-135m/ba-p/711368

  [2] Introducing ChatQA-1.5: Surpassing GPT-4 on Conversational QA and RAG:
      https://chatqa-project.github.io/

  [3] NVIDIA Announces first digital human technologies on-device small
      language model, improving conversation for game characters:
      https://blogs.nvidia.com/blog/digital-human-technology-mecha-break/


  Up to Main Index                         Up to Journal for September, 2024