--- title: Structured Intelligence & Grounded Meaning Analyzer emoji: 👀 colorFrom: yellow colorTo: gray sdk: gradio app_file: app.py pinned: false --- # Structured Intelligence & Grounded Meaning Analyzer Try the interactive SIGMA reasoning tool via [Hugging Face Space Link](https://huggingface.co/spaces/morinousagi/nlp-intelligence-analyzer) | [UI snapshot](app_ui.png) This project was developed using prompt engineering techniques with **ChatGPT GPT-5.5**. ``` Manual code review - notes: roberta-large-mnli uses 0 for contradiction and 2 for entailment, while GLUE MNLI uses 0 for entailment and 2 for contradiction. Generated code (for evaluate_mnli.py) applied 0 for contradiction and 2 for entailment. >>> Upon intervention, AI regenerated the code to apply label re-mapping to handle the differences. ``` --- ## Model Stack ### Fact Extraction - `spaCy en_core_web_sm` - Explicit fact extraction, extracts structured factual triples: `Subject → Action → Object` ### Inference Validation - `roberta-large-mnli` (Multi-Genre Natural Language Inference) - Transformer model to evaluate candidate hypotheses against the original passage, classifying each hypothesis as: - ENTAILMENT - NEUTRAL - CONTRADICTION - Confidence scores are derived from the model's softmax probability distribution over the three inference classes. ### Summarization - `facebook/bart-large-cnn` - Generates concise analytic summaries ### Technical Notes - Uses conservative syntactic extraction to avoid speculative relation generation - Separates confirmed facts from analytical assessments - Built entirely with pretrained transformer models - Optimized for CPU deployment on Hugging Face Spaces --- ## Architecture ``` Input Text ↓ [NER + Relation Extraction] ↓ Explicit Fact List ↓ [NLI Model - Entailment Testing] ↓ Validated Implicit Inferences ↓ [Summarization Model] ↓ Intelligence Brief Output ``` ### Architecture of Inference Layer ``` Structured Facts ↓ Embedded Clause Extraction ↓ Standalone Hypothesis Generation ↓ MNLI Entailment Test ↓ Filter (confidence threshold) ↓ Implicit Inference Output ``` --- ## Validation Validated pretrained reasoning model against standardized benchmark with tracked metrics and reproducible experiment logging. Evaluated `roberta-large-mnli` on a `GLUE MNLI` validation split and track results with **MLflow**. Label re-mapping is required to handle: - Model roberta-large-mnli: 0 = contradiction | 1 = neutral | 2 = entailment - Dataset GLUE MNLI: 0 = entailment | 1 = neutral | 2 = contradiction ### Results ![mlflow](mlflow_eval_run.png) --- ## Project Structure ``` / ├── src/ # Core NLP logic │ ├── __init__.py │ ├── fact_extractor.py │ ├── inference_engine.py │ ├── summarizer.py │ ├── pipeline.py │ ├── app.py # UI / deployment entrypoint ├── requirements.txt └── README.md ```