• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: June 7th, 2023

help-circle


  • So to be honest, 90% of the time the base of the logarithm doesn’t really matter as long as we are consistent. The main property we use logarithms for is that log_b(xy) = log_b(x) + log_b(y), and this holds for any base b. In fact, the change-of-base formula tells us that we can get from one base to another just by multiplying by a constant (log_a(x) = log_b(x) * 1/log_b(a)), and so there is a strong desire to pick one canonical “logarithm” function, and just take care of any base silliness by multiplying your final result by a scaling factor if needed.

    Given that, the natural logarithm is quite “natural” because it is the inverse of the exponential function, exp(x) = e^x. The exponential function itself is quite natural as it is the unique function f such that f(0) = 1 and f’(x) = f(x). Really, I would argue that the function exp(x) is the fundamentally important mathematical object – the natural logarithm is important because it is that function’s inverse, and the number e just happens to be the value of exp(1).


  • All the colored branches are based on the Transformer neural network architecture. If we allow for a lot of handwaving, a transformer allows each word to look at other words in the sequence in order to make decisions/produce output.

    In a decoder transformer architecture, each word can only look at the words that come before it in the sequence. Such models are naturally suited for the task of next word prediction: you can ask each word to predict what word comes next, and they can look at all the words before them, but cannot “cheat” by looking ahead. These models are used for text generation: start with an empty sequence, and repeatedly predict what word should come next.

    On the other hand, in an encoder architecture, each word can look at every other word, in front of and behind it. You can’t use these for next word prediction, since they can cheat, but they are commonly used for masked language modeling, a task where we delete some words from the input and then try to predict which words were deleted. It isn’t straightforward to generate text with these models, but they can learn a lot of deep statistical properties of text, which can then be used for other tasks/models.

    Some model architectures might use both encoders and decoders, but I am not too familiar with how they are used for language modeling. The classic example of such a model is a translation system, which would use an encoder to “encoder” the source language text, and the decoder to generate target language text from that encoding.