Skip to content

Latest commit

Β 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AlgebrAI: A Code-Generating Linear Algebra Calculator

AlgebrAI is an AI-powered calculator built to solve linear algebra problems with high precision.

Unlike general-purpose language models that often produce incorrect or inconsistent math outputs, AlgebrAI generates and executes reliable Python code to directly compute the accurate final answer.

It is powered by a fine-tuned Qwen 3 1.7B model enhanced with QLoRA adapters, and trained on a custom dataset of linear algebra problems paired with executable Python solutions. When a user inputs a natural language math problem, the model:

  1. Understands the query,
  2. Generates valid Python code to solve it (e.g., SVD, eigenvalues),
  3. Executes the code, and
  4. Returns the final result.

🧠 What Makes This Different

  • Purpose-built for linear algebra

Unlike generic LLMs that fumble math, AlgebrAI is fine-tuned specifically to handle linear algebra queries with precision and consistency.

  • Direct code execution

It converts math queries into executable Python code, and returns only the final answer with no fake steps or guesswork.

  • Custom Training Data

Trained on a hand-crafted dataset of 6000+ real linear algebra problems.

πŸ“‚ Project Files

 β”œβ”€β”€ linear_algebra.ipynb # Main notebook (run your queries here) 
 β”œβ”€β”€ final_dataset_no_comments.json # Training/inference dataset
 └── README.md # Project documentation 

πŸš€ Run It Yourself

1. Clone the Repo

 
   git clone https://github.com/Umme-2003/AlgrbAI.git 
   cd AlgrbAI 

2.Install dependencies

   pip install numpy torch transformers peft accelerate

⚠️ GPU recommended for faster model inference

3. Launch the notebook

   jupyter notebook

Open linear_algebra.ipynb and run the cells step-by-step. You can enter your own linear algebra problem and watch the model solve it with generated Python code.

✨ Sample Usage Input Prompt:

   Let A = [[1, 2], [3, 4], [5, 6]]. Perform Singular Value Decomposition (SVD) on matrix A and return its singular values.

Model Output:

import numpy as np
A = np.array([[1, 2], [3, 4], [5, 6]])
U, S, Vt = np.linalg.svd(A)
print(S)

Final Answer:

   [9.5255, 1.5143]

🧠 Model Info

  • Base LLM: Qwen 3 1.7B

  • Tuning: LoRA adapters on a curated problem-code dataset

  • Inference Tools: Hugging Face Transformers + PEFT

  • Execution Env: Jupyter / Lightning AI


Use Cases

  • πŸ§‘β€πŸŽ“ Students verifying linear algebra homework
  • πŸ‘©β€πŸ’» Developers testing numerical algorithms
  • πŸ€– Researchers benchmarking LLMs for mathematical reasoning

About

AI-Powered Linear Algebra Solver

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages