This blog is co-authored by Ravikant Bhargava & Ankit Hinge.
Cropin is releasing its first Micro Language Model (µ-LM) for climate smart agriculture, akṣara, under the Apache 2.0 license, without any restrictions. This removes barriers to knowledge and empowers anyone in the agriculture ecosystem to build frugal and scalable AI solutions for the sector.
The major focus countries are India, Bangladesh, Nepal, Pakistan, and Sri Lanka. The major focus crops are Paddy, Wheat, Maize, Sorghum, Barley, Cotton, Sugarcane, Soybean, and Millets.
This question-answering system is based on the Mistral-7B instruct-tuned model, and akṣara is fine-tuned on a dataset from the above focus countries and crops and then compressed from 16-bit to 4-bit, using QLoRA, for minimal resource consumption during inferencing while still giving ~40% more relevant ROUGE score than GPT-4 Turbo on randomly selected test datasets. The knowledge domain of the model is specific to the agricultural best practices, including climate-smart agricultural practices (CSA) and regenerative agricultural practices (RA) for the above-mentioned focus countries and crops. More geographies and crops will be added later. The model is trained on a database containing information from seed sowing to harvesting, covering every phenological stage of the crop growth cycle and different aspects like crop health management, soil management, disease control, and others. The end-to-end pipeline incorporates various aspects of Responsible AI (RAI), like considering local features and preventing harmful content or misinformation.
In Albert Einstein’s words: “You can’t solve a problem on the same level that it was created. You have to rise above it to the next level.” In Agtech, where there’s no precedent, we always start fresh when working on new projects or problems. One challenge we are passionate about solving is the impact of climate risks on agriculture. No matter how many solutions we develop, use cases we explore, or AI models we introduce, the enormity of this problem is such that climate change continues to present new challenges.
We are also convinced that the best solution to mitigate climate change risks in agriculture is empowering every farmer to be climate-smart. However, this is no easy feat. At a time when farmers worldwide face numerous challenges, empowering them with sustainable and climate-smart farming methods is a daunting task. But we firmly believe that a day will come when the world will unite to empower the 600+ million farmers worldwide to mitigate climate risks. Farmers are a powerful force themselves, and without empowering them and transforming global food systems, we will never achieve our net-zero goals.
It is with this conviction that Cropin’s AI Labs team shares this AI-enabled development to empower farmers to be climate-smart, especially those in the global south. We need your support to ensure it reaches every farmer in the global south, as well as agronomists, agri-scientists, researchers, academia, and policymakers.
Figure 1: Architecture
As shown in Figure 1 above, our application is based on Retriever Augmented Generation (RAG). We used RAG because while inferencing our initial fine-tuned model, we found that many of the responses were too specific. The responses missed out on generic advice and conversational behavior. There were also instances of hallucination when queries were out of the training data domain. We hypothesize that it was due to two reasons:
There was another problem: more data was being curated while we were iterating on the model. We didn’t want to keep fine-tuning even if there was only a small change in the dataset. To counter these issues, we implemented RAG using LangChain. Following is the workflow now:
We have many ideas for improving this RAG further. If you have any suggestions or want to collaborate on this, please feel free to contact us (see the ‘How to Contribute’ section).
From an infrastructure point of view, this whole application takes ~6 GB of CPU RAM, ~ 6 GB of GPU RAM (thanks to 4-bit compression) and can run on even 2 CPU cores.
We all understand that AI systems are probabilistic in nature and can lead to a negative impact on society and the environment if we are not careful. That is why we have taken the following steps to ensure our AI behaves responsibly.
For the evaluation, we compared our model with the GPT-4 Turbo.
For qualitative analysis, we compared a small number of test outputs from both models with the ground truth. As expected our model provided more factual and numerical data in the response compared to GPT-4 Turbo. For e.g., as shown in Figure 2 below, akṣara’s output for the query ‘How can I control Thrips in my maize crop?’ contains precise values for the chemical treatment of Thrips in Maize. Whereas the output from GPT-4 Turbo shown in Figure 3 does not provide such precise values for chemical control if I ask the same query.
Figure 2: akṣara’s output
Figure 3: GPT-4 Turbo output
For quantitative analysis, we compared the ROUGE and BLEU scores of akṣara and GPT-4 Turbo with the ground truth as a reference. This was done for the whole test dataset, and as seen in the following table, the outputs from akṣara were closer to the ground truth than those of GPT-4.
We will also release a pre-print with more details on Arxiv very soon.
akṣara is accessible via Hugging Face at: https://huggingface.co/spaces/cropinailab/aksara
The app section provides an interactive dashboard to ask questions in English. Note that currently, only select geographies and crops are the focus of the training corpus. So, you may get a bit more generic answers for other geographies and crops.
The files section provides code for the application.
We have lofty goals for akṣara. We want to cut the divide created by language, resources, and literacy and make it possible for every farmer to access this information easily. And while we will pursue this noble mission anyway, more hands and brains can help us expedite the journey. So, we call for enthusiasts to reach out to ‘ailabs@cropin.com’ in case they want to collaborate with us on taking the next steps. If you are a lone wolf and want to build on your own, we are open-sourcing the model and application code (training code will be released soon) to build upon it. We will continue to open-source any new advancements we make in this project.
We extend our gratitude to the open-source community, whose diverse contributions form the foundation of akṣara. A special acknowledgment goes to the Mistral team for open-sourcing their model, thus eliminating barriers to accessing high-quality LLMs. We are also grateful to Google’s Responsible AI team for their discussions and access to Google’s People + AI Guidebook, which helped guide the model’s design process.