# Julia vs C++ for Automated Reasoning

**URL:** <https://discourse.julialang.org/t/julia-vs-c-for-automated-reasoning/109268>\
**Category:** General Usage\
**Tags:** llm, graph\
**Created:** [January 25, 2024, 6:00pm UTC](https://discourse.julialang.org/t/julia-vs-c-for-automated-reasoning/109268 "2024-01-25T18:00:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajaram\_Venkataraman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rajaram_venkataraman/32/205632_2.png) [@Rajaram\_Venkataraman](https://discourse.julialang.org/u/Rajaram_Venkataraman)\
**Post date:** [January 25, 2024, 6:00pm UTC](https://discourse.julialang.org/t/julia-vs-c-for-automated-reasoning/109268/1 "2024-01-25T18:00:20Z")

</div>

Hello - I have to develop an automated reasoning system that combines the power of f language models and graph processing rather than HoQ, Isabelle or LEAN type approach. It requires new development and plan to use either C++ or Julia. Could someone please help by letting me know if Julia has the required packages? I need the following packages

1. LaTeX Processing
2. Knowledge Graph
3. LLM
4. GNNs (Graph Neural Networks)

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [January 25, 2024, 6:10pm UTC](https://discourse.julialang.org/t/julia-vs-c-for-automated-reasoning/109268/2 "2024-01-25T18:10:54Z")

</div>

1. Latexify.jl
2. Not sure what you’re asking for here. If you want a fully fledged database, there is TypeDBClient.jl, which is a client for an TypeDB. If you just want to build graphs in Julia, then check out Graphs.jl
3. Transformers.jl
4. GraphNeuralNetworks.jl

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [January 26, 2024, 12:23pm UTC](https://discourse.julialang.org/t/julia-vs-c-for-automated-reasoning/109268/3 "2024-01-26T12:23:21Z")

</div>

> [@Rajaram\_Venkataraman](#):
>
> plan to use either C++ or Julia.

I would think Julia could very well work, like for RelationalAI, one of the main Julia companies. I note it doesn’t need to be either or, Julia could be your main language, but you can call C++ code. It’s very easy to call Python, C, R, Rust etc. to and from, and from C++. It’s a bit hard to call C++ from any language, e.g. because of its name mangling, but a solved problem. I think Julia does about as well as from other languages, as other languages do, e.g. from Python.

I googled a bit to see what’s out there:

> **[Building a RKGS in Julia - RelationalAI](https://relational.ai/blog/building-a-rkgms-in-julia)**
>
> Molham Aref and Nathan Daly describe their experience using Julia to build a next-generation knowledge graph database that combines reasoning and learning to solve problems that have historically been intractable.

> [videos]  
> Molham Aref and Nathan Daly describe their experience using Julia to build a next-generation knowledge graph **database** that combines reasoning and learning to solve problems that have historically been intractable. They explain how Julia’s unique features enabled them to build a high-performance database with less time and effort.

I bolded **database** there, and note it’s proprietary software, but their reasons for preferring Julia may apply to you, and possibly you could use their system…

I don’t know what’s available in C++, just showing first/very old hit I got:

> **[GitHub - kckishan/knowledgegraph: Knowlegde Graph Implementation in C++](https://github.com/kckishan/knowledgegraph)**
>
> Knowlegde Graph Implementation in C++. Contribute to kckishan/knowledgegraph development by creating an account on GitHub.

LLMs are much more used from Python still, implemented by C++, but you can reuse all of that from Julia, at least in theory, e.g. people adding such to Transformers.jl, so in practice too. I don’t hear _users_ using C++ much directly, for LLMs.

You can easily call all (LLM) models, using PythonCall.jl, see also @Tomas_Pevny’s about making it more user-friendly, integrating into Transformers.jl (most models are not there)

> [@A discrepancy in self-attention between python and Julia (Transformers)](https://discourse.julialang.org/t/a-discrepancy-in-self-attention-between-python-and-julia-transformers/109195):
>
> Hi, I am continuing the porting of microsoft Phi model to the Transformers.jl. The most complicated is the self-attention, where I am lost, but gradually removing abstraction layers of Neuralattentionlib.jl to get to the gist. Right now, I am stucked with a following problem of computing weights in self-attention. In Julia, I have julia\> size(query\_rot\_states) (64, 32, 6) julia\> size(key\_rot\_states) (64, 32, 6) julia\> attn\_weights = scaled\_dot\_product\_score(query\_rot\_states, key\_rot\_states)…

---

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [January 26, 2024, 1:21pm UTC](https://discourse.julialang.org/t/julia-vs-c-for-automated-reasoning/109268/4 "2024-01-26T13:21:41Z")

</div>

Hi Rajaram,

this is an interesting topic. We had a paper this year at neurips about optimizing heuristic function for planning problems, see the paper here: [Optimize Planning Heuristics to Rank, not to Estimate Cost-to-Goal | OpenReview](https://openreview.net/forum?id=Mgy6sgslPY). The part that implemented heuristics for general planning problems defined by PDDL was written in Julia and we are still working on it. We originally relied on GNNs, but then we realized that predicates with higher arity might be useful and wrote a custom tooling, which does not have much documentation unfortunately. I have two Bc students working on it, but I am not sure, if it will improve the documentation. I would be happy to help, if you detail your plans.

I would go for Julia rather than C++, since you would be able to reach your goal faster.
