3 ms·
You lost the thread at 'write.' Try to do it in your head; we pretty much have to resort to additional tools to succeed at this task. Here's a LLM-generated py
by sdenton4 3y ago
You lost the thread at 'write.' Try to do it in your head; we pretty much have to resort to additional tools to succeed at this task.
Here's a LLM-generated python solution, which works just fine:
def add_binary(a, b):
"""Adds two binary numbers given as strings.
Args:
a: The first binary number.
b: The second binary number.
Returns:
The sum of the two binary numbers.
"""
# Convert the binary strings to numbers.
a = int(a, 2)
b = int(b, 2)
# Add the numbers.
sum = a + b
# Convert the sum back to a binary string.
return bin(sum)[2:]
add_binary('10011111110100011100011011110010', '00111010100101000100000101111011')
- rcme 3y agoI feel like we're missing the forest for the trees here. I'm not really asking it to add two numbers. I'm asking it to apply a simple set of logical rules on two symbols with an operation '+'. Of course it can generate code to add two numbers, because the code to add two numbers exists in its training data. What transformers seem to be good at is generalizing over the training data. Where they seem to perform poorly is data outside of the training set. Binary numbers are interesting because you can add a bit of entropy just by increasing the size of your binary number, so it's very easy to generate examples outside of the training data. You also see this, albeit less directly, when trying to ask it to generate code that wasn't part of its training data. E.g. https://twitter.com/cHHillee/status/1635790330854526981 https://twitter.com/cHHillee/status/1635790330854526981