Eli Zaretskii <[email protected]> writes:

>> From: Philip Kaludercic <[email protected]>
>> Cc: [email protected],  [email protected],  [email protected],
>>   [email protected],  [email protected]
>> Date: Sat, 24 Jul 2021 14:16:55 +0000
>> 
>> > Sorry, I don't understand what you have in mind.  Can you show an
>> > example of useful code that could be copied verbatim into a program
>> > without at least some renaming, without breaking the program?
>> 
>> To take the example from the article I mentioned above
>> 
>>     public static String humanReadableByteCount(long bytes, boolean si) {
>>         int unit = si ? 1000 : 1024;
>>         if (bytes < unit) return bytes + " B";
>>         int exp = (int) (Math.log(bytes) / Math.log(unit));
>>         String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : 
>> "i");
>>         return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
>>     }
>> 
>> can be copied into a Java program, and assuming that there is no other
>> method called humanReadableByteCount in the same class, it should
>> compile and run without renaming or re-typing.
>
> How would one know it's 'long' and not some other data type?

I am not sure what you mean? "long" makes sense here because Java will
automatically up-cast any other type to fit.

>> CoPilot might generate this from a comment like,
>> 
>>     // Convert a byte count to a human-readable string
>> 
>> since it is mentioned over 6000 times on GitHub (and this method even
>> has a bug, as the article explains -- but that is a totally different
>> issue).
>
> That's not how AI works: it doesn't just count the number of times
> something is mentioned.  That usually leads to unsatisfactory results.

Of course, that would be oversimplifying. At the same time, if the
training samples have common patterns, a model is more likely to
reproduce that behaviour. But since these are neural networks we are
talking about, it is hard to determine causality to begin with, which
probably makes the whole situation even more difficult (speaking as a
non-lawyer).

-- 
        Philip Kaludercic

Reply via email to