asft 0.1.0__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 (135) hide show
  1. asft-0.1.0/.github/workflows/ci.yml +55 -0
  2. asft-0.1.0/.gitignore +75 -0
  3. asft-0.1.0/Dockerfile +50 -0
  4. asft-0.1.0/LICENSE +201 -0
  5. asft-0.1.0/PKG-INFO +138 -0
  6. asft-0.1.0/README.md +61 -0
  7. asft-0.1.0/alembic/README +1 -0
  8. asft-0.1.0/alembic/env.py +86 -0
  9. asft-0.1.0/alembic/script.py.mako +28 -0
  10. asft-0.1.0/alembic/versions/18536087d77b_add_benchmarkresult_model.py +41 -0
  11. asft-0.1.0/alembic/versions/4d6d7a6dca98_initial_migration.py +73 -0
  12. asft-0.1.0/alembic/versions/7d137dec7e12_add_actual_runtime_and_reward_score_to_.py +34 -0
  13. asft-0.1.0/alembic/versions/c1a5a2758ab8_add_routinghistory_model.py +48 -0
  14. asft-0.1.0/alembic/versions/d82db60389dc_add_strategyoutcome_model.py +47 -0
  15. asft-0.1.0/alembic.ini +149 -0
  16. asft-0.1.0/asft/__init__.py +30 -0
  17. asft-0.1.0/asft/accuracy/__init__.py +16 -0
  18. asft-0.1.0/asft/accuracy/confidence_scorer.py +167 -0
  19. asft-0.1.0/asft/accuracy/multi_pass_reasoner.py +185 -0
  20. asft-0.1.0/asft/accuracy/self_critique.py +187 -0
  21. asft-0.1.0/asft/accuracy/verification_layer.py +277 -0
  22. asft-0.1.0/asft/accuracy/verifier.py +333 -0
  23. asft-0.1.0/asft/api/__init__.py +1 -0
  24. asft-0.1.0/asft/api/middleware.py +157 -0
  25. asft-0.1.0/asft/api/schemas.py +340 -0
  26. asft-0.1.0/asft/api/server.py +414 -0
  27. asft-0.1.0/asft/api/websockets.py +82 -0
  28. asft-0.1.0/asft/benchmark/__init__.py +1 -0
  29. asft-0.1.0/asft/benchmark/reporter.py +148 -0
  30. asft-0.1.0/asft/benchmark/runner.py +196 -0
  31. asft-0.1.0/asft/cli/__init__.py +1 -0
  32. asft-0.1.0/asft/cli/main.py +462 -0
  33. asft-0.1.0/asft/compute/__init__.py +1 -0
  34. asft-0.1.0/asft/compute/adaptive_compute.py +241 -0
  35. asft-0.1.0/asft/continual/__init__.py +1 -0
  36. asft-0.1.0/asft/continual/ewc_trainer.py +261 -0
  37. asft-0.1.0/asft/core/__init__.py +7 -0
  38. asft-0.1.0/asft/core/config.py +199 -0
  39. asft-0.1.0/asft/core/events.py +100 -0
  40. asft-0.1.0/asft/core/exceptions.py +234 -0
  41. asft-0.1.0/asft/core/hardware_profiler.py +344 -0
  42. asft-0.1.0/asft/core/interfaces.py +346 -0
  43. asft-0.1.0/asft/core/registry.py +162 -0
  44. asft-0.1.0/asft/core/settings.py +250 -0
  45. asft-0.1.0/asft/dataset/__init__.py +8 -0
  46. asft-0.1.0/asft/dataset/clusterer.py +100 -0
  47. asft-0.1.0/asft/dataset/compressor.py +147 -0
  48. asft-0.1.0/asft/dataset/deduplicator.py +96 -0
  49. asft-0.1.0/asft/dataset/quality_scorer.py +131 -0
  50. asft-0.1.0/asft/dataset/representative_selector.py +110 -0
  51. asft-0.1.0/asft/dataset/streaming_compressor.py +258 -0
  52. asft-0.1.0/asft/db/database.py +25 -0
  53. asft-0.1.0/asft/db/maintenance.py +138 -0
  54. asft-0.1.0/asft/db/models.py +109 -0
  55. asft-0.1.0/asft/distillation/__init__.py +1 -0
  56. asft-0.1.0/asft/distillation/knowledge_distiller.py +424 -0
  57. asft-0.1.0/asft/evaluation/benchmark_manager.py +117 -0
  58. asft-0.1.0/asft/evaluation/harness.py +51 -0
  59. asft-0.1.0/asft/hardware/__init__.py +1 -0
  60. asft-0.1.0/asft/hardware/optimizer.py +187 -0
  61. asft-0.1.0/asft/improvement/__init__.py +1 -0
  62. asft-0.1.0/asft/layers/__init__.py +1 -0
  63. asft-0.1.0/asft/memory/__init__.py +9 -0
  64. asft-0.1.0/asft/memory/backends/faiss_adapter.py +122 -0
  65. asft-0.1.0/asft/memory/backends/qdrant.py +111 -0
  66. asft-0.1.0/asft/memory/backends/secure_qdrant.py +139 -0
  67. asft-0.1.0/asft/memory/consolidator.py +55 -0
  68. asft-0.1.0/asft/memory/episodic_memory.py +337 -0
  69. asft-0.1.0/asft/memory/long_term_memory.py +159 -0
  70. asft-0.1.0/asft/memory/memory_manager.py +226 -0
  71. asft-0.1.0/asft/memory/semantic_memory.py +187 -0
  72. asft-0.1.0/asft/memory/vector_memory.py +245 -0
  73. asft-0.1.0/asft/memory/working_memory.py +95 -0
  74. asft-0.1.0/asft/observability/logging.py +105 -0
  75. asft-0.1.0/asft/observability/metrics.py +84 -0
  76. asft-0.1.0/asft/optimizer/__init__.py +1 -0
  77. asft-0.1.0/asft/optimizer/auto_optimizer.py +448 -0
  78. asft-0.1.0/asft/optimizer/cost_estimator.py +397 -0
  79. asft-0.1.0/asft/optimizer/decision_engine.py +242 -0
  80. asft-0.1.0/asft/plugins/loader.py +68 -0
  81. asft-0.1.0/asft/security/auth.py +186 -0
  82. asft-0.1.0/asft/security/input_validator.py +187 -0
  83. asft-0.1.0/asft/security/rbac.py +78 -0
  84. asft-0.1.0/asft/security/sandbox.py +134 -0
  85. asft-0.1.0/asft/selection/__init__.py +1 -0
  86. asft-0.1.0/asft/selection/parameter_selector.py +340 -0
  87. asft-0.1.0/asft/selection/sample_selector.py +336 -0
  88. asft-0.1.0/asft/skills/__init__.py +7 -0
  89. asft-0.1.0/asft/skills/packs/__init__.py +1 -0
  90. asft-0.1.0/asft/skills/packs/automation.py +84 -0
  91. asft-0.1.0/asft/skills/packs/coding.py +75 -0
  92. asft-0.1.0/asft/skills/packs/mathematics.py +94 -0
  93. asft-0.1.0/asft/skills/packs/planning.py +71 -0
  94. asft-0.1.0/asft/skills/packs/research.py +61 -0
  95. asft-0.1.0/asft/skills/packs/trading.py +78 -0
  96. asft-0.1.0/asft/skills/skill_pack.py +95 -0
  97. asft-0.1.0/asft/skills/skill_router.py +305 -0
  98. asft-0.1.0/asft/sparse/__init__.py +6 -0
  99. asft-0.1.0/asft/sparse/activation_analyzer.py +191 -0
  100. asft-0.1.0/asft/sparse/dynamic_sparse.py +305 -0
  101. asft-0.1.0/asft/sparse/lora_adapter.py +145 -0
  102. asft-0.1.0/asft/sparse/neuron_selector.py +222 -0
  103. asft-0.1.0/asft/sparse/sparse_trainer.py +160 -0
  104. asft-0.1.0/asft/training/checkpoint_manager.py +124 -0
  105. asft-0.1.0/asft/training/job_store.py +297 -0
  106. asft-0.1.0/asft/training/peft_trainer.py +296 -0
  107. asft-0.1.0/asft/workers/__init__.py +1 -0
  108. asft-0.1.0/asft/workers/celery_app.py +30 -0
  109. asft-0.1.0/asft/workers/process_pool.py +123 -0
  110. asft-0.1.0/asft/workers/tasks.py +224 -0
  111. asft-0.1.0/asft_config.yaml +108 -0
  112. asft-0.1.0/check_github.py +34 -0
  113. asft-0.1.0/check_jobs.py +31 -0
  114. asft-0.1.0/check_jobs_2.py +23 -0
  115. asft-0.1.0/check_jobs_3.py +14 -0
  116. asft-0.1.0/check_jobs_4.py +14 -0
  117. asft-0.1.0/check_jobs_5.py +22 -0
  118. asft-0.1.0/docker-compose.yml +72 -0
  119. asft-0.1.0/examples/01_hardware_and_routing.py +80 -0
  120. asft-0.1.0/examples/02_memory_systems.py +83 -0
  121. asft-0.1.0/examples/03_accuracy_and_dataset.py +108 -0
  122. asft-0.1.0/k8s/deployment.yaml +85 -0
  123. asft-0.1.0/k8s/hpa.yaml +39 -0
  124. asft-0.1.0/k8s/keda_autoscaling.yaml +109 -0
  125. asft-0.1.0/mypy_out.txt +0 -0
  126. asft-0.1.0/pyproject.toml +121 -0
  127. asft-0.1.0/pytest.ini +17 -0
  128. asft-0.1.0/rapid_results.json +54 -0
  129. asft-0.1.0/tests/__init__.py +1 -0
  130. asft-0.1.0/tests/conftest.py +54 -0
  131. asft-0.1.0/tests/qa_benchmarks/rapid_validator.py +255 -0
  132. asft-0.1.0/tests/test_asft.py +565 -0
  133. asft-0.1.0/tests/test_security.py +305 -0
  134. asft-0.1.0/tests/test_training_optimizer.py +318 -0
  135. asft-0.1.0/tests/test_v3_1_enterprise.py +62 -0
@@ -0,0 +1,55 @@
1
+ name: ASFT CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.10'
18
+ - name: Install linting dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ pip install ruff black mypy
22
+ - name: Run Ruff
23
+ run: ruff check asft/
24
+ - name: Run Black
25
+ run: black --check asft/
26
+
27
+ test:
28
+ runs-on: ubuntu-latest
29
+ strategy:
30
+ matrix:
31
+ python-version: ['3.10', '3.11']
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - name: Set up Python ${{ matrix.python-version }}
35
+ uses: actions/setup-python@v5
36
+ with:
37
+ python-version: ${{ matrix.python-version }}
38
+ - name: Install dependencies
39
+ run: |
40
+ python -m pip install --upgrade pip
41
+ pip install -e .[dev]
42
+ - name: Test with pytest
43
+ run: |
44
+ pytest tests/ -v -m "not gpu" > pytest_log.txt 2>&1 || true
45
+ cat pytest_log.txt >> $GITHUB_STEP_SUMMARY
46
+ pytest tests/ -v -m "not gpu"
47
+
48
+ build-docker:
49
+ runs-on: ubuntu-latest
50
+ needs: [lint, test]
51
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
52
+ steps:
53
+ - uses: actions/checkout@v4
54
+ - name: Build Docker image
55
+ run: docker build -t asft:latest .
asft-0.1.0/.gitignore ADDED
@@ -0,0 +1,75 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ .eggs/
11
+ .Python
12
+ env/
13
+ venv/
14
+ .venv/
15
+ pip-wheel-metadata/
16
+ share/python-wheels/
17
+ *.whl
18
+
19
+ # ML / Model artifacts
20
+ *.safetensors
21
+ *.bin
22
+ *.gguf
23
+ *.pt
24
+ *.pth
25
+ checkpoints/
26
+ runs/
27
+ outputs/
28
+ wandb/
29
+ mlruns/
30
+ .cache/
31
+ models/
32
+ *.ckpt
33
+
34
+ # ASFT data
35
+ asft_data/
36
+ skill_packs/
37
+ memory_store/
38
+ benchmark_results/
39
+ *.db
40
+ *.sqlite
41
+ *.sqlite3
42
+
43
+ # ChromaDB
44
+ chroma_db/
45
+ chromadb/
46
+
47
+ # Jupyter
48
+ .ipynb_checkpoints/
49
+ *.ipynb
50
+
51
+ # Env
52
+ .env
53
+ .env.*
54
+ !.env.example
55
+
56
+ # IDE
57
+ .vscode/
58
+ .idea/
59
+ *.swp
60
+ *.swo
61
+ .DS_Store
62
+ Thumbs.db
63
+
64
+ # Logs
65
+ logs/
66
+ *.log
67
+
68
+ # Testing
69
+ .pytest_cache/
70
+ .coverage
71
+ htmlcov/
72
+ .tox/
73
+
74
+ # Dist
75
+ dist/
asft-0.1.0/Dockerfile ADDED
@@ -0,0 +1,50 @@
1
+ # Stage 1: Builder
2
+ FROM python:3.10-slim as builder
3
+
4
+ WORKDIR /app
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ build-essential \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ COPY pyproject.toml .
10
+ COPY README.md .
11
+ COPY asft/ ./asft/
12
+ # Install dependencies into a virtual environment
13
+ RUN python -m venv /opt/venv
14
+ ENV PATH="/opt/venv/bin:$PATH"
15
+ RUN pip install --no-cache-dir --upgrade pip && \
16
+ pip install --no-cache-dir .
17
+
18
+ # Stage 2: Production
19
+ FROM python:3.10-slim
20
+
21
+ WORKDIR /app
22
+
23
+ # Install system dependencies required for FAISS and PyTorch
24
+ RUN apt-get update && apt-get install -y --no-install-recommends \
25
+ libomp-dev \
26
+ git \
27
+ && rm -rf /var/lib/apt/lists/*
28
+
29
+ # Copy virtual environment from builder
30
+ COPY --from=builder /opt/venv /opt/venv
31
+ ENV PATH="/opt/venv/bin:$PATH"
32
+
33
+ # Copy application source code
34
+ COPY asft/ ./asft/
35
+ COPY alembic/ ./alembic/
36
+ COPY alembic.ini .
37
+ COPY README.md .
38
+
39
+ # Create non-root user
40
+ RUN useradd -m asftuser && \
41
+ mkdir -p /app/asft_data && \
42
+ chown -R asftuser:asftuser /app
43
+
44
+ USER asftuser
45
+
46
+ # Expose API port
47
+ EXPOSE 8000
48
+
49
+ # Start command
50
+ CMD ["uvicorn", "asft.api.server:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
asft-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Soumyashiv
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-0.
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
asft-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: asft
3
+ Version: 0.1.0
4
+ Summary: ASFT — Training Acceleration Framework: Achieve the same or better model capability with dramatically fewer resources.
5
+ Author: Soumyashiv
6
+ License: Apache-2.0
7
+ License-File: LICENSE
8
+ Keywords: continual-learning,fine-tuning,knowledge-distillation,lora,machine-learning,qlora,training-acceleration
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Requires-Python: >=3.10
17
+ Requires-Dist: accelerate>=0.28.0
18
+ Requires-Dist: aiofiles>=23.2.0
19
+ Requires-Dist: alembic>=1.13.0
20
+ Requires-Dist: bitsandbytes>=0.43.0
21
+ Requires-Dist: chromadb>=0.5.0
22
+ Requires-Dist: datasets>=2.18.0
23
+ Requires-Dist: datasketch>=1.6.0
24
+ Requires-Dist: fastapi>=0.111.0
25
+ Requires-Dist: filelock>=3.13.0
26
+ Requires-Dist: httpx>=0.27.0
27
+ Requires-Dist: huggingface-hub>=0.22.0
28
+ Requires-Dist: jinja2>=3.1.0
29
+ Requires-Dist: numpy>=1.26.0
30
+ Requires-Dist: pandas>=2.2.0
31
+ Requires-Dist: peft>=0.10.0
32
+ Requires-Dist: psutil>=5.9.0
33
+ Requires-Dist: pydantic-settings>=2.2.0
34
+ Requires-Dist: pydantic>=2.7.0
35
+ Requires-Dist: python-multipart>=0.0.9
36
+ Requires-Dist: rich>=13.7.0
37
+ Requires-Dist: safetensors>=0.4.0
38
+ Requires-Dist: scikit-learn>=1.4.0
39
+ Requires-Dist: scipy>=1.12.0
40
+ Requires-Dist: sentence-transformers>=2.7.0
41
+ Requires-Dist: sqlalchemy>=2.0.0
42
+ Requires-Dist: sympy>=1.12.0
43
+ Requires-Dist: torch>=2.1.0
44
+ Requires-Dist: tqdm>=4.66.0
45
+ Requires-Dist: transformers>=4.40.0
46
+ Requires-Dist: trl>=0.8.0
47
+ Requires-Dist: typer>=0.12.0
48
+ Requires-Dist: uvicorn[standard]>=0.29.0
49
+ Provides-Extra: all
50
+ Requires-Dist: faiss-cpu>=1.8.0; extra == 'all'
51
+ Requires-Dist: matplotlib>=3.8.0; extra == 'all'
52
+ Requires-Dist: plotly>=5.20.0; extra == 'all'
53
+ Requires-Dist: qdrant-client>=1.9.0; extra == 'all'
54
+ Provides-Extra: celery
55
+ Requires-Dist: celery>=5.3.0; extra == 'celery'
56
+ Requires-Dist: redis>=5.0.0; extra == 'celery'
57
+ Provides-Extra: dev
58
+ Requires-Dist: black>=24.0.0; extra == 'dev'
59
+ Requires-Dist: faiss-cpu>=1.8.0; extra == 'dev'
60
+ Requires-Dist: ipykernel>=6.29.0; extra == 'dev'
61
+ Requires-Dist: mypy>=1.10.0; extra == 'dev'
62
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
63
+ Requires-Dist: pytest-benchmark>=4.0.0; extra == 'dev'
64
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
65
+ Requires-Dist: qdrant-client>=1.9.0; extra == 'dev'
66
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
67
+ Provides-Extra: faiss
68
+ Requires-Dist: faiss-cpu>=1.8.0; extra == 'faiss'
69
+ Provides-Extra: faiss-gpu
70
+ Requires-Dist: faiss-gpu>=1.8.0; extra == 'faiss-gpu'
71
+ Provides-Extra: qdrant
72
+ Requires-Dist: qdrant-client>=1.9.0; extra == 'qdrant'
73
+ Provides-Extra: viz
74
+ Requires-Dist: matplotlib>=3.8.0; extra == 'viz'
75
+ Requires-Dist: plotly>=5.20.0; extra == 'viz'
76
+ Description-Content-Type: text/markdown
77
+
78
+ # ASFT: Adaptive Synaptic Fine-Tuning
79
+
80
+ **ASFT** is a production-grade, enterprise-ready AI Training Acceleration Framework designed to dramatically reduce the resources required to train and deploy LLMs.
81
+
82
+ ## 🚀 The Pitch
83
+
84
+ Most fine-tuning frameworks focus on making matrix math faster, assuming you *must* train. ASFT flips the paradigm: it acts as an **intelligent decision engine** that treats fine-tuning as a last resort.
85
+
86
+ By systematically evaluating zero-shot reasoning, vector retrieval (RAG), and programmatic skills *before* allocating any GPU compute, ASFT radically reduces training costs, dataset requirements, and energy consumption—all while maintaining or improving model capability.
87
+
88
+ ## ⚡ How We're Different
89
+
90
+ | Feature | Standard Frameworks (trl, Unsloth) | ASFT |
91
+ | :--- | :--- | :--- |
92
+ | **Philosophy** | "Train the model faster." | "Train only if absolutely necessary." |
93
+ | **Decision Engine**| None (blindly executes training). | Evaluates Working Memory, RAG, and Skills first. |
94
+ | **Data Pruning** | Manual curation required. | Auto-prunes redundant/easy samples using EL2N & Perplexity. |
95
+ | **Architecture** | Focuses on single-node GPU utilization. | Zero-trust verification, async queues, FTS5 memory. |
96
+ | **Cost Estimation**| Trial and error. | Pre-computes exact GPU-hours & USD cost via scaling laws. |
97
+
98
+ ## 📊 Benchmarks
99
+
100
+ ASFT is built for speed and efficiency across all subsystems:
101
+
102
+ * **Dataset Compression:** Compress a 5,000-sample dataset to just 35 semantically unique samples (0.7% of original size) in ~10 seconds.
103
+ * **Memory Operations:** < 0.04s latency for semantic retrieval among 10,000 embedded items.
104
+ * **Concurrency:** Robust multi-process task offloading handling continuous throughput safely under strict stress testing.
105
+
106
+ ## 💻 Installation
107
+
108
+ ```bash
109
+ # Python 3.10+ required
110
+ pip install -e .
111
+
112
+ # Optional extras
113
+ pip install -e ".[faiss]" # For CPU vector search
114
+ pip install -e ".[faiss-gpu]" # For GPU vector search
115
+ pip install -e ".[viz]" # For analytical plotting (Plotly/Matplotlib)
116
+ ```
117
+
118
+ ## 🛠️ Quickstart
119
+
120
+ ```python
121
+ from asft.optimizer.auto_optimizer import AutoOptimizer
122
+ decision = AutoOptimizer().decide(task="Medical triage", domain="medical", target_accuracy=0.92, budget_usd=50.0)
123
+ print(f"Action: {decision.action} | Reasoning: {decision.reasoning}")
124
+ ```
125
+
126
+ ## 🛡️ Architecture & Security
127
+
128
+ ASFT is designed for robust enterprise deployment:
129
+ * **Zero-Execution Verification:** The framework's verification layers never execute LLM-generated code. Validation uses strictly AST-based parsing (`RestrictedPython`) and the SymPy Computer Algebra System.
130
+ * **Bounded Persistent Memory:** Fast, O(1) semantic lookups via SQLite FTS5 inverted indices.
131
+ * **Memory-Safe Work Queues:** API server delegates intensive GPU compute to sandboxed isolated processes via `ProcessPoolExecutor`.
132
+
133
+ ## Status
134
+
135
+ **Current Version:** `0.1.0` (Production Ready)
136
+ **Security Posture:** Hardened
137
+
138
+ > ⚠️ **Note:** The legacy gradient-masking `SparseTrainer` has been officially deprecated. It has been replaced by the `DynamicSparseTrainer` (RigL) and `ParameterSelector`.
asft-0.1.0/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # ASFT: Adaptive Synaptic Fine-Tuning
2
+
3
+ **ASFT** is a production-grade, enterprise-ready AI Training Acceleration Framework designed to dramatically reduce the resources required to train and deploy LLMs.
4
+
5
+ ## 🚀 The Pitch
6
+
7
+ Most fine-tuning frameworks focus on making matrix math faster, assuming you *must* train. ASFT flips the paradigm: it acts as an **intelligent decision engine** that treats fine-tuning as a last resort.
8
+
9
+ By systematically evaluating zero-shot reasoning, vector retrieval (RAG), and programmatic skills *before* allocating any GPU compute, ASFT radically reduces training costs, dataset requirements, and energy consumption—all while maintaining or improving model capability.
10
+
11
+ ## ⚡ How We're Different
12
+
13
+ | Feature | Standard Frameworks (trl, Unsloth) | ASFT |
14
+ | :--- | :--- | :--- |
15
+ | **Philosophy** | "Train the model faster." | "Train only if absolutely necessary." |
16
+ | **Decision Engine**| None (blindly executes training). | Evaluates Working Memory, RAG, and Skills first. |
17
+ | **Data Pruning** | Manual curation required. | Auto-prunes redundant/easy samples using EL2N & Perplexity. |
18
+ | **Architecture** | Focuses on single-node GPU utilization. | Zero-trust verification, async queues, FTS5 memory. |
19
+ | **Cost Estimation**| Trial and error. | Pre-computes exact GPU-hours & USD cost via scaling laws. |
20
+
21
+ ## 📊 Benchmarks
22
+
23
+ ASFT is built for speed and efficiency across all subsystems:
24
+
25
+ * **Dataset Compression:** Compress a 5,000-sample dataset to just 35 semantically unique samples (0.7% of original size) in ~10 seconds.
26
+ * **Memory Operations:** < 0.04s latency for semantic retrieval among 10,000 embedded items.
27
+ * **Concurrency:** Robust multi-process task offloading handling continuous throughput safely under strict stress testing.
28
+
29
+ ## 💻 Installation
30
+
31
+ ```bash
32
+ # Python 3.10+ required
33
+ pip install -e .
34
+
35
+ # Optional extras
36
+ pip install -e ".[faiss]" # For CPU vector search
37
+ pip install -e ".[faiss-gpu]" # For GPU vector search
38
+ pip install -e ".[viz]" # For analytical plotting (Plotly/Matplotlib)
39
+ ```
40
+
41
+ ## 🛠️ Quickstart
42
+
43
+ ```python
44
+ from asft.optimizer.auto_optimizer import AutoOptimizer
45
+ decision = AutoOptimizer().decide(task="Medical triage", domain="medical", target_accuracy=0.92, budget_usd=50.0)
46
+ print(f"Action: {decision.action} | Reasoning: {decision.reasoning}")
47
+ ```
48
+
49
+ ## 🛡️ Architecture & Security
50
+
51
+ ASFT is designed for robust enterprise deployment:
52
+ * **Zero-Execution Verification:** The framework's verification layers never execute LLM-generated code. Validation uses strictly AST-based parsing (`RestrictedPython`) and the SymPy Computer Algebra System.
53
+ * **Bounded Persistent Memory:** Fast, O(1) semantic lookups via SQLite FTS5 inverted indices.
54
+ * **Memory-Safe Work Queues:** API server delegates intensive GPU compute to sandboxed isolated processes via `ProcessPoolExecutor`.
55
+
56
+ ## Status
57
+
58
+ **Current Version:** `0.1.0` (Production Ready)
59
+ **Security Posture:** Hardened
60
+
61
+ > ⚠️ **Note:** The legacy gradient-masking `SparseTrainer` has been officially deprecated. It has been replaced by the `DynamicSparseTrainer` (RigL) and `ParameterSelector`.
@@ -0,0 +1 @@
1
+ Generic single-database configuration.
@@ -0,0 +1,86 @@
1
+ from logging.config import fileConfig
2
+
3
+ from sqlalchemy import engine_from_config, pool
4
+
5
+ from alembic import context
6
+
7
+ # this is the Alembic Config object, which provides
8
+ # access to the values within the .ini file in use.
9
+ config = context.config
10
+
11
+ # Interpret the config file for Python logging.
12
+ # This line sets up loggers basically.
13
+ if config.config_file_name is not None:
14
+ fileConfig(config.config_file_name)
15
+
16
+ # add your model's MetaData object here
17
+ import os
18
+ import sys
19
+
20
+ # Add project root to sys.path
21
+ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
22
+
23
+ from asft.core.settings import get_settings
24
+ from asft.db.models import Base
25
+
26
+ settings = get_settings()
27
+ config.set_main_option("sqlalchemy.url", settings.database_url)
28
+
29
+ target_metadata = Base.metadata
30
+
31
+ # other values from the config, defined by the needs of env.py,
32
+ # can be acquired:
33
+ # my_important_option = config.get_main_option("my_important_option")
34
+ # ... etc.
35
+
36
+
37
+ def run_migrations_offline() -> None:
38
+ """Run migrations in 'offline' mode.
39
+
40
+ This configures the context with just a URL
41
+ and not an Engine, though an Engine is acceptable
42
+ here as well. By skipping the Engine creation
43
+ we don't even need a DBAPI to be available.
44
+
45
+ Calls to context.execute() here emit the given string to the
46
+ script output.
47
+
48
+ """
49
+ url = config.get_main_option("sqlalchemy.url")
50
+ context.configure(
51
+ url=url,
52
+ target_metadata=target_metadata,
53
+ literal_binds=True,
54
+ dialect_opts={"paramstyle": "named"},
55
+ )
56
+
57
+ with context.begin_transaction():
58
+ context.run_migrations()
59
+
60
+
61
+ def run_migrations_online() -> None:
62
+ """Run migrations in 'online' mode.
63
+
64
+ In this scenario we need to create an Engine
65
+ and associate a connection with the context.
66
+
67
+ """
68
+ connectable = engine_from_config(
69
+ config.get_section(config.config_ini_section, {}),
70
+ prefix="sqlalchemy.",
71
+ poolclass=pool.NullPool,
72
+ )
73
+
74
+ with connectable.connect() as connection:
75
+ context.configure(
76
+ connection=connection, target_metadata=target_metadata
77
+ )
78
+
79
+ with context.begin_transaction():
80
+ context.run_migrations()
81
+
82
+
83
+ if context.is_offline_mode():
84
+ run_migrations_offline()
85
+ else:
86
+ run_migrations_online()