DEV Community

Cover image for Introducing Neural: A DSL and Debugger for Neural Networks
NeuralLang
NeuralLang

Posted on • Edited on

3 2 3 1

Introducing Neural: A DSL and Debugger for Neural Networks

Hi everyone! 👾 I’m excited to share "Neural," a project I’ve been working on to simplify neural network development. Neural is a domain-specific language (DSL) and debugger that lets you define, train, and debug models with ease—whether via code, CLI, or a no-code interface. 🎛

Neural 0.1.0 Logo

Why Neural?

Building neural networks can be complex—boilerplate code, shape mismatches, and debugging woes slow us down. Neural tackles this with:

  • A YAML-like DSL: Define models concisely (e.g., Conv2D(filters=32, kernel_size=(3,3))).
  • NeuralDbg: Real-time monitoring of gradients, execution traces, and resources, with a --hacky mode for security analysis.
  • Cross-Framework Support: Export to TensorFlow, PyTorch, or ONNX.

Example: MNIST Classifier

Here’s a quick .neural file:

network MNISTClassifier {
  input: (28, 28, 1)
  layers:
    Conv2D(filters=32, kernel_size=(3,3), activation="relu")
    MaxPooling2D(pool_size=(2,2))
    Flatten()
    Dense(units=128, activation="relu")
    Output(units=10, activation="softmax")
  loss: "sparse_categorical_crossentropy"
  optimizer: Adam
}
Enter fullscreen mode Exit fullscreen mode

Compile And Run

pip install neural-dsl
neural compile mnist.neural --backend pytorch
neural run mnist_pytorch.py
Enter fullscreen mode Exit fullscreen mode

Debug And Test

neural debug mnist.neural --hacky
Enter fullscreen mode Exit fullscreen mode

Visit http://localhost:8050 to see gradients, resource usage, and potential security breaches.


 Neural-dsl is a WIP DSL and debugger, bugs exist, feedback is welcome!


What’s Next?

  • I’m adding automatic hyperparameter optimization (HPO), research paper generation, and TensorBoard integration.

Try it out on GitHub and let me know what you think!

Neural

🦾 Share your feedback—I’d love to hear from the community!

Top comments (2)

Collapse
 
silviaodwyer profile image
Silvia O'Dwyer •

This looks like a very useful library, I'm just wondering if you could link to the GitHub repo? Would love to take a look at it!

Collapse
 
neural profile image
NeuralLang •

Thanks for the kind words! I’m glad you find the library useful. I’d be happy to share the GitHub repo with you! You can check it out here. Github Feel free to explore, contribute, or open issues if you run into anything—looking forward to hearing your thoughts!

Happy coding!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

đź‘‹ Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay