morinousagi's picture
add code review notes
f25c85e verified
|
Raw
History Blame Contribute Delete
3.1 kB

A newer version of the Gradio SDK is available: 6.22.0

Upgrade
metadata
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 | UI snapshot

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


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