HNHacker News
TopNewBestAskShowJobs

threeducks

420 karma · joined January 10, 2025

submissionscomments
threeducks··on Show HN: Zeekstd – Rust Implementation of the ZSTD Seekable Format
Assuming that frames come at a cost, how much larger are the seekable zstd files? Perhaps as a graph based on frame size and for different kinds of data (text, binaries, ...).
threeducks··on Why we still can't stop plagiarism in undergraduate computer science (2018)
Those students had already failed before that, but you still have to get them out of your office somehow.
threeducks··on Why we still can't stop plagiarism in undergraduate computer science (2018)
> Why not have written exams?

That is what we do now. Some reasons why we preferred oral exams before:

1. In order to write a written exam, you have to create a written exam.

2. Scheduling is more difficult. You have to reserve a room for the exam, ensure that the date does not collide with other exams, and students have to plan their vacations around it. For oral exams, you only have to schedule two people, which allows for much greater flexibility.

3. During oral exams, you can probe a bit deeper if you notice that a student did not understand the question correctly, but still knows the solution. In contrast, in a written exam, there is no way for the student to recover from an initially incorrect understanding.

4. It is much easier to cheat on a written exam, especially since there have been all kinds of technological improvements, like ear canal earphones, tiny cameras, glasses with integrated AI assistants, polarized smart watches and who knows what else.

threeducks··on Why we still can't stop plagiarism in undergraduate computer science (2018)
I can understand where you are coming from, but in the cases we had to deal with, there was absolutely no room for ambiguity. To put things into perspective, those were students who did not know what a HashMap is or could not derive the algorithmic complexity of two nested for-loops, yet somehow cheated their way into a master's level course. With the current level of oversight, degrees obtained after 2022 are basically worthless.
threeducks··on Why we still can't stop plagiarism in undergraduate computer science (2018)
> I do a short oral exam

I tried that, but some students who had cheated became really aggressive when it turned out they did not have a single clue how their AI-generated solutions worked and still demanded a pass. We now do more written exams where we have some distance.

threeducks··on Surprisingly fast AI-generated kernels we didn't mean to publish yet
I ran their matrix multiplication code from GitHub (https://github.com/ScalingIntelligence/good-kernels/blob/mai...) and got a mean squared error of approximately 0.056 for two 4096x4096 matrices containing random values between 0 and 1.

I think this error is large enough that referring to it as FP32 is misleading.

Also, the performance gains do not translate to my RTX 3060M GPU (3.8 GFLOPS vs PyTorch's 5.3), presumably because it lacks the optimized hardware for half precision.

But on the plus side, the single file was very easy to adapt and the code is quite readable. I have seen much uglier kernels.

threeducks··on Deepseek R1-0528
> even at a glacial pace

If speed is truly not an issue, you can run Deepseek on pretty much any PC with a large enough swap file, at a speed of about one token every 10 minutes assuming a plain old HDD.

Something more reasonable would be a used server CPU with as many memory channels as possible and DDR4 ram for less than $2000.

But before spending big, it might be a good idea to rent a server to get a feel for it.

threeducks··on Mistral Agents API
To add to 3): YouTube embedded videos default to 360p for me even if I maximize the embedded video on my 4k screen, which is completely unreadable. This is probably an attempt by YouTube to get viewers to click through to the YouTube website. It is probably not in Mistral's best interest to funnel viewers to YouTube, so they should use a different video host.

But even at maximum 1080p resolution, the image quality is not that great. And while we are at it, the wine-red (#833048) on dark-brown (#23231F) syntax highlighting for keyword arguments has very poor contrast ratio of around 1.8 to 1: https://webaim.org/resources/contrastchecker/ which earns a rating of "Fail" across the categories normal text, large text and UI elements.

threeducks··on Google shared my phone number
Definitely readable. A stronger blur would not have helped the situation either. It is absolutely insane how well information from a blurred image can be reconstructed. For example, consider the "Data" column of the following image, which basically looks like a gray image without any content, but neural networks can recover most of the blurred characters: https://fips.fi/wp-content/uploads/2024/07/HDC_result_exampl...
threeducks··on What I discovered when I asked Amazon to tell me everything Alexa had heard
> But we have two Echo devices in our household and the data shows whether a request came from the Echo Plus in the kitchen or the original Echo on our daughter Coco’s bedside table, where it has sat since around her ninth birthday. [...] So I now know that it was Coco who wanted to know what it is to be omnisexual and what omniscient means.

Doesn't it feel wrong to the author to snoop through that private information? And publishing it in a news article definitely crosses a line.

threeducks··on Claude 4
> Which version of tailwind css do you know?

LLMs can not reliably tell whether they know or don't know something. If they did, we would not have to deal with hallucinations.

threeducks··on Ratatoi is a C libary that wraps stdlib's strtol (as atoi does), but it's evil.
I think strtol is just a badly designed function. The return value should have been an error code and the actual long should have been "returned" via a pointer. Checking the return value is much easier than checking endptr and errno and remembering to set errno before calling strtol.

The fact that the strtol example in the manual is 50 lines long, of which most is error handling, speaks for itself. https://man7.org/linux/man-pages/man3/strtol.3.html#:~:text=...

That being said, I can't imagine many applications where crashing is a good solution.

threeducks··on Devstral
More like 700 € if you are lucky. Prices are still not back down from the start of the AI boom.

I am hopeful that the prices will drop a bit more with Intel's recently announced Arc Pro B60 with 24GB VRAM, which unfortunately has only half the memory bandwidth of the RTX 3090.

Not sure why other hardware makers are so slow to catch up. Apple really was years ahead of the competition with the M1 Ultra with 800 GB/s memory bandwidth.

threeducks··on I don't like NumPy
To be fair, you could replace `import numpy as np` with `import cupy as np` and it would run on GPU without further changes. It is not any good though. PyTorch is roughly 12 times faster.
threeducks··on I don't like NumPy
You don't have to wrap the lists in np.array if you use NumPy functions (or if one of the arguments already is a NumPy array, which usually is the case):

    from numpy import *

    A = [[1, 2], [3, 4]]
    x = [[5], [6]]
    y = dot(A, x)
threeducks··on I don't like NumPy
I thought I'd do something smart and inline all the matrix multiplications into the einsums of the vectorized multi-head attention implementation from the article and set optimize="optimal" to make use of the optimal matrix chain multiplication algorithm https://en.wikipedia.org/wiki/Matrix_chain_multiplication to get a nice performance boost.

    def multi_head_attention_golfed(X, W_q, W_k, W_v, W_o, optimize="optimal"):
        scores = np.einsum('si,hij,tm,hmj->hst', X, W_q, X, W_k, optimize=optimize)
        weights = softmax(W_k.shape[-1]**-0.5 * scores, axis=-1)
        projected = np.einsum('hst,ti,hiv,hvd->shd', weights, X, W_v, W_o, optimize=optimize)
        return projected.reshape(X.shape[0], W_v.shape[2])
This is indeed twice as fast as the vectorized implementation, but, disappointingly, the naive implementation with loops is even faster. Here is the code if someone wants to figure out why the performance is like that: https://pastebin.com/raw/peptFyCw

My guess is that einsum could do a better job of considering cache coherency when evaluating the sum.

threeducks··on Hypermode Model Router Preview – OpenRouter Alternative
You are right! https://github.com/psf/requests/blob/c65c780849563c891f35ffc...

The post function calls request the request function which uses its own context manager that will call the close function of the connection object.

threeducks··on Hypermode Model Router Preview – OpenRouter Alternative
Oh, I did not catch that. Sorry!
threeducks··on Hypermode Model Router Preview – OpenRouter Alternative
The Python API example looks like it has been written by an LLM. You don't need to import json, you don't need to set the content type and it is good practice to use context managers ("with" statement) to release the connection in case of exceptions. Also, you don't gain anything by commenting variables with the name of the variable.

The following sample (probably) does the same thing and is almost half as short. I have not tested it because there is no signup (EDIT: I was mistaken, there actually is a "signup" behind the login link, which is Google or GitHub login, so the naming makes sense. I confused it with a previously more prominent waitlist link.)

    import requests

    # Your Hypermode Workspace API key
    api_key = "<YOUR_HYP_WKS_KEY>"

    # Use the Hypermode Model Router API endpoint
    url = f"https://models.hypermode.host/v1/chat/completions"

    headers = {"Authorization": f"Bearer {api_key}"}

    payload = {
        "model": "meta-llama/llama-4-scout-17b-16e-instruct",
        "messages": [
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "What is Dgraph?"},
        ],
        "max_tokens": 150,
        "temperature": 0.7,
    }

    # Make the API request
    with requests.post(url, headers=headers, json=payload) as response:
        response.raise_for_status()
        print(response.json()["choices"][0]["message"]["content"])
threeducks··on The Speed of VITs and CNNs
> Also, please do smoothed crossentropy for image class stuff (generally speaking, unless maybe data is hilariously large), MSE won't nearly cut it!

Of course. The MSE here is not intended to be a training loss, but as a means to demonstrate that both approaches lead to almost the same result except for some rounding error. The MSE is somewhere in the order of 10^-9.

> Also, for classification, MaxPooling is often far superior, you can learn an average smoothing filter in your convolutions beforehand in a data-dependent manner so that Nyquist sampling stuff is properly preserved.

I don't think that max pooling the last feature maps would be a good idea here, because it would cut off about 98 % of the gradients and training would take much longer. (The shape of the input feature layer is (1, 768, 7, 7), pooled to (1, 768, 1, 1).)

> Something to note is that batching does become an issue at a certain point

Could you elaborate on that?

threeducks··on The Speed of VITs and CNNs
ConvNeXT's architecture contains an AdaptiveAvgPool2d layer: https://github.com/pytorch/vision/blob/5f03dc524bdb7529bb4f2...

This means that you can split your image into tiles, process each tile individually, average the results, apply a final classification layer to the average and get exactly the same result. For reference, see the demonstration below.

You could of course do exactly the same thing with a vision transformer instead of a convolutional neural network.

That being said, architecture is wildly overemphasized in my opinion. Data is everything.

    import torch, torchvision.models

    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    model = torchvision.models.convnext_small()
    model.to(device)
    tile_size, image_size = 32, 224 # note that 32 divides 224 evenly
    image = torch.randn((1, 3, image_size, image_size), device=device)

    # Process image as usual
    x_expected = model(image)

    # Process image as tiles (using for-loops for educational purposes; should use .view and .permute instead for performance)
    features = [
        model.features(image[:, :, y:y + tile_size, x:x + tile_size])
        for y in range(0, image_size, tile_size)
        for x in range(0, image_size, tile_size)]
    x = model.classifier(sum(features) / len(features))

    print(f"Mean squared error: {(x - x_expected).pow(2).mean().item():.20f}")
threeducks··on NotebookLM Audio Overviews are now available in over 50 languages
Over seven years ago, this has been foretold exactly by the show Silicon Valley:

https://www.youtube.com/watch?v=K3pYZwol6Dc&t=73s

Transcript of the fridge scene:

    Fridge (after a bar code was scanned): "Ah, there we go."
    Gilfoyle: "It's bad enough that it has to talk. Does it need fake vocal ticks like 'uh'." 
    Dinesh: "Well it just makes it sound more human."
    Gilfoyle: "Humans are shit. This thing is addressing problems that don't exist. It's solutionism at its worst. We are dumbing down machines that are inherently superior."
I would like to have a Gilfyole mode for NotebookLM where the machine answers only with cold precision instead of endless "Mmmhmm", "Yeah!", "Amazing!", "That's so cool!".
threeducks··on Google will let companies run Gemini models in their own data centers
> That was not with Google's consent

The NSA does not need consent from Google. Google is simply ordered to comply. See https://policies.google.com/terms/information-requests?hl=en...

> FISA orders and authorizations can be used to compel electronic surveillance and the disclosure of stored data, including content from services like Gmail, Drive, and Photos.

If you look at the content requests under FISA, you can see that there were over 118000 requests for user data between July 2023 and December 2023. https://transparencyreport.google.com/user-data/us-national-...

threeducks··on Google will let companies run Gemini models in their own data centers
The NSA has been spying through Google since at least 2009. https://en.wikipedia.org/wiki/PRISM
threeducks··on Claude's Max Plan
Amazon Bedrock has even worse uptime than Anthropic (see "Uptime" column).

https://openrouter.ai/anthropic/claude-3.7-sonnet:thinking/p...

But I agree with the general point that using the API (with different providers) will have better uptime and that it will almost certainly be cheaper.

threeducks··on Shift-to-Middle Array: A Faster Alternative to Std:Deque?
> Do you know why these implementations opt for 2 if it's not the best choice?

Probably a mix of simplicity, not knowing or not caring. Most software is not optimal.

> If it's not the best, what is?

In theory, the best value is a bit less than the golden ratio, so 1.5 is quite good.

https://archive.li/Z2R8w#selection-119.7-135.119

In practice, unknown factors can influence the result, so it is best to benchmark your code and try a bunch of values until you find the fastest configuration.

threeducks··on Shift-to-Middle Array: A Faster Alternative to Std:Deque?
> I recently developed a new data structure

Congratulations, you have discovered the array deque!

https://en.wikipedia.org/wiki/Double-ended_queue#Implementat...

I'd like to point out a performance optimization. On resize, you create a new array with double the size and copy all the old elements to the middle of the new array with more space at the beginning AND at the end: https://github.com/attilatorda/Shift-To-Middle_Array/blob/05...

However, in practice, it is often the case that most operations append elements at either the front OR back, but rarely at both ends equally. For example, imagine a FIFO queue, where elements are popped from the front and pushed from the back. Therefore, it is more efficient to only reserve space at the back if the last operation was push_back or at the front if the last operation was push_front.

One could also carry along statistical information about the number of push_back and push_front operations and balance the space allocated at the front and back accordingly.

In addition to ksherlock's points, there are also the following issues:

- Vector implementations usually use size_t instead of int. Your implementation will fail for arrays larger than 2147483647, while size_t usually goes up to 18446744073709551615.

- On memory allocation failure, you should throw std::bad_alloc instead of calling std::exit.

- The front() function is missing a return statement. Turn on compiler warnings: -Wall -Wextra. For testing, -g -fsanitize=address,undefined is also helpful.

- You are mixing delete[] with malloc'ed memory in shrink_to_fit.

- You should implement copy constructor, move constructor, copy asignment and move assignment functions. See rule of five: https://en.cppreference.com/w/cpp/language/rule_of_three#Rul...

- Switching features on or off is usually done with macros instead of comments.

- 2 is not the best growth factor because it makes it harder for the memory allocator to reuse memory. More modern implementations use smaller growth factors: https://en.wikipedia.org/wiki/Dynamic_array#Growth_factor

- A more reasonable initial capacity would be 0 instead of 16, as is common for all major std::vector implementations. An initial capacity of 16 wastes a lot of space when a large number of ShiftToMiddleArrays are allocated.

- The compiler will most-likely ignore your inline instructions and decide on its own whether inlining is done or not, so might as well remove them.

- Why are there two versions of the data structure? (ShiftToMiddleArray.cpp and ShiftToMiddleArray.h)

- Some functions are just wrappers for other functions (pop_front = remove_head, pop_back = remove_tail). Why?

LLMs can point out most of those issue, so you should use them to discover potential issues. Of course, make sure to double-check with more reliable sources once you know that a certain class of problems exists.

threeducks··on Facebook to stop targeting ads at UK woman after legal fight
The accursed Cox Media Group has since released the following statement on their website: https://www.cmg.com/news/cmg-responds-reports-about-disconti...

    CMG Responds to Reports About Discontinued Active Listening Product

    As we stated before, CMG businesses have never listened to any conversations nor had access to anything beyond third-party aggregated, anonymized, and fully encrypted data sets that can be used for ad placement. The information referenced in recent stories is based on outdated materials for a product that CMG Local Solutions no longer sells (although the product never listened to customers, it has long been discontinued to avoid misperception). CMG Local Solutions markets a wide range of advertising tools. Like other advertising companies, some of those tools include third-party vendor products powered by data sets sourced from users by digital publishers and other applications and then packaged and resold to data servicers. Advertising data based on voice and other data is collected by these platforms and devices under the terms and conditions provided by those apps and accepted by their users. This data can then be sold to third-party companies and converted into anonymized information for advertisers. This anonymized data then is resold by numerous advertising companies.
In particular, let me highlight this sentence:

    Advertising data based on voice and other data is collected by these platforms and devices under the terms and conditions provided by those apps and accepted by their users.
To me, this sounds like "We did not spy ourselves, but we bought data from other people who did the spying for us, and that was legal because some user checked a checkbox somewhere".
threeducks··on GIMP 3.0
> putting multiple icons under the same button and then changing the icons too to make it entirely impossible to find anything

This also annoys me to no end. Here is how to fix the icons:

Ungroup GIMP tool icons:

    Edit -> Preferences -> Interface -> Toolbox -> Untoggle "Use tool groups"
Restore old icons with color:

    Edit -> Preferences -> Interface -> Icon Theme -> Select "Legacy"
And while we are at it, here are a few more quality-of-live improvements:

- Pressing '/' opens a search dialog for all tools.

- By default, the brush size selector precision is garbage. You can get fine precision by using '[' or ']' keys, mouse wheel or right click + drag instead of left click + drag.

GIMP can do most things, but it is unfortunately a good example of how sane defaults are important.

That being said, I've tried version 3 and did not notice a large difference in UI except that everything is a darker shade of gray: https://i.imgur.com/Lj5BIA2.png

    sudo snap install gimp --channel=preview/stable
    /snap/bin/gimp
threeducks··on The Einstein AI Model
The nice think about LLMs is that they can answer some questions which were not in the training set. Unfortunately, it is not easy to tell when that is the case.
← PreviousPage 4 of 5Next →