Hacker News new | ask | show | jobs
by theshrike79 94 days ago
Did you give Claude a way to test/verify/benchmark said algorithm compared to other solutions?

If not, how can it not hallucinate when you didn't give it any constraints?

1 comments

You can just tell it that it's doing it wrong (and why). Of course, you have to know that it did it wrong.
The point is that if you know the algorithm will produce X as the output if the input is Y, give that as a tool to Claude

And if you know that the previous algorithm completes in Z milliseconds, tell Claude that too and give it a tool (a command it can run) to benchmark its implementation.

This way you don't need to tell it what it did wrong, it'll check itself.

It was the other way around. Claude gave me an algorithm. I found it fishy. So I specifically constructed a counterexample in response to Claude’s algorithm.

Of course when I gave that to Claude, Claude changed the algorithm. But if I didn’t have enough experience and CS fundamentals to find it fishy in the first place, why would I construct a counterexample?

The prompt would be <select code>, "Use a std::unordered_map<>" to make this code run faster." Review the code. Done.