SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2603.03294 · 2026

Fine-Tuning and Evaluating Conversational AI for Agricultural Advisory

Ritesh Kumar, Digital Green, Sanyam Singh, Naga Ganesh, Vineet Singh, Lakshmi Pedapudi, Ssp Jyothi, Archana Karanam, Waseem Pasha, Ekta Kumari, C Yashoda, Mettu Vijaya, and 3 more

arXiv · PDF · Open in the Atlas

Code that ran

2 of 6 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 4 no recorded run), measured 2026-11-22; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2603.03294.json · badge: /api/ran/2603.03294.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
digitalgreenorg/farmerchat-prompts community
Papers with Code archive
2 ran · 4 no recorded run
FunctionStatusWhere it lives
PromptManager Ran
ran on a synthesized input · constructed an object; no result was computed
digitalgreenorg/farmerchat-prompts/farmerchat_prompts/manager.py
code served (permissive licence) · get_code("4f0bdc8931447533")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, PromptManager: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from datetime import datetime
from typing import Dict, List, Optional, Any
from enum import Enum

# Define the enums and classes as they appear in the function
class Domain(str, Enum):
    CROP_ADVISORY = 'crop_advisory'
    PROMPT_EVALS = 'prompt_evals'

class Provider(str, Enum):
    OPENAI = 'openai'
    LLAMA = 'llama'
    GEMMA = 'gemma'

class UseCase(str, Enum):
    CROP_RECOMMENDATION = 'crop_recommendation'
    PEST_MANAGEMENT = 'pest_management'
    SOIL_ANALYSIS = 'soil_analysis'
    WEATHER_ADVISORY = 'weather_advisory'
    MARKET_INSIGHTS = 'market_insights'
    SPECIFICITY_EVALUATION = 'specificity_evaluation'
    FACT_GENERATION = 'fact_generation'
    FACT_RECALL = 'fact_recall'
    CONTRADICTION_DETECTION = 'contradiction_detection'
    RELEVANCE_EVALUATION = 'relevance_evaluation'
    FACT_STITCHING = 'fact_stitching'
    CONVERSATIONALITY_EVAL_FOR_STITCHING = 'conversationality_eval_for_stitching'

class PromptMetadata:
    def __init__(self, provider, use_case, domain=Domain.CROP_ADVISORY, 
                 version='1.0.0', created_at=None, description='', tags=None):
        self.provider = provider
        self.use_case = use_case
        self.domain = domain
        self.version = version
        self.created_at = created_at or datetime.now()
        self.description = description
        self.tags = tags or []

class Prompt:
    def __init__(self, metadata, system_prompt, user_prompt_template, 
                 variables=None, examples=None):
        self.metadata = metadata
        self.system_prompt = system_prompt
        self.user_prompt_template = user_prompt_template
        self.variables = variables or {}
        self.examples = examples

    def format(self, **kwargs) -> str:
        return self.user_prompt_template.format(**kwargs)

    def get_full_prompt(self, user_input: str) -> Dict[str, Any]:
        if self.metadata.provider == Provider.OPENAI:
            return {
                'messages': [
                    {'role': 'system', 'content': self.system_prompt},
                    {'role': 'user', 'content': user_input}
                ]
            }
        elif self.metadata.provider == Provider.LLAMA:
            return {
                'prompt': f'[INST] <<SYS>>\n{self.system_prompt}\n<</SYS>>\n\n{user_input} [/INST]'
            }
        elif self.metadata.provider == Provider.GEMMA:
            return {
                'prompt': f'<start_of_turn>user\n{self.system_prompt}\n\n{user_input}<end_of_turn>\n<start_of_turn>model\n'
            }
        return {}

    def __str__(self) -> str:
        return f'Prompt({self.metadata.provider.value}, {self.metadata.use_case.value})'

# Create sample prompts for testing
sample_metadata_openai = PromptMetadata(
    provider=Provider.OPENAI,
    use_case=UseCase.CROP_RECOMMENDATION,
    domain=Domain.CROP_ADVISORY,
    description='OpenAI crop recommendation prompt'
)

sample_prompt_openai = Prompt(
    metadata=sample_metadata_openai,
    system_prompt='You are an agricultural expert.',
    user_prompt_template='Recommend crops for {soil_type} soil in {region}.',
    variables={'soil_type': 'loamy', 'region': 'Bihar'},
    examples=[
        {'input': 'Sandy soil', 'output': 'Consider drought-resistant crops'}
    ]
)

sample_metadata_llama = PromptMetadata(
    provider=Provider.LLAMA,
    use_case=UseCase.PEST_MANAGEMENT,
    domain=Domain.CROP_ADVISORY,
    description='Llama pest management prompt'
)

sample_prompt_llama = Prompt(
    metadata=sample_metadata_llama,
    system_prompt='You are a pest management specialist.',
    user_prompt_template='How to manage {pest} on {crop}?',
    variables={'pest': 'aphids', 'crop': 'wheat'}
)

sample_metadata_evals = PromptMetadata(
    provider=Provider.GEMMA,
    use_case=UseCase.SPECIFICITY_EVALUATION,
    domain=Domain.PROMPT_EVALS,
    description='Gemma specificity evaluation prompt'
)

sample_prompt_evals = Prompt(
    metadata=sample_metadata_evals,
    system_prompt='Evaluate the specificity of agricultural advice.',
    user_prompt_template='Rate specificity: {text}',
    variables={'text': 'Use pesticides carefully.'}
)

# Create a minimal PromptManager instance (no __init__ parameters based on the code)
ARGS = {}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PromptManager — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PromptManager output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PromptMetadata Ran
ran on a synthesized input · constructed an object; no result was computed
digitalgreenorg/farmerchat-prompts/farmerchat_prompts/manager.py
code served (permissive licence) · get_code("3926c1be38a07175")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, PromptMetadata: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from enum import Enum
from pydantic import BaseModel, Field
from datetime import datetime

class Domain(str, Enum):
    """Available domains"""
    CROP_ADVISORY = 'crop_advisory'
    PROMPT_EVALS = 'prompt_evals'

class Provider(str, Enum):
    """Supported AI providers"""
    OPENAI = 'openai'
    LLAMA = 'llama'
    GEMMA = 'gemma'

class UseCase(str, Enum):
    """Agricultural use cases"""
    CROP_RECOMMENDATION = 'crop_recommendation'
    PEST_MANAGEMENT = 'pest_management'
    SOIL_ANALYSIS = 'soil_analysis'
    WEATHER_ADVISORY = 'weather_advisory'
    MARKET_INSIGHTS = 'market_insights'
    SPECIFICITY_EVALUATION = 'specificity_evaluation'
    FACT_GENERATION = 'fact_generation'
    FACT_RECALL = 'fact_recall'
    CONTRADICTION_DETECTION = 'contradiction_detection'
    RELEVANCE_EVALUATION = 'relevance_evaluation'
    FACT_STITCHING = 'fact_stitching'
    CONVERSATIONALITY_EVAL_FOR_STITCHING = 'conversationality_eval_for_stitching'

class PromptMetadata(BaseModel):
    """Metadata for a prompt template"""
    provider: Provider
    use_case: UseCase
    domain: Domain = Domain.CROP_ADVISORY
    version: str = '1.0.0'
    created_at: datetime = Field(default_factory=datetime.now)
    description: str
    tags: list[str] = Field(default_factory=list)

ARGS = {
    'provider': Provider.OPENAI,
    'use_case': UseCase.CROP_RECOMMENDATION,
    'domain': Domain.CROP_ADVISORY,
    'version': '1.0.0',
    'created_at': datetime.now(),
    'description': 'Prompt for providing crop recommendations based on soil and weather data',
    'tags': ['agriculture', 'crop', 'recommendation', 'advisory']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PromptMetadata — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PromptMetadata output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Domain Not yet run
unverified (harvested, no recorded run)
digitalgreenorg/farmerchat-prompts/farmerchat_prompts/manager.py
code served (permissive licence) · get_code("4950c645f6d14971")
How it ran

no invocation recorded.

Prompt Not yet run
unverified (harvested, no recorded run)
digitalgreenorg/farmerchat-prompts/farmerchat_prompts/manager.py
code served (permissive licence) · get_code("6801332cf30abc50")
How it ran

no invocation recorded.

Provider Not yet run
unverified (harvested, no recorded run)
digitalgreenorg/farmerchat-prompts/farmerchat_prompts/manager.py
code served (permissive licence) · get_code("890b7e1878557004")
How it ran

no invocation recorded.

UseCase Not yet run
unverified (harvested, no recorded run)
digitalgreenorg/farmerchat-prompts/farmerchat_prompts/manager.py
code served (permissive licence) · get_code("0abba9e44e9a8cb8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models show promise for agricultural advisory, yet vanilla models exhibit unsupported recommendations, generic advice lacking specific, actionable detail, and communication styles misaligned with smallholder farmer needs. In high-stakes agricultural contexts, where recommendation accuracy has direct consequences for farmer outcomes, these limitations pose challenges for responsible deployment. We present a hybrid LLM architecture that decouples factual retrieval from conversational delivery: supervised fine-tuning with LoRA on expert-curated GOLDEN FACTS (atomic, verified units of agricultural knowledge) optimizes fact recall, while a separate stitching layer transforms retrieved facts into culturally appropriate, safety-aware responses. Our evaluation framework, DG-EVAL, performs atomic fact verification (measuring recall, precision, and contradiction detection) against expert-curated ground truth rather than Wikipedia or retrieved documents. Experiments across multiple model configurations on crops and queries from Bihar, India show that fine-tuning on curated data substantially improves fact recall and F1, while maintaining high relevance. Using a fine-tuned smaller model achieves comparable or better factual quality at a fraction of the cost of frontier models. A stitching layer further improves safety subscores while maintaining high conversational quality. We release the farmerchat-prompts library to enable reproducible development of domain-specific agricultural AI.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2603.03294")
get_code_for_paper("2603.03294")
have("2603.03294")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2603.03294.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2603.03294.svg)](https://syntology.ai/paper/2603.03294)

Connect an agent — have() is free.