[Paper Review] Tree-GPT: Modular Large Language Model Expert System for Forest Remote Sensing Image Understanding and Interactive Analysis
Tree-GPT is a modular large language model (LLM) expert system that integrates image understanding, domain-specific knowledge bases, and code generation to enable natural language-driven analysis of forest remote sensing images. By leveraging the Segment Anything Model (SAM) for tree segmentation and a local LLM agent for code execution, it achieves accurate, interactive, and efficient analysis of individual tree parameters and ecological patterns with minimal user intervention.
This paper introduces a novel framework, Tree-GPT, which incorporates Large Language Models (LLMs) into the forestry remote sensing data workflow, thereby enhancing the efficiency of data analysis. Currently, LLMs are unable to extract or comprehend information from images and may generate inaccurate text due to a lack of domain knowledge, limiting their use in forestry data analysis. To address this issue, we propose a modular LLM expert system, Tree-GPT, that integrates image understanding modules, domain knowledge bases, and toolchains. This empowers LLMs with the ability to comprehend images, acquire accurate knowledge, generate code, and perform data analysis in a local environment. Specifically, the image understanding module extracts structured information from forest remote sensing images by utilizing automatic or interactive generation of prompts to guide the Segment Anything Model (SAM) in generating and selecting optimal tree segmentation results. The system then calculates tree structural parameters based on these results and stores them in a database. Upon receiving a specific natural language instruction, the LLM generates code based on a thought chain to accomplish the analysis task. The code is then executed by an LLM agent in a local environment and . For ecological parameter calculations, the system retrieves the corresponding knowledge from the knowledge base and inputs it into the LLM to guide the generation of accurate code. We tested this system on several tasks, including Search, Visualization, and Machine Learning Analysis. The prototype system performed well, demonstrating the potential for dynamic usage of LLMs in forestry research and environmental sciences.
Motivation & Objective
- To address the limitations of general-purpose LLMs in understanding forest remote sensing images and generating accurate domain-specific knowledge.
- To reduce the time and expertise required for individual tree segmentation and ecological parameter analysis in forestry research.
- To develop a modular system that integrates image understanding, knowledge retrieval, and code generation for interactive, real-time data analysis.
- To enable researchers to perform complex data analysis tasks—such as visualization, machine learning, and statistical modeling—through natural language instructions.
Proposed method
- The system uses the Segment Anything Model (SAM) with automatically or interactively generated prompts to produce optimal tree segmentation results from high-resolution RGB and LiDAR data.
- Tree structural parameters (e.g., crown width, height) are extracted from segmentation outputs and stored in a structured database for retrieval.
- A domain-specific knowledge base is built using Chroma vector database and FAISS for similarity search, enabling retrieval of accurate ecological knowledge with a threshold similarity of 0.6.
- The LLM Execution Agent uses LangChain to decompose natural language instructions into subtasks, generate code, and execute it in a secure local environment to ensure accuracy and reproducibility.
- The system employs thought-chain prompting to guide code generation and validation, improving reliability in tasks such as statistical modeling and visualization.
- Knowledge retrieval is performed via semantic search on the Chroma database, with retrieved text blocks used as context to guide the LLM in generating accurate, domain-specific responses.

Experimental results
Research questions
- RQ1Can a modular LLM expert system effectively interpret forest remote sensing images and extract individual tree structural parameters using natural language instructions?
- RQ2How can LLMs be enhanced with image understanding and domain-specific knowledge to reduce hallucination and improve accuracy in ecological parameter estimation?
- RQ3To what extent can natural language-driven code generation replace traditional programming in forestry remote sensing analysis workflows?
- RQ4Can the integration of image segmentation, knowledge retrieval, and code execution enable interactive, real-time analysis of tree-level ecological data?
Key findings
- Tree-GPT achieved segmentation results that were comparable to or even surpassed manual annotations in certain cases, demonstrating high accuracy in individual tree crown detection using SAM with prompt optimization.
- The system successfully generated correct visualization outputs (e.g., scatter plots, box plots, tree growth diagrams) in a single attempt for simple tasks, with minor refinements needed for complex visualizations.
- For ecological parameter estimation, Tree-GPT accurately computed Gaussian distribution parameters of tree height and used RMSE as a confidence measure, showing reliable statistical analysis performance.
- The LLM Execution Agent successfully generated and executed machine learning code for tasks such as regression and classification, reducing the time required for analysis compared to manual coding.
- The system demonstrated robust performance in knowledge-based queries, retrieving and explaining ecological concepts with high relevance when similarity scores exceeded 0.6.
- In multi-task evaluation, Tree-GPT effectively handled search, visualization, and machine learning tasks using natural language, confirming its potential for dynamic, interactive use in environmental research.

Better researchstarts right now
From reading papers to final review, dramatically reduce your research time.
No credit card · Free plan available
This review was created by AI and reviewed by human editors.