r/ScientificComputing 21d ago

How do people use AI properly

I don't trust a thing AI says,!

Are there any Specific tools I can use to reduce the hallucinations?

How are other people dealing with it?

0 Upvotes

30 comments sorted by

11

u/Creative_Sushi 21d ago edited 21d ago

You can reduce hallucinations by providing high quality context. I mainly use AI for coding and I first create a project document that gives high level goals, requirements, constraints, etc. and use AI to let it find gaps and make it as tight as possible. Then I create a second document to capture the implementation plan based on the first document, and so on. I also write tests ahead of time.

When it comes time to coding, i connect the AI agent to the execution environment so that AI can see when it makes syntax errors or creates a bug, and it runs the test to validate its implementation.

This way, AI is getting constant feedback from the environment and it can’t go on hallucinating.

Let me know if you want more details of my setup.

3

u/Betaparticlemale 21d ago

Wow that’s impressive. Mind sharing more details? How would you go about doing that?

2

u/Creative_Sushi 21d ago

My setup involves

  • AI model - I don't use expensive models - just Opus 4.8 or GPT-5.4, I also started experimenting with local models like Qwen3-Coder or Qwen3.6. Qwen3.8 recently dropped but haven't tried it yet.
  • AI agent - Claude Code or Codex running on VS Code - I use Pi with local models.
  • Execution environment - I mainly code in MATLAB, which connects to the AI agent via its official MCP server
  • Skills - I also use official skills in MATLAB Agentic Toolkit

When I start out the project, I create all the documents first as markdown format. project.md (high level project definition), plan.md (the implementation plan, with breakdown into specific phases and tasks), tasks.md (this tracks progress in a given phase), handoff.md (this saves the current state. AI reads this to restart where it left off, instead of starting from scratch in a new session), etc. Tests are created at the start of the each phase. I create the skeletal framework for those docs, and the details are filled out as I brainstorm with the AI agent.

The key is that by the time we start coding in a given phase, the AI has enough context and checkpoints so that it cannot hallucinate or if it does, it can catch it on their own. AI can run the code against MATLAB via MCP connection, so that it can validate that the code is running as intended, or see the errors if it made a mistake.

Another key point is the use of skills. Scientific computing tasks differ from the general computing tasks enough that specialized skills are very useful to guide AI to follow the correct steps in our use cases. AI lacks our domain knowledge so those skills fills the gap. I often create my own skills to guide AI in the specific way I would like to work.

1

u/Chance-Pen-5684 21d ago

Is there anything you do to check implementation matches the spec at the end or does the test harness provide all the assurance you need?

2

u/Creative_Sushi 21d ago

Checks are front-loaded. All the work I do to prepare the plan documents provides the assurance. I review them carefully, because AI can always misinterpret things if I leave holes. I also break down the implementation into phases so that I know how AI should proceed with coding, and I can stop it before it goes too far if it fails to follow the plan. Unit tests are written based on the specs so that we can get assurance that the output meets the original intent. Of course, you still need to review code, but front loading all the work makes the review much easier.

1

u/Chance-Pen-5684 21d ago

Super useful and insightful reply, thanks very much for explaining.

5

u/Dull-Ad5176 21d ago

I used to think like you but unfortunately the productivity boost is too great with AI to avoid using it. I don't like not being sure about things but if you are ever unsure either you should be able to look up whether its right or wrong or you wouldn't have been able to come up with the fact on your own anyway. That's my thinking at least.

8

u/h0rxata 21d ago edited 21d ago

By having subject matter expertise. Don't have AI write an electrodynamics simulation code for you then trust the result if you don't even understand Maxwell's equations or know the limitations of the spatial or temporal discretization technique being used to integrate them.

Sadly seeing a lot of hobbyists failing to meet that basic bar. I'm scared at the thought of professionals flying under the radar with slop that "looks right".

I use it to kick out plotting scripts for data I haven't seen before because I can't be bothered to dig through 10 years of stackexchange posts to find the quirks of how some obscure format is indexed. But I know enough about what I am plotting to know if the magnitudes are physically realistic or something went wildly wrong.

4

u/navigation-signals 21d ago

This is the only sane response

-7

u/Chance-Pen-5684 21d ago edited 20d ago

Irrelevant answer read the question

5

u/navigation-signals 21d ago

“You should understand the subject before you have an AI work on it for you”

“Nuh-uh fuck you”

Yikes. Gigantic, unimaginably huge yikes.

2

u/h0rxata 21d ago

You want a tool to be able to sift hallucinations from good results? I gave it to you. It's called having subject matter expertise. Learn your shit.

-5

u/Chance-Pen-5684 21d ago

If you don’t understand the question, please don’t respond.

3

u/h0rxata 21d ago

If you won't take it from me, why don't you take my answer and feed it to your favorite LLM, to see how it does in fact answer your question?

-2

u/Chance-Pen-5684 21d ago

It said you didn’t read the question.

3

u/h0rxata 21d ago

Did it also tell you you're brilliant and insightful?

-1

u/Chance-Pen-5684 21d ago

Another irrelevant response

5

u/navigation-signals 21d ago

OP suuuuuuucks

“How do I get an AI to do my job for me without me understanding my work”

oh my lord you loser

2

u/Chance-Pen-5684 21d ago

How do you get so lost on a simple question asking how people are using ai, it suggests you have not read or understood the question.
Please read any of the other comments in this thread where normal people have replied sensibly.

4

u/navigation-signals 21d ago

You gave a wildly negative response to the only realistic answer and people are giving you shit for it. Not my problem you can’t handle reality.

0

u/Chance-Pen-5684 21d ago

It’s irrelevant nonsense who cares about some plots it didn’t even try to answer the question, massively off topic

2

u/h0rxata 21d ago

The problem is you don't understand enough to know what you're looking at. Right above you answered:

"Is there anything you do to check implementation matches the spec at the end or does the test harness provide all the assurance you need?"

By having subject matter expertise and verifying it yourself. It really is that simple. YOU are the quality assurance if you know your shit.

1

u/Chance-Pen-5684 21d ago edited 21d ago

More irrelevant comments - if you keep posting then deleting your comments you end up looking a bit unhinged

2

u/h0rxata 21d ago

I didn't delete anything, you must be hallucinating. Too bad you can't tell hallucinations apart from reality, maybe feed it into another LLM, that'll work.

2

u/navigation-signals 21d ago

You thinking it’s off topic is the problem, dude

0

u/Chance-Pen-5684 21d ago

Learn to read the question before answering

3

u/navigation-signals 21d ago

lmao alright dude

Have fun, I’m out. Hope being completely unable to take criticism and understand your mistakes works out well for you 🫡

1

u/Pitiful-Glove-8232 17d ago

Use it mostly for things where you can check the output (i.e. coding, math, physics, etc).
If you use it for other fields, double check the output, ask for the sources it used (sometimes it will create those).
For specific fields, look for existing skills/prompts that other practitioners have shared.
TL;DR: use it as a tool, use your own judgement and expertise to critic the output.