YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

πŸ… KisanAgent: Empowering Climate-Resilient Agriculture with RL

Meta-PyTorch Hackathon OpenEnv Framework Unsloth Optimized

"Can an AI learn the delicate balance between profit and sustainability in a changing climate?"

KisanAgent is an advanced Reinforcement Learning (RL) agent built on the OpenEnv Framework for the Meta-PyTorch Hackathon Finale. It solves the "KisanEnv" challenge: a high-fidelity farming simulation where every decisionβ€”from irrigation to pest controlβ€”carries causal consequences over a 90-day growth cycle.


πŸš€ The Vision: Why KisanAgent?

Global agriculture faces a dual crisis: Climate Volatility and Economic Uncertainty. Modern farmers must navigate complex, non-linear variables like soil moisture, pest cycles, and market prices.

KisanAgent is a proof-of-concept demonstrating that Deep Reinforcement Learning (GRPO) can master these complexities. By training a Large Language Model (LLM) as a decision-making agent, we bridge the gap between "Stochastic Simulation" and "Human-Readable Reasoning."


🧠 The Novel Environment: KisanEnv

Built strictly on the OpenEnv Core, KisanEnv is a specialized Gymnasium-based world that features:

  • Causal Growth Cycles: 5 distinct stages of tomato growth (Seedling -> Harvest).
  • Multi-Factor Sustainability: Decisions impact not just bank balance, but also soil health and crop resilience.
  • Probabilistic Events: Random weather and pest outbreaks that require adaptive strategy.
  • Standardized API: Fully compliant with the OpenEnv server-client architecture.

πŸ› οΈ The Training Stack (TRL + Unsloth + GRPO)

We didn't just fine-tune; we Reinforced.

  • Model: Qwen-2.5-7B (instruct version), optimized with Unsloth for 2x faster training.
  • Method: GRPO (Group Relative Policy Optimization).
  • Reward Logic: A unique 3-tier reward system:
    1. Format Reward: 0.2 bonus for valid JSON output.
    2. Tool-Use Reward: 0.1 bonus for active environment interaction.
    3. Economic Reward: Scaled reward based on net income and crop health.

πŸ“ˆ Evidence of Learning

We didn't just say it works; we proved it.

Training Performance Dashboard

KisanAgent Training Dashboard

Summary of Results (Final Production Run)

Epoch Format Reward (Mean) Kisan Reward (Mean) Total Reward Loss
0.01 0.1250 0.0000 0.1250 0.0000
0.03 0.1312 0.0000 0.1312 0.0065
0.04 0.1250 0.0000 0.1250 0.0004
0.05 0.1375 0.0000 0.1375 0.0108
0.12 0.1562 0.0000 0.1562 0.1122
0.15 0.1437 0.0000 0.1437 0.0988
0.22 0.1000 0.0000 0.1100 0.0529
0.32 0.1312 0.0000 0.1312 0.0486
0.45 0.1687 0.0000 0.1687 2.6225
0.60 0.1187 0.0000 0.1187 0.0006
0.80 0.1687 0.0000 0.1687 0.0012
1.16 0.2000 0.0000 0.2000 0.0016

πŸ”— Project Materials

Asset Link
Technical Blog Deep Dive & Results Analysis
Hugging Face Space Live Agent Demo
Trained Weights Final GGUF Model Repository

πŸ’» Setup & Execution

1. Run the Environment Server

uvicorn server.app:app --host 0.0.0.0 --port 7860

2. Run the Trained Agent (Inference)

python inference.py

3. Choose Your Training Method

We provide two ways to replicate our Reinforcement Learning results:

  • Interactive (Google Colab): Perfect for re-running and visual exploration.
  • Production (Hugging Face Jobs): Our primary method for high-performance training on NVIDIA A10G-Large.
    • Run: hf jobs uv run training/train_grpo_unsloth.py
    • This script includes automated GGUF export, auto-checkpointing, and Hub integration.

πŸ† Submission Checklist

  • OpenEnv Integrated: Built on the latest framework release.
  • Verified Training: Real loss/reward plots provided.
  • Discoverable: Environment pushed to Hugging Face Spaces.
  • Transparent: Full source code and documentation.

Developed for the Meta-PyTorch OpenEnv Hackathon Finale.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Space using gouravbirwaz/kisanagent-training 1