APEX-E3 Dec-Enc Function-Call Model (v0.011)
Model Name: usmankhanic/apexe3-dec-enc-fn-v0011
Architecture: T5-small (encoder-decoder)
Purpose: Convert natural language queries into a structured function call format with parameters—especially tuned for capital markets applications that demand private, agentic solutions.
Overview
The APEX-E3 Dec-Enc Function-Call Model (v0.011) is a fine-tuned T5-small model specialised in generating function call structures from plain English queries. Rather than producing unstructured text, this model outputs instructions for specific function calls, including all relevant parameters.
With a special focus on capital market use cases, it was trained on queries that map directly to functions like selectStocks
, run_backtest
, and optimizer
, ensuring precise extraction of parameters needed for advanced trading, backtesting, and portfolio optimization workflows.
This solution is lightweight, highly performant, and—thanks to our novel training approach—extraordinarily easy to re-train or adapt to new function definitions and parameter sets.
Key Features
Laser-Focused on Capital Markets
- Model is pre-trained and fine-tuned to parse finance- and trading-centric instructions.
- Produces direct calls to your functions with minimal overhead.
Private & Agentic
- Ideal for organisations seeking on-premises or private cloud solutions where data control and agentic autonomy are paramount.
Ultra-Easy Training Approach
- Using a simple Python/Flask app and structured JSON, you can re-train or extend the model on your own custom function definitions in minutes, no large-scale ML infrastructure required.
- Ingestion of minimal training data is enough to achieve high accuracy in mapping user queries to structured parameters.
Lightweight, Fast Inference
- Based on T5-small (~60M parameters), balancing performance with rapid inference, even in CPU-only setups.
- Perfect for real-time or near-real-time decision-making in capital markets.
Model Details
- Base Model: T5-small
- Fine-Tuning: Customised data mapping natural language to function calls, specifically in capital markets contexts.
- Parameter Count: ~60M
- Tokenizer: T5 SentencePiece tokenizer
Training Objective
To convert input prompts like:
"Your job is to pick the correct function name and produce key=value lines.
Query: <USER_QUERY>
Format:
function_name=<NAME>
param1=value
param2=value
...
"
into structured output with the correct function name (e.g., selectStocks
, run_backtest
, or optimizer
) and the corresponding parameters (from=
, to=
, sector=
, etc.).
Intended Use Cases
This model was specifically trained to parse user requests and map them onto the following function signatures:
{
"name": "selectStocks",
"description": "Select stocks based on specified criteria",
"params": {
"criteria": "string",
"from": "string",
"to": "string",
"sector": "array",
"fundamental_factors": "array"
}
},
{
"name": "run_backtest",
"description": "Run a backtest on a given asset",
"params": {
"assetId": "string",
"from": "string",
"to": "string",
"buyCondition": "string",
"sellCondition": "string",
"startingCapital": "float",
"fees": "float"
}
},
{
"name": "optimizer",
"description": "Optimize a portfolio with a given objective function",
"params": {
"assetIdList": "array",
"timeFrame": "string",
"objectiveFunction": "string"
}
}
Examples
selectStocks
- User Query: “Find high-growth technology stocks from 2022-01-01 to 2023-12-31, focusing on P/E ratio and dividend yield.”
- Model Output (possible):
function_name=selectStocks criteria=high-growth from=2022-01-01 to=2023-12-31 sector=technology fundamental_factors=P/E ratio, dividend yield
This structured output is ready for an internal function
selectStocks(...)
.run_backtest
- User Query: “Run a backtest on asset AAPL from 2020 to 2022 with a simple buy condition of RSI<30 and sell condition of RSI>70, starting capital 100000, fees 0.1%.”
- Model Output:
function_name=run_backtest assetId=AAPL from=2020 to=2022 buyCondition=RSI<30 sellCondition=RSI>70 startingCapital=100000 fees=0.1
optimizer
- User Query: “Optimize a portfolio of [AAPL, TSLA, AMZN] using Markowitz strategy for Q1-2023.”
- Model Output:
function_name=optimizer assetIdList=AAPL, TSLA, AMZN timeFrame=Q1-2023 objectiveFunction=Markowitz
These examples showcase how the model turns free-form text into direct function invocations.
Innovative Training Approach
- Single JSON File → Fine-Tuned Model
With a minimal data set in JSON specifying(query_text, correct_function_name, correct_params)
, the included script fine-tunes T5-small specifically for your business logic. - Rapid Iteration
A typical training run of just a few epochs quickly adapts the model. This is a truly innovative approach, enabling agile updates to match evolving requirements or new function signatures. - Scalable
Despite the model’s small size, you can extend the training data seamlessly. As new parameters or entirely new functions emerge, simply add them to the training set and run the script again.
In short, you don’t need a huge ML pipeline—just minimal code and data. Our novel approach ensures top-tier performance with minimal overhead, empowering capital markets teams to create private, agentic solutions on their own infrastructure.
Performance and Metrics
- High Accuracy on parameter extraction from real-world financial queries.
- Minimal Hallucination for short, well-structured prompts.
- Smooth Generalization to novel queries involving a mix of known parameters.
Complex or ambiguous requests might require clarifying instructions or additional data. Nevertheless, in practice, our fine-tuned T5 has demonstrated strong consistency, making it a reliable component of capital market automation.
Usage Example
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model_name = "usmankhanic/apexe3-dec-enc-fn-v0011"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
# Sample prompt aligns with training format
input_text = (
"Your job is to pick the correct function name and produce key=value lines.\n\n"
"Query: Select the top growth stocks in the healthcare sector from 2021 to 2023.\n\n"
"Format:\nfunction_name=<NAME>\nparam1=value\nparam2=value\n"
)
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(
**inputs,
max_length=128, # Increase if you expect longer output
num_beams=4,
early_stopping=True
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
Expected Output (example):
function_name=selectStocks
criteria=top growth
from=2021
to=2023
sector=healthcare
fundamental_factors=
(Model might produce or omit certain factors depending on the prompt details.)
Limitations
- Domain-Specific Queries
The model is specialized for capital market queries. In other domains, the output may be less reliable. - Parameter Guesswork
If a prompt is vague or references unknown fields, T5 may produce extraneous parameters or missing info. - Context Window
T5-small typically handles up to ~512 tokens effectively. Extremely long queries risk truncation.
License & Citation
This model is provided under the Apache-2.0 License. For citation, please reference:
@misc{usmankhanic_apexe3_2025,
title={APEX-E3 Dec-Enc Function-Call Model (v0.011)},
author={Khan, Usman and Contributors},
year={2025},
howpublished={\url{https://huggingface.co./usmankhanic/apexe3-dec-enc-fn-v0011}},
}
If you find this model helpful, please consider giving it a ⭐ on Hugging Face.
Contact & Contributions
For questions, feedback, or contributions, feel free to open an issue or pull request.
Empower your capital markets pipeline with fast, private, and agentic function-call modeling—made effortless by our novel training approach!
- Downloads last month
- 84