AbstractIntegratedModule 0.8.6__tar.gz → 0.8.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractIntegratedModule.egg-info/PKG-INFO +5 -5
  2. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractIntegratedModule.py +45 -24
  3. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractOptimizedModules.c +200 -200
  4. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/PKG-INFO +5 -5
  5. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/README.md +4 -4
  6. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/setup.py +1 -1
  7. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractIntegratedModule.egg-info/SOURCES.txt +0 -0
  8. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractIntegratedModule.egg-info/dependency_links.txt +0 -0
  9. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractIntegratedModule.egg-info/requires.txt +0 -0
  10. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractIntegratedModule.egg-info/top_level.txt +0 -0
  11. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/AbstractOptimizedModules.pyx +0 -0
  12. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/MANIFEST.in +0 -0
  13. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/Cargo.toml +0 -0
  14. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/pyproject.toml +0 -0
  15. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/src/lib.rs +0 -0
  16. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/target/debug/build/libsqlite3-sys-ed07b882cd2aa5e2/out/bindgen.rs +0 -0
  17. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/target/debug/build/serde_core-ebc15f2e9cad7f5f/out/private.rs +0 -0
  18. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/target/debug/build/target-lexicon-08527f45de28143d/out/host.rs +0 -0
  19. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/target/release/build/libsqlite3-sys-bf0400df4523274c/out/bindgen.rs +0 -0
  20. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/target/release/build/serde_core-5cdb76131825e4af/out/private.rs +0 -0
  21. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/abstract_model_storage/target/release/build/target-lexicon-43eb95a0588bf457/out/host.rs +0 -0
  22. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/pyproject.toml +0 -0
  23. {abstractintegratedmodule-0.8.6 → abstractintegratedmodule-0.8.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: AbstractIntegratedModule
3
- Version: 0.8.6
3
+ Version: 0.8.7
4
4
  Summary: Library for Advanced Integrated Non-LLM AI Models - Optimized Backend Framework For Non-LLM AI Agent
5
5
  Author: Micro-Novelty
6
6
  Author-email: hernikpuspita5@gmail.com
@@ -42,7 +42,7 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
42
42
  #### Note: The README here you are reading is a direct copy from my README Repository, to download the necessary files, you can visit my Repository with the provided link above.
43
43
 
44
44
  ### Library Short Description:
45
- - Development Stage: 0.8.6 Official Release.
45
+ - Development Stage: 0.8.7 Official Release.
46
46
  - Maintainer: Micro-Novelty.
47
47
  - library Source-Code is Open-sourced on github.
48
48
  - Purpose: Specifically Designed for providing Non-LLM AI Agent Framework for edge Devices, Optimized for ARM64 architecture.
@@ -80,10 +80,10 @@ https://github.com/Micro-Novelty/IntegratedPipeline-Specialized-Non-LLM-AI-Agent
80
80
  - Transformer Optimized using Cython, to reduce Memory overhead and Reduce CPU Usage, With Reduced Training Time.
81
81
  ______________
82
82
  - Changelog:
83
- - v0.8.6:
83
+ - v0.8.7:
84
84
  - [=] New features:
85
- - Added new Optimization module using Cython maths for dynamic weighted ensemble function.
86
- - Added Penalty for wrong prediction in both single advanced prediction and advanced batch prediction to reduce repetitive errors.
85
+ - Added new continuos predictive correction for MLP class to reduce inflated confidence despite outputting wrong answer.
86
+ - Reduced the frequency of penalty based calibration in advanced prediction method to prevent the models from being too conservative.
87
87
  - Fixed P2P Vulnerabilities:
88
88
  - Empty allowed_ips in PRODUCTION/HARDENED mode now DENIES external IPs instead of allowing all
89
89
  - Startup validation warns about dangerous config combinations
@@ -1716,7 +1716,11 @@ class MLP:
1716
1716
  self.layers2 = []
1717
1717
  self.lr = 0.1
1718
1718
  self.feed_layers = []
1719
-
1719
+
1720
+ self.error_counts = None
1721
+ self.pred_counts = None
1722
+ self.error_decay = None
1723
+
1720
1724
  self.softmax = SoftmaxOutput()
1721
1725
 
1722
1726
 
@@ -1735,7 +1739,7 @@ class MLP:
1735
1739
  def forward(self, x):
1736
1740
  for layer in self.layers:
1737
1741
  x = layer.forward(x)
1738
-
1742
+
1739
1743
  return self.softmax.forward(x)
1740
1744
 
1741
1745
 
@@ -1757,7 +1761,40 @@ class MLP:
1757
1761
 
1758
1762
  return calibration
1759
1763
 
1764
+ def continuos_predictive_correction(self, manager, prob, predicted_index):
1765
+ eps = 1e-5
1766
+
1767
+ error_counts = manager.error_counts
1768
+ pred_counts = manager.pred_counts
1769
+ decay = manager.decay
1770
+ label_map = manager.label_map
1771
+
1772
+ self.error_counts = error_counts
1773
+ self.pred_counts = pred_counts
1774
+ self.error_decay = decay
1775
+
1776
+ try:
1777
+ self.pred_counts[predicted_index] += 1.0
1778
+ n_classes = len(label_map)
1779
+
1780
+ for c in range(n_classes):
1781
+ if self.pred_counts[c] > 0:
1782
+ error_rate = self.error_counts[c] / (self.pred_counts[c] + 1e-8)
1783
+ # sigmoid-shaped dampening — never goes negative
1784
+ # error_rate=0.0 → multiplier=1.0 (no change)
1785
+ # error_rate=0.5 → multiplier≈0.67
1786
+ # error_rate=1.0 → multiplier≈0.5
1787
+ reputation = 1.0 / (1.0 + error_rate)
1788
+ prob[c] *= reputation
1789
+
1790
+ prob_sum = prob.sum()
1791
+ if prob_sum > 1e-8:
1792
+ prob /= prob_sum
1760
1793
 
1794
+ except Exception as e:
1795
+ print(f'[!] Cant check and calibrate probs based on penalty due to: {e}')
1796
+
1797
+ return prob
1761
1798
 
1762
1799
 
1763
1800
  def focused_backward(self, grad, lr, AME, anisotropy):
@@ -2893,7 +2930,7 @@ class WeightedEnsemblePredictor:
2893
2930
  AME = self.pipeline.model2.AME_Encoder(input_ids)
2894
2931
 
2895
2932
  trans_probs, attn_weights = self.pipeline.model2.forward(input_ids, AME=AME, embedded=embedded)
2896
- mlp_probs = self.pipeline.mlp.forward(X_mlp)
2933
+ mlp_probs = self.pipeline.model3.forward(X_mlp)
2897
2934
  lstm_probs, lstm_weight_hint = self._get_lstm_probs(input_ids, X_mlp, label_bins=label_bins)
2898
2935
 
2899
2936
  established_agreement = self.query_node._establish_node_connection("PredictEnsemble")
@@ -13970,8 +14007,6 @@ class PipelinePredictionManager:
13970
14007
  4. User home directory
13971
14008
  5. Common data folders (Downloads, Documents, Desktop)
13972
14009
  """
13973
- import os
13974
- import sys
13975
14010
 
13976
14011
  # build candidate paths
13977
14012
  candidates = []
@@ -14701,9 +14736,10 @@ class PipelinePredictionManager:
14701
14736
  print(f'[!] Similarity: {cached['similarity']} is low, Cannot pick label due to low certainty, Initiating advanced prediction...')
14702
14737
  else:
14703
14738
  print('[=] No verified output from cache available that matched samples, starting advanced prediction...')
14704
-
14705
- target_probs = self.pipeline.predict_proba(input_ids, X, type='Hybrid', embedded=True)
14706
- target_probs = target_probs[:mlp_probs.shape[0], :mlp_probs.shape[1]]
14739
+ target_probs = self.pipeline.predict_proba(input_ids, X, type='Hybrid', embedded=True)
14740
+ target_probs = target_probs[:mlp_probs.shape[0], :mlp_probs.shape[1]]
14741
+ target_probs = self.pipeline.model3.continuos_predictive_correction(self, target_probs, mlp_pred_indices)
14742
+
14707
14743
  target_pred_indices = np.argmax(target_probs, axis=1)
14708
14744
 
14709
14745
  if self.pipeline.cache and 'label_bins' in self.pipeline.cache:
@@ -14716,13 +14752,6 @@ class PipelinePredictionManager:
14716
14752
  results = []
14717
14753
  attention_data = [] if return_attention else None
14718
14754
 
14719
- target_probs = self.pipeline.predict_proba(input_ids, X, type='Hybrid', embedded=True)
14720
- target_probs = target_probs[:mlp_probs.shape[0], :mlp_probs.shape[1]]
14721
- target_pred_indices = np.argmax(target_probs, axis=1)
14722
-
14723
- results = []
14724
- attention_data = [] if return_attention else None
14725
-
14726
14755
  for i, title in enumerate(titles):
14727
14756
  # Parse input
14728
14757
  if isinstance(title, tuple):
@@ -14911,7 +14940,6 @@ class PipelinePredictionManager:
14911
14940
  print('|| Uncertain advanced prediction, requesting peer assistance if allowed...')
14912
14941
  final_probs = self.pipeline._handle_distributed_connections(final_probs, attn_weights, input_ids, agreement)
14913
14942
 
14914
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
14915
14943
  final_idx = final_probs[0].argmax()
14916
14944
  original_idx = final_idx
14917
14945
 
@@ -14934,7 +14962,6 @@ class PipelinePredictionManager:
14934
14962
  print('[||] Iniating local peer output search in database for best output...')
14935
14963
  final_probs = self.pipeline.distribution._handle_peer_agent_request(final_probs, attn_weights, input_ids, type='DevicePeer', agreement=agreement)
14936
14964
 
14937
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
14938
14965
  final_idx = final_probs[0].argmax()
14939
14966
  original_idx = final_idx
14940
14967
 
@@ -14955,7 +14982,6 @@ class PipelinePredictionManager:
14955
14982
  print("\n[⚠️] Low confidence detected, but both models don't agree. Using calibrated probabilities for final decision to ensure robustness.")
14956
14983
  final_probs = self.pipeline.hybrid_prediction(rules, input_ids, dataset)
14957
14984
 
14958
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
14959
14985
  final_idx = final_probs[0].argmax()
14960
14986
  original_idx = final_idx
14961
14987
 
@@ -14967,7 +14993,6 @@ class PipelinePredictionManager:
14967
14993
  print('[🎯] Stable confidence established, But both Models doesnt Agree, Re-evaluating...')
14968
14994
  final_probs = self.pipeline.hybrid_prediction(rules, input_ids, dataset)
14969
14995
 
14970
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
14971
14996
  final_idx = final_probs[0].argmax()
14972
14997
  original_idx = final_idx
14973
14998
  if final_idx > len(reverse_map):
@@ -14986,7 +15011,6 @@ class PipelinePredictionManager:
14986
15011
  input_forward = sequence_ids if sequence_ids is not None else input_ids
14987
15012
  final_probs, details = self.pipeline.ensemble.predict_ensemble(input_forward, X, y, method='dynamic', embedded=True)
14988
15013
 
14989
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
14990
15014
  final_idx = final_probs[0].argmax()
14991
15015
  original_idx = final_idx
14992
15016
 
@@ -15002,7 +15026,6 @@ class PipelinePredictionManager:
15002
15026
  confidence = float(final_probs[0][len(reverse_map)-1]) if isinstance(final_probs[0], (float, int)) else 0.0
15003
15027
  else:
15004
15028
  input_forward = sequence_ids if sequence_ids is not None else input_ids
15005
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
15006
15029
  final_idx = final_probs[0].argmax() if final_probs is not None else target_probs[0].argmax()
15007
15030
 
15008
15031
  original_idx = final_idx
@@ -15028,7 +15051,6 @@ class PipelinePredictionManager:
15028
15051
  confidence = self.pipeline.confidence_threshold
15029
15052
 
15030
15053
  elif confidence < self.pipeline.confidence_threshold and not self.pipeline.agreement and not results[0].get('models_agree', True):
15031
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
15032
15054
  if trans_probs is not None:
15033
15055
  prob_entropy = self.calculate_entropy(final_probs)
15034
15056
  normalized_entropy = prob_entropy / np.log(prob_entropy.shape[-1]) if prob_entropy.shape[-1] > 1 else 0
@@ -15075,7 +15097,6 @@ class PipelinePredictionManager:
15075
15097
  final_probs = target_probs.copy()
15076
15098
  else:
15077
15099
  print("\n[🎯] Using initial Regular final prediction as final decision.")
15078
- final_probs = self.calibration_penalized_check(final_probs, final_class_idx)
15079
15100
  final_idx = final_probs[0].argmax()
15080
15101
 
15081
15102
  if final_idx > len(reverse_map):
@@ -15101,7 +15122,6 @@ class PipelinePredictionManager:
15101
15122
 
15102
15123
  try:
15103
15124
  consecutive_probs = self.pipeline.distribution._handle_peer_agent_request(target_probs, attn_weights, input_ids, type='DevicePeer', agreement=agreement)
15104
- consecutive_probs = self.calibration_penalized_check(consecutive_probs, final_class_idx)
15105
15125
  sec_final_idx = consecutive_probs[0].argmax()
15106
15126
 
15107
15127
  if sec_final_idx > len(reverse_map):
@@ -15252,6 +15272,7 @@ class PipelinePredictionManager:
15252
15272
  correct += 1
15253
15273
  else:
15254
15274
  self.error_counts[predicted_index] += 1.0
15275
+
15255
15276
 
15256
15277
  # Agreement indicator
15257
15278
  agree_symbol = "✓" if result.get('models_agree', True) else "⚠️"